Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

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.

  • Score 74
  • 946 stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

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-api

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install embedded-agents-messages-api in Claude Code

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

A

No 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 →

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.

embedded-agents-messages-api Install

Add to stack

Loading.