xiaohongshu
xiaohongshu
Create your agent-integration skill from OpenAI SDK and LiteLLM documentation before learning framework integration
Full skill instructions
Your Task API model is deployed and running via Ollama. Now you need to connect it to agent frameworks like OpenAI Agents SDK, Claude Code, and MCP servers.
Before learning integration patterns, you will own an agent-integration skill. This skill becomes your reusable reference for connecting custom models to any framework.
This lesson follows the Skill-First Learning Pattern: build the skill, then learn what it knows.
Agent framework integration involves multiple interconnected patterns:
| Pattern | What It Handles |
|---|---|
| LiteLLM Proxy | Unified OpenAI-compatible API for any backend |
| Base URL Config | Redirect SDK calls to custom endpoints |
| Tool Calling | Structured outputs for function invocation |
| Error Fallback | Graceful degradation to foundation models |
| MCP Integration | Model Context Protocol server setup |
Learning these patterns without a reference leads to trial-and-error debugging. Your skill captures verified patterns from official documentation, giving you a reliable starting point.
If you completed Chapter 70, you already have the skills-lab. If not:
cd claude-code-skills-lab
claude
Copy and paste this prompt:
Using your skill creator skill, create a new skill called "agent-integration"
for connecting custom LLM backends to agent frameworks.
I need patterns for:
- LiteLLM proxy configuration for OpenAI SDK compatibility
- OpenAI Agents SDK with custom base_url
- Tool calling with custom models (structured outputs)
- Error handling and fallback to foundation models
- MCP server integration with custom backends
Use context7 skill to study:
- OpenAI Python SDK documentation
- LiteLLM documentation
- FastMCP documentation
Build from official docs only, no assumed knowledge.
Claude will:
Your skill appears at .claude/skills/agent-integration/.
Check that your skill exists:
ls .claude/skills/agent-integration/
Expected Output:
SKILL.md
Open the skill and confirm it includes:
A well-built agent-integration skill includes these sections:
# config.yaml for LiteLLM
model_list:
- model_name: task-api-model
litellm_params:
model: ollama/task-api-model
api_base: http://localhost:11434
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:4000/v1", # LiteLLM proxy
api_key="sk-local" # Placeholder for local
)
tools = [{
"type": "function",
"function": {
"name": "create_task",
"description": "Create a new task",
"parameters": {
"type": "object",
"properties": {
"title": {"type": "string"},
"priority": {"type": "string", "enum": ["low", "medium", "high"]}
},
"required": ["title"]
}
}
}]
def call_with_fallback(prompt, tools):
try:
return custom_client.chat.completions.create(
model="task-api-model",
messages=[{"role": "user", "content": prompt}],
tools=tools
)
except Exception:
return openai_client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": prompt}],
tools=tools
)
You now own an agent-integration skill built from official OpenAI SDK, LiteLLM, and FastMCP documentation.
The rest of this chapter teaches you what your skill knows:
As you complete each lesson, your skill improves. By the chapter's end, you have a production-ready integration skill for any custom model.
Open my agent-integration skill at .claude/skills/agent-integration/SKILL.md
and explain its structure. What sections does it have? What patterns are
included? Are there any gaps I should fill in as I complete this chapter?
What you're learning: Understanding skill structure and identifying improvement opportunities.
I have my Task API model running on Ollama at localhost:11434. Review my
agent-integration skill and tell me which patterns apply to my setup.
What configuration changes would I need for a different setup (like vLLM
or cloud deployment)?
What you're learning: Mapping general patterns to your specific deployment context.
Based on what's in my agent-integration skill, which patterns do I already
understand from previous chapters, and which are new? Help me prioritize
what to focus on in the upcoming lessons.
What you're learning: Self-assessment and learning prioritization through skill analysis.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience