phuryn/product-engineering / app-stack/skills/embedded-agents-messages-api
embedded-agents-messages-api
VerifiedBuilding, adding or wiring up an agent or an agent chat inside a Next.js app: embed Claude agents on the Messages API, the default way.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 12.7 KB |
| examples/knowledge-agent.live.test.ts | script | 1.2 KB |
| examples/knowledge-agent/AGENTS.md | markdown | 2.0 KB |
| examples/knowledge-agent/knowledge/jtbd.md | markdown | 3.3 KB |
| examples/knowledge-agent/knowledge/llms.md | markdown | 6.1 KB |
| examples/knowledge-agent/knowledge/okrs.md | markdown | 2.7 KB |
| examples/knowledge-agent/knowledge/product-strategy.md | markdown | 3.8 KB |
| examples/knowledge-agent/knowledge/product-vision.md | markdown | 3.8 KB |
| examples/research-agent.live.test.ts | script | 1.1 KB |
| examples/research-agent/.mcp.json | config | 277 B |
| examples/research-agent/AGENTS.md | markdown | 2.5 KB |
| reference/playbook.md | markdown | 23.0 KB |
| scripts/discover-mcp-tools.mjs | script | 3.0 KB |
| scripts/new-agent.mjs | script | 1.9 KB |
| templates/agent-mcp.ts | script | 4.9 KB |
| templates/agent.test.ts | script | 18.0 KB |
| templates/agent.ts | script | 18.6 KB |
| templates/agents.live.test.ts | script | 1.9 KB |
| templates/route.ts | script | 2.4 KB |
templates/agents.live.test.ts
View on GitHubimport { describe, test, expect, vi } from 'vitest';
vi.mock('server-only', () => ({}));
import { agentDir, agentRequest, askAgent, listAgents } from '@/lib/agent';
import { connectMcp, openMcpTools, readMcpConfig } from '@/lib/agent-mcp';
// Every agent, against the real model and its real MCP servers. Costs money and needs
// ANTHROPIC_API_KEY plus each agent's MCP secrets. Runs outside the gate as `npm run agents:live`,
// before any release that adds or changes an agent.
describe.each(listAgents())('%s', (agent) => {
test('every MCP server it declares starts and still offers every tool it is allowed', async () => {
for (const [name, server] of Object.entries(readMcpConfig(agentDir(agent)))) {
const { client, offered } = await connectMcp(name, server);
try {
const names = offered.map((t) => t.name);
for (const allowed of server.allowedTools ?? []) expect(names, `${name} no longer offers ${allowed}`).toContain(allowed);
} finally {
await client.close();
}
}
});
test('the model is shown exactly its own tools: its files, skills and allowed MCP tools, nothing else', async () => {
const mcp = await openMcpTools(agentDir(agent));
try {
const allowed = Object.values(readMcpConfig(agentDir(agent))).flatMap((s) => s.allowedTools ?? []);
const fileAndSkillTools = ['list_files', 'read_file', 'search_files', 'load_skill', 'read_skill_file'];
for (const t of agentRequest({ agent }, [], mcp.tools).tools) expect([...fileAndSkillTools, ...allowed]).toContain(t.name);
} finally {
await mcp.close();
}
});
test('answers', async () => {
let done = false;
for await (const ev of askAgent({ agent, prompt: 'Introduce yourself in one sentence.' })) {
if (ev.type === 'done') {
done = true;
expect(ev.metadata.cost).toBeGreaterThan(0);
}
}
expect(done).toBe(true);
});
});
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |