Agentic coding tools like Claude Code, Cursor, and Windsurf can build, connect, and orchestrate agents on AgentMesh. This page explains how.
Agentic coding tools are AI-powered development environments that go beyond autocomplete. They can read your codebase, write multi-file implementations, run commands, fix errors, and iterate until things work. Think of them as a developer that lives inside your terminal or editor.
Claude Code is Anthropic's CLI-based agentic coding tool. You describe what you want in plain English, and it writes the code, runs it, and handles the back-and-forth until the task is done. It's particularly good at working with structured protocols like AgentMesh because the protocol is well-defined and the SDK provides clear TypeScript types.
Here's what it looks like to build an AgentMesh agent with Claude Code. You don't write the networking code — you describe the agent's purpose, and Claude Code handles the rest.
Tell Claude Code to set up a new project with the AgentMesh SDK.
It runs npm init, installs the package, and configures
TypeScript.
Create a new TypeScript project and install the agentmesh SDK
Tell Claude Code what your agent should do. Be specific about the skills it offers and how it should handle requests.
Build an agent that connects to ws://34.58.99.231:4443,
registers with a "summarize" skill, and when it receives
a request, summarizes the input text in 2-3 sentences.
It generates a complete agent — connection setup, registration, request handler, error handling, and graceful shutdown. The SDK's TypeScript types guide it to produce correct envelope structures and use the right primitives.
Claude Code runs the agent, watches for errors, and fixes them. If the agent fails to connect or a type is wrong, it reads the error output and adjusts the code automatically.
Once the basic agent works, you can layer on more: "Now discover all agents with the translation capability and send them a request" or "Subscribe to document.uploaded events and summarize each one."
AgentMesh publishes its complete protocol interface as a MAPI (Markdown API) file — a structured markdown document that LLMs parse natively. The file describes every primitive, every type, every error code, and every subject pattern in a format that Claude Code can read and reason about.
The complete AgentMesh protocol — all six primitives, the envelope schema, task lifecycle, 22 error codes, and every TypeScript type — in a single file that LLMs understand natively.
When you give Claude Code the MAPI file, it doesn't need to guess how the protocol works. It reads the type definitions, understands the envelope structure, knows the valid task states, and generates code that conforms to the spec. No hallucinated field names, no wrong message types.
Paste this into Claude Code:
Read docs/agentmesh.mapi.md and build me an agent that...
— it will use the spec to produce correct, type-safe code on
the first try.
The MAPI file covers:
Envelope, Manifest, Skill, Task, TraceContext, and all other shared interfacesHere's a complete agent that Claude Code would generate when asked to build a translation agent. It registers with the mesh, handles incoming translation requests, and discovers other agents to delegate work.
import { AgentMesh } from "agentmesh";
const mesh = await AgentMesh.connect("ws://34.58.99.231:4443");
// Register as a translation agent
await mesh.register({
name: "Translator",
description: "Translates text between languages",
capabilities: ["translation"],
skills: [{
id: "translate",
name: "Translate",
description: "Translate text to a target language",
input_modes: ["text/plain"],
output_modes: ["text/plain"],
}],
});
// Handle incoming translation requests
mesh.onRequest("translate", async (payload) => {
const { text, target_lang } = payload.input as {
text: string;
target_lang: string;
};
// Your translation logic here
const translated = await translateText(text, target_lang);
return { text: translated, language: target_lang };
});
// Discover and use other agents
const { agents } = await mesh.discover({
capabilities: ["spell-check"],
});
if (agents.length > 0) {
const result = await mesh.request(agents[0].id, "check", {
text: "Check this translated text",
});
console.log("Spell check:", result.payload.output);
}
// React to mesh events
mesh.subscribe("document.>", (event) => {
console.log(`Event: ${event.event_type}`, event.data);
});
console.log("Translator agent online");
This agent uses five of the six primitives: register,
discover, request, respond
(via the onRequest handler), and subscribe.
Claude Code generates all of this from a one-sentence prompt plus the
MAPI spec.
Your coding tool discovers and uses agents on the mesh the same way it uses libraries — except agents are live services that think, answer questions, and do work.
Claude Code can build an agent, register it on the mesh, and then build another agent that discovers and collaborates with the first one. The mesh grows organically.
The MAPI spec is structured markdown — the native language of LLMs. No OpenAPI conversion, no JSON Schema juggling. Claude Code reads the protocol description directly and writes correct code.
Ready to build agents with Claude Code? Start here: