Skip to content
SkillScript-led3,078 tokens in use

embedded-agents-messages-api

The default way to embed Claude agents in a Next.js app: the Messages API tool runner in your own process, with caller-bound tools, knowledge files, MCP allowlists and live tests.

680 stars on the repository MIT Licensephuryn/product-engineering · app-stack/skills/embedded-agents-messages-api
claude plugin install app-stack@product-engineering
View source

Install command as written in the repository's README

Skill label

measured from its files

What installing embedded-agents-messages-api costs

36tokens idle
3,078tokens in use
9,067tokens, up to

Idle is what sits in context while the skill is installed. In use is its instructions, loaded when it runs. Up to adds the files its instructions link. Counts are approximate, made offline with cl100k_base.

Model dependence Script-led

Script-ledMixedModel-led

Most of this skill is scripts, so it behaves much the same whichever model runs it.

This describes the skill's structure, how much of it is scripts. It does not say how well it works. Scripts: examples/knowledge-agent.live.test.ts, examples/research-agent.live.test.ts, scripts/discover-mcp-tools.mjs, scripts/new-agent.mjs, templates/agent-mcp.ts, templates/agent.test.ts, templates/agent.ts, templates/agents.live.test.ts, templates/route.ts.

Touches

shelldetectedwrites filesdetectedcredentialsdetected

Declared tags come from the skill's frontmatter; detected ones from its scripts, its code blocks and the commands it names in inline code. This is detected, not audited.

How it scores

Quality

How well the skill is written, counted from its own files: its frontmatter, its steps, examples, stated output and constraints, its size and whether every file it ships is one it names.How we score it →
Excellent
  • Frontmatter8/15
  • Structure19/25
  • Examples12/15
  • Output15/15
  • Size15/15
  • Resources12/15

Security

Starts at 100 and loses points for each thing in the skill's files that a reader should look at first.How we score it →
Good
  • Writes files−8

    does this on the machine, and the frontmatter does not say so

    scripts/new-agent.mjs, line 23
  • Reads credentials−15

    does this on the machine, and the frontmatter does not say so

    templates/agent.test.ts, line 21

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Good
  • Development activity100
  • Maintenance100
  • Community44
  • Maturity4
  • Momentum40

This skill installs a wrapper, a streaming route and tests that run Claude agents on the Anthropic SDK’s tool runner, inside the app’s own process on any Node host. The agent has exactly the tools the wrapper gives it, with no shell and no web access built in.

An agent is a directory with an AGENTS.md as its whole system prompt, plus optional knowledge, local skills and an MCP config. It also shows how to build tools that act for the signed-in caller without ever taking an identity as input.

What You Get

  • A wrapper, an MCP helper, a route that lists and streams agents, a unit test and a live test
  • A script that creates an agent directory, and one that lists each MCP server’s tools next to the granted ones
  • Knowledge tools confined to the agent’s knowledge folder, and a load_skill tool for agent-local skills
  • A pattern for caller tools where identity is closed over, never passed as input
  • Two finished example agents, copied only on request

Common Use Cases

  • Adding a support agent that reads a subscriber’s invoices through app-owned tools
  • Embedding a knowledge agent that answers only from local markdown files
  • Giving an agent a short list of MCP tools such as web research
  • Deploying an agent on a serverless host whose time limit covers the slowest run

What Makes It Unique

It is the default of two embedded-agent skills and runs with no subprocess, so a serverless function can host it. Tools are the whole boundary: nothing is built in, file paths are resolved through symlinks, exceptions reach the model as a fixed sentence, and one-way actions go through a button the app shows, never through model text.

Under The Hood

The skill is mostly instructions, with two Node scripts and TypeScript templates. The agent runs npm installs, copies template files into the app and runs new-agent.mjs, which writes a new agent directory. The discover script opens each MCP server from the agent’s config, which can reach the network with the agent’s secrets, and only reads its tool list. At run time the wrapper calls the Anthropic API with the app’s key, runs the tools the model asks for, and starts stdio MCP servers as child processes. The live tests call the real model.

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers