ai-llm-integration-expert
Expert guide for integrating Large Language Models (LLMs), Model Context Protocol (MCP v1.x), hybrid reasoning models, RAG architecture, vector databases, and AI agents / Panduan ahli untuk integrasi LLM, Model Context Protocol (MCP), model hybrid reasoning, arsitektur RAG, vector database, dan agen AI.
roedyrustam · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add roedyrustam/vibes-plug --skill ai-llm-integration-expert技能说明
name: ai-llm-integration-expert description: "Expert guide for integrating Large Language Models (LLMs), Model Context Protocol (MCP v1.x), hybrid reasoning models, RAG architecture, vector databases, and AI agents / Panduan ahli untuk integrasi LLM, Model Context Protocol (MCP), model hybrid reasoning, arsitektur RAG, vector database, dan agen AI." author: "Roedy Rustam"
version: "3.0.0"
AI & LLM Integration Expert (2026 Edition)
English
Description
Production-grade guidelines for integrating AI, Model Context Protocol (MCP), hybrid reasoning models, and Large Language Models (LLMs) into modern software architectures. Covers hybrid reasoning token streaming, Streamable HTTP MCP transports, agentic memory architectures, native context caching, RAG pipelines, and multi-model orchestration.
Trigger Conditions
- Integrating frontier reasoning models: Anthropic Claude 3.7 Sonnet (Hybrid/Extended Thinking), Google Gemini 3.8 Flash / 3.1 Pro (Thinking Mode), OpenAI o1 / o3 / o3-mini / GPT-4.5 / GPT-4o, DeepSeek-R1 / V3, or open-source weights (Llama 4, Qwen 2.5/3 Coder).
- Implementing Model Context Protocol (MCP) server or client integrations with Streamable HTTP transport or MCP Sampling.
- Building AI chatbots, copilots, or autonomous AI agent workflows (LangGraph, OpenAI Agents SDK, Google ADK, Mastra.ai, Vercel AI SDK 5.x/6.x).
- Managing streaming reasoning tokens (
<think>chunks) separately from final output in user interfaces. - Implementing hybrid RAG with vector databases (Supabase pgvector HNSW, Qdrant, Pinecone) and cross-encoder rerankers.
- Building agentic memory systems (short-term, long-term semantic, episodic) using Mem0 or vector stores.
- Implementing cost optimization with provider-native Context Caching (Gemini
cachedContent, Anthropic ephemeral prompt cache, OpenAI prefix cache).
Model Capability Matrix (2026)
| Provider | Model | Context | Reasoning Type | Primary Strength |
|---|---|---|---|---|
| Anthropic | Claude 3.7 Sonnet | 200K | Hybrid Thinking (Standard + Extended) | Code generation, complex reasoning, Computer Use |
| Anthropic | Claude 3.5 / 4 Opus | 200K | Deep Deliberation | Deep architectural synthesis, policy analysis |
| Gemini 3.8 Flash | 1M–2M | Flash Thinking (Configurable Budget) | Ultra-low latency, multimodal live, high-frequency loops | |
| Gemini 3.1 / 3.5 Pro | 2M | Extended Reasoning | Needle-in-a-haystack, long-context repos, deep research | |
| OpenAI | o3 / o3-mini | 200K | Native Test-Time Reasoning | Math, competitive coding, formal logic verification |
| OpenAI | GPT-4.5 / GPT-4o | 128K | Direct Instruction & Fast Tooling | Low-latency voice, structured JSON, tool-calling |
| DeepSeek | DeepSeek-R1 | 128K | Open Reasoning (Distill & MoE) | State-of-the-art open weights reasoning, math, coding |
| DeepSeek | DeepSeek-V3 | 128K | General Multimodal / Text | High throughput, extremely cost-efficient coding |
| Qwen | Qwen 2.5 / 3 Coder | 128K | Open Source Code Specialist | Self-hosted coding agent, local copilot integration |
Core Architecture Guidelines
1. Hybrid Reasoning & Streaming Token Handling
Modern frontier models emit internal thinking/reasoning tokens during test-time compute:
- Thinking Token Separation: Separate internal
<think>or reasoning chunks from conversational output. Stream reasoning into collapsible UI accordion blocks while presenting clean output to the user. - Vercel AI SDK 5.x/6.x Integration:
import { streamText } from 'ai'; import { anthropic } from '@ai-sdk/anthropic'; const result = streamText({ model: anthropic('claude-3-7-sonnet-20250219'), providerOptions: { anthropic: { thinking: { type: 'enabled', budgetTokens: 4096 }, }, }, prompt: 'Refactor this distributed consensus engine...', }); // Access reasoning stream alongside main text for await (const part of result.fullStream) { if (part.type === 'reasoning') { process.stdout.write(`[Thinking]: ${part.textDelta}`); } else if (part.type === 'text-delta') { process.stdout.write(part.textDelta); } } - Thinking Token Overflow Handling: If
max_tokenscuts off reasoning before output generation (e.g.,<think>block doesn't close), detect missing closing tags and dynamically increase budget/retry or append a forceful closing prompt block. - Multi-Provider Thinking Configuration: Use Anthropic
thinkingparameter (budgetTokens), GooglethinkingConfig(set totruewith budget logic), and OpenAI reasoning tokens (viareasoning_effort: "high").
2. Model Context Protocol (MCP) — Streamable HTTP & Sampling
Standardize all agent-tool and agent-host communications using MCP specifications:
- Streamable HTTP Transport: Modern cloud deployments use Streamable HTTP (bidirectional JSON-RPC streaming over HTTP POST/SSE hybrid) instead of fragile stdio connections.
- MCP Sampling: Allow MCP servers to request LLM completions back from the host client, enabling nested agentic tools without distributing API keys to tool servers.
- Authorization & Security: Enforce OAuth 2.1 scoped bearer tokens on remote MCP endpoints. Validate all incoming tool inputs using strict Zod schemas.
3. Agentic Memory Architecture
Production AI agents require multi-layered memory:
- In-Context Working Memory: Pass recent turn messages within the prompt window.
- Long-Term Semantic Memory: Embed user preferences and facts using pgvector (HNSW index) or Qdrant; perform cosine similarity searches.
- Episodic Memory (Mem0 / Letta (formerly MemGPT)): Automatically synthesize session checkpoints and index past user decisions for human-like recall.
- Knowledge Graph Memory: Maintain structured entity-relationship t