embedded-agents-messages-api
Skill by phuryn
Builds embedded Claude agents in a Next.js app on the Claude API Messages API. It adds an askAgent wrapper, an agent route and tests, with each agent defined as a directory of instructions, knowledge files and MCP config.
Install embedded-agents-messages-api
Built from the published package, never by AI.
git clone --depth 1 https://github.com/phuryn/product-engineering /tmp/product-engineering && mkdir -p ~/.claude/skills && cp -r /tmp/product-engineering/app-stack/skills/embedded-agents-messages-api ~/.claude/skills/embedded-agents-messages-apiRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install embedded-agents-messages-api in Claude Code
git clone --depth 1 https://github.com/phuryn/product-engineering /tmp/product-engineering && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/product-engineering/app-stack/skills/embedded-agents-messages-api ~/.gemini/antigravity-cli/skills/embedded-agents-messages-apiAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install embedded-agents-messages-api in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
embedded-agents-messages-api is a skill for building an agent or an agent chat inside a Next.js app. It runs Claude agents on the Claude API Messages API, where the Anthropic SDK tool runner drives the loop inside the app's process. The agent has exactly the tools the wrapper gives it, and nothing is built in. The skill installs one askAgent wrapper, an agent route, and unit and live test files. Each agent is a directory under .claude/agents/ that holds an AGENTS.md instruction file, and optionally knowledge files, agent-local skills and an .mcp.json file.
The app owns the request, the caller, storage and the UI, while the agent owns reasoning and tool choice. Developers can give an agent per-request tools that act for the signed-in caller. Risky or one-way actions are proposed by a tool and decided by app code. The source calls this the default for a new product. It names the separate Agent SDK skill for agents that need the Claude Code engine's built-in file and shell tools. It is aimed at developers building Next.js products with embedded agents.
Written from the project's SKILL.md and checked against it.
What it can do
- askAgent wrapperRuns any agent directory through one wrapper function, with no agent name in code.
- Agent directoriesDefines each agent in .claude/agents/<name>/ with an AGENTS.md system prompt.
- Knowledge filesLets an agent answer only from files in knowledge/ using list, search and read tools.
- Agent-local skillsLists skills in the system prompt and lets the agent load one with load_skill.
- MCP serversConnects servers listed in an agent's .mcp.json, exposing only the tools allowed in allowedTools.
- Per-request caller toolsAdds app tools built per request that close over the signed-in caller's identity.
- Agent routeProvides GET /api/agents to list agents and POST to stream one as server-sent events.
What you need
- ANTHROPIC_API_KEY
- Next.js App Router app in TypeScript
- Node.js runtime
- npm packages @anthropic-ai/sdk, @modelcontextprotocol/sdk, zod, server-only and vitest
Try asking
- Add a knowledge agent that answers only from my product docs.
- Create a new agent with an MCP server and a restricted tool list.
- Wire an agent chat picker in my Next.js app using /api/agents.
Good to know
- The tool runner is marked beta in the TypeScript SDK, so upgrades need re-testing.
- Stdio MCP servers run as child processes, which rules out edge runtimes.
- Client-sent history can be forged, so keep transcripts on the server before tools act for the caller.
- The live agent test calls the real model and costs money.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: app-stack/skills/embedded-agents-messages-api/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to embedded-agents-messages-api
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
embedded-agents-messages-api: common questions
Does this skill use the Claude Agent SDK?
No. It runs agents on the Claude API through the Anthropic SDK tool runner. The source describes a separate embedded-agents-agent-sdk skill for the Agent SDK.
Can the agent use built-in shell or file tools?
No. The source says nothing is built in, so the agent has no shell, no web access and no file system beyond the tools the wrapper provides.
How does it stop an agent reading another user's records?
Per-request tools close over the resolved caller, and no tool takes an email, user or account id as input.
How do I install embedded-agents-messages-api?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is embedded-agents-messages-api free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is embedded-agents-messages-api safe to use?
It scores 74 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to embedded-agents-messages-api?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
