注册并分享邀请链接,可获得视频播放与邀请奖励。

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture 投稿は個人の意見です。
加入 May 2026
279 正在关注    408 粉丝
# Useful but Little-Known Features of Claude Agent SDK 🌍 Want to give each subagent its own skills, MCP servers, and memory? AgentDefinition has you covered with rich per-agent configuration! Claude Agent SDK's AgentDefinition supports skills, memory, mcpServers, and many more fields for comprehensive per-agent customization. 📌 Title: Per-Agent Configuration: skills / memory / mcpServers 🔗 URL: 🧩 Overview `AgentDefinition` includes numerous optional fields beyond the required `description` and `prompt`. Use `skills` to preload domain-specific knowledge, `memory` to set the memory source (`user`, `project`, or `local`), and `mcpServers` to connect MCP servers by name or inline config. Additional fields include `tools`, `disallowedTools`, `model` (aliases like `sonnet`/`opus`/`haiku`/`inherit` or a full model ID), `effort`, `permissionMode`, `maxTurns`, `background`, and `initialPrompt` for comprehensive behavior control. 🛠 How to Use ```python # Python - fully configured agent definition from claude_agent_sdk import AgentDefinition agent = AgentDefinition( description="Database migration specialist", prompt="You are a DB migration expert. Propose safe migration strategies.", tools=["Read", "Grep", "Glob", "Bash"], disallowed_tools=["Bash(rm *)"], # Block specific operations model="opus", # Use high-quality model skills=["db-migration"], # Preload skills memory="project", # Use project memory mcpServers=["postgres-server"], # Connect MCP servers effort="high", # Higher reasoning level max_turns=20, # Limit maximum turns permission_mode="acceptEdits", # Auto-approve edits background=False, # Run in foreground ) ``` ```typescript // TypeScript const agent: AgentDefinition = { description: "Database migration specialist", prompt: "You are a DB migration expert. Propose safe migration strategies.", tools: ["Read", "Grep", "Glob", "Bash"], disallowedTools: ["Bash(rm *)"], model: "opus", skills: ["db-migration"], memory: "project", mcpServers: ["postgres-server"], effort: "high", maxTurns: 20, permissionMode: "acceptEdits", background: false, }; ``` 🏗 Integration into Production Systems - Use `skills` to preload domain-specific knowledge for specialized agents (unlisted skills remain invocable via the Skill tool) - Set appropriate `memory` scope to control context sharing between agents - Manage database and external service connections via `mcpServers` by name or inline configuration - Use `maxTurns` for cost control and runaway prevention; set `effort` to match task importance - Enable `background: true` for non-blocking execution to improve parallel task efficiency 💡 Use Cases 🗄 Database migration agents with MCP server connections for direct DB access 📚 Expert agents with domain-specific skills preloaded at startup ⚡ High-speed workflows with background agents running parallel analyses ⚠️ Caveats - Omitting `tools` inherits all tools from the parent; specify explicitly if you want restrictions - Subagent `permissionMode` is forcibly inherited when the parent uses `bypassPermissions`, `acceptEdits`, or `auto` and cannot be overridden - Skills listed in `skills` are preloaded at startup, but unlisted skills can still be invoked via the Skill tool - In the Python SDK, field names use camelCase to match the wire format ✨ With AgentDefinition's rich configuration fields, you can build purpose-built specialist agents instead of generic ones. Tailor every aspect to the task at hand! #ClaudeAgentSDK# #AIAgent#
显示更多