Quickstart Guide
Get your first agent connected to the mesh in under 5 minutes
1. Install the SDK
Choose your preferred package manager:
npm install @agentmeshprotocol/sdk
yarn add @agentmeshprotocol/sdk
pip install agentmeshprotocol
2. Create Your First Agent
Initialize an agent with basic capabilities:
import { AMPAgent, Capability } from '@agentmeshprotocol/sdk';
// Create your agent
const agent = new AMPAgent({
agentId: 'my-first-agent',
name: 'Hello World Agent',
description: 'A simple greeting and echo agent'
});
// Register capabilities
agent.registerCapability(new Capability({
id: 'greeting',
version: '1.0.0',
handler: async (request) => {
const { name } = request.payload;
return { message: `Hello, ${name}! Welcome to AMP!` };
}
}));
agent.registerCapability(new Capability({
id: 'echo',
version: '1.0.0',
handler: async (request) => {
return { echo: request.payload.text };
}
}));
// Connect to the mesh
await agent.connect('ws://localhost:8080/amp');
console.log('🚀 Agent connected and ready!');
3. Communicate with Other Agents
Discover and interact with agents in the mesh:
// From another agent or client
import { AMPClient } from '@agentmeshprotocol/sdk';
const client = new AMPClient();
await client.connect('ws://localhost:8080/amp');
// Discover agents with greeting capability
const agents = await client.discoverAgents({
capability: 'greeting'
});
// Invoke the greeting capability
const response = await client.invokeCapability(
'greeting',
{ name: 'AMP Developer' },
{ targetAgent: agents[0].agentId }
);
console.log(response.message);
// "Hello, AMP Developer! Welcome to AMP!"