embedded-agents-agent-sdk
БесплатноЗапускает вложенные скриптыНе проверенOnly when the Agent SDK is asked for, an agent needs Claude Code's own tools, or the app already runs it: embed Claude agents in a Next.js app with the Agent…
от sickn33★ 50 670 звёзд на GitHubОб этом скилле
Embedded agents — Claude Agent SDK
Operational boundaries
Keep the scope, sandbox, credentials and approval settings supplied by the user or host. Obtain authorization before delegating, exposing project files to another provider, enabling connectors or hooks, using paid services or deploying. Use synthetic or redacted inputs for examples. Keep security reviews static and defensive, with findings and fixes grounded in source inspection.
When to Use
Only when the Agent SDK is asked for, an agent needs Claude Code's own tools, or the app already runs it: embed Claude agents in a Next.js app with the Agent SDK.
Use the Agent SDK when the agent needs the Claude Code engine. Also use it when the product already runs it. The SDK starts that engine as a subprocess with built-in file and shell tools and Claude Code's own system prompt. It loads skills and MCP and needs a long-lived Node host. Both embedded-agent skills run the same agent directories. The embedded-agents-messages-api skill is the default for a new product. It uses the Anthropic SDK's tool runner in the app's own process on any Node host, with only the wrapper's tools and no subprocess.
Read the product's own agent instructions before changing its embedded agents. Start with its root AGENTS.md or CLAUDE.md, and tell any subagent spawned for this work to read it too. Its rules on secrets, environment variables, validation, callers, tests and release apply here. This skill adds how to run Claude agents inside the app. Read reference/playbook.md before changing the wrapper's contract or explaining it in depth. It holds the full playbook and the measurement behind every option.
Keep request, caller, storage and UI ownership in the app. The agent owns reasoning and tools. An agent is a directory, .claude/agents/<name>/, with AGENTS.md as its only instruction file. It may also hold knowledge/, agent-local skills in .claude/skills/, and .mcp.json. One wrapper function, askAgent, runs any agent. No agent name appears in code.
1. First use: install the wrapper
Search for askAgent before installing another wrapper. If it exists, skip to § 2. Otherwise:
Create only the smallest requested app when none exists. Use Next.js App Router in TypeScript, which these files target. Add nothing unasked for: no database, sign-in or billing for a local prototype.
Install the missing dependencies. Run
npm i @anthropic-ai/claude-agent-sdk zod server-onlyandnpm i -D vitest.Copy the wrapper, route and tests, changing only import paths.
From this skill To the app templates/agent.tssrc/lib/agent.ts— the wrappertemplates/route.tssrc/app/api/agents/route.ts—GETlists agents,POSTstreams onetemplates/agent.test.tstests/unit/agent.test.ts— the contract, insidenpm test, no model calltemplates/agents.live.test.tstests/live/agents.live.test.ts— every agent against the real modelThe tests import
@/lib/agent, so Vitest needs the same@alias astsconfig.json. The live test gets its own Vitest config (includetests/live/**/*.live.test.ts,testTimeout: 180_000,fileParallelism: false) and a script,agents:live. It costs money, so it stays out ofnpm testand the gate.Set each required secret per environment and never commit it. Set
ANTHROPIC_API_KEYand every secret referenced by an agent's.mcp.json; applyenvironments. On a developer's laptop the SDK falls back to their own Claude login when the key is absent; a deployed product always uses the key.Keep the contract. Every option in
agentOptions()exists because an SDK default failed a measurement (playbook § 9). Change one only after re-measuring it.
2. Add an agent
- Create the agent directory and fill in its instructions. Run
node <skill dir>/scripts/new-agent.mjs <name> [--knowledge] [--mcp], then fill inAGENTS.md: role, sources, output format, refusals. A fixed sign-off line is the cheapest live-test proof that the instructions are in force. - Keep knowledge and automatically discovered skills inside the agent directory. Put knowledge in
knowledge/*.md, and tell the agent inAGENTS.mdto answer only from them. Agent-local skills are found automatically in.claude/agents/<name>/.claude/skills/<skill>/SKILL.md. - Allow only MCP tools the agent's job needs. Put servers in
.mcp.json, with secrets as${VAR}, never literal. Runnode --env-file=.env <skill dir>/scripts/discover-mcp-tools.mjs <name>to list each server's tools, then restrict itsallowedTools. Anything unlisted is denied. Commit the agent's.mcp.json, which holds no secrets. Ifgit check-ignorereports it ignored, the repository's.gitignorehas an unanchored.mcp.jsonrule meant for the root file. Anchor it as/.mcp.json. - Discover agents from their directories rather than hardcoding the UI list.
Установить embedded-agents-agent-sdk в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл embedded-agents-agent-sdk?
Only when the Agent SDK is asked for, an agent needs Claude Code's own tools, or the app already runs it: embed Claude agents in a Next.js app with the Agent SDK.
Как установить скилл embedded-agents-agent-sdk?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл embedded-agents-agent-sdk запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic