Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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:

  1. 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.

  2. Install the missing dependencies. Run npm i @anthropic-ai/claude-agent-sdk zod server-only and npm i -D vitest.

  3. Copy the wrapper, route and tests, changing only import paths.

    From this skill To the app
    templates/agent.ts src/lib/agent.ts — the wrapper
    templates/route.ts src/app/api/agents/route.ts — GET lists agents, POST streams one
    templates/agent.test.ts tests/unit/agent.test.ts — the contract, inside npm test, no model call
    templates/agents.live.test.ts tests/live/agents.live.test.ts — every agent against the real model

    The tests import @/lib/agent, so Vitest needs the same @ alias as tsconfig.json. The live test gets its own Vitest config (include tests/live/**/*.live.test.ts, testTimeout: 180_000, fileParallelism: false) and a script, agents:live. It costs money, so it stays out of npm test and the gate.

  4. Set each required secret per environment and never commit it. Set ANTHROPIC_API_KEY and every secret referenced by an agent's .mcp.json; apply environments. 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.

  5. 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

  1. Create the agent directory and fill in its instructions. Run node <skill dir>/scripts/new-agent.mjs <name> [--knowledge] [--mcp], then fill in AGENTS.md: role, sources, output format, refusals. A fixed sign-off line is the cheapest live-test proof that the instructions are in force.
  2. Keep knowledge and automatically discovered skills inside the agent directory. Put knowledge in knowledge/*.md, and tell the agent in AGENTS.md to answer only from them. Agent-local skills are found automatically in .claude/agents/<name>/.claude/skills/<skill>/SKILL.md.
  3. Allow only MCP tools the agent's job needs. Put servers in .mcp.json, with secrets as ${VAR}, never literal. Run node --env-file=.env <skill dir>/scripts/discover-mcp-tools.mjs <name> to list each server's tools, then restrict its allowedTools. Anything unlisted is denied. Commit the agent's .mcp.json, which holds no secrets. If git check-ignore reports it ignored, the repository's .gitignore has an unanchored .mcp.json rule meant for the root file. Anchor it as /.mcp.json.
  4. Discover agents from their directories rather than hardcoding the UI list.
Полный SKILL.md на GitHub

Установить embedded-agents-agent-sdk в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

LICENSEexamples/knowledge-agent.live.test.tsexamples/knowledge-agent/AGENTS.mdexamples/knowledge-agent/knowledge/jtbd.mdexamples/knowledge-agent/knowledge/llms.mdexamples/knowledge-agent/knowledge/okrs.mdexamples/knowledge-agent/knowledge/product-strategy.mdexamples/knowledge-agent/knowledge/product-vision.mdexamples/research-agent.live.test.tsexamples/research-agent/.mcp.jsonexamples/research-agent/AGENTS.mdreference/playbook.mdscripts/discover-mcp-tools.mjsscripts/new-agent.mjstemplates/agent.test.tstemplates/agent.tstemplates/agents.live.test.tstemplates/route.ts

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 запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить embedded-agents-agent-sdk с