1. Install
npm install
cp .env.example .env
npm test
2. Start the server
npm run build
npm start
Default endpoints:
- Agent Card:
http://localhost:4000/.well-known/agent-card.json - JSON-RPC:
http://localhost:4000/a2a/jsonrpc - REST:
http://localhost:4000/a2a/rest - Health:
http://localhost:4000/health
3. Call the agent
curl -s http://localhost:4000/a2a/jsonrpc \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer dev-token' \
-H 'X-Agent-Capability: echo' \
-d '{
"jsonrpc": "2.0",
"id": "1",
"method": "message/send",
"params": {
"message": {
"kind": "message",
"messageId": "msg-1",
"role": "user",
"parts": [{ "kind": "text", "text": "hello secure a2a" }],
"metadata": { "capability": "echo" }
}
}
}'
To hit the integrated secure tool path, change the capability to template-echo.
4. Use as a library
import { createApp, createRuntimeConfig } from "a2awall";
import { createExampleAgent } from "../src/core/example-agent.js";
const runtime = createRuntimeConfig(process.env);
const app = createApp({
baseUrl: runtime.baseUrl,
agent: createExampleAgent(runtime.securityPolicy),
securityPolicy: runtime.securityPolicy
});
app.listen(runtime.port);
5. Publish docs
In GitHub repository settings, set Pages to serve from the docs/ folder on the
default branch.