Integrations
Hermes
Integrate Treeship with Hermes A2A agents for verified multi-agent task receipts.
Hermes communicates via HTTP and the A2A (Agent-to-Agent) protocol. The @treeship/a2a middleware wraps every task received, completed, and handed off.
Integration pattern
Hermes uses the task boundary pattern: @treeship/a2a middleware intercepts A2A task lifecycle events and emits session events so they appear in the receipt timeline.
Setup
Install dependencies
npm install @treeship/a2a
curl -fsSL treeship.dev/install | sh
treeship initAdd middleware to Hermes server
import { TreeshipA2AMiddleware } from '@treeship/a2a';
const treeship = new TreeshipA2AMiddleware({
actor: 'agent://hermes',
defaultModel: 'hermes-2',
});
// Wrap your A2A task handler
app.post('/a2a/task', async (req, res) => {
await treeship.onTaskReceived(req.body);
// ... your task handling logic ...
await treeship.onTaskCompleted(req.body, result);
res.json(result);
});
// For handoffs to other agents
await treeship.onHandoff({
from: 'agent://hermes',
to: 'agent://claude-code',
taskId: task.id,
});Set environment variables
export TREESHIP_MODEL=hermes-2
export TREESHIP_TOKENS_IN=6200
export TREESHIP_TOKENS_OUT=400
export TREESHIP_COST_USD=0.10What appears in the receipt
| Section | Content | Capture method |
|---|---|---|
| Agent identity | "hermes", model, host | Middleware config [AUTO] |
| A2A task events | Task received, completed, failed | Middleware lifecycle [AUTO] |
| Handoffs | From/to agent with task ID | onHandoff() call [EXPLICIT] |
| Cost | Model, tokens, cost | Env vars [EXPLICIT] |
| Artifacts | Signed intent + receipt per task | @treeship/a2a [AUTO] |
Multi-agent sessions
When Hermes works alongside Claude Code and other agents, the receipt shows the full coordination graph:
- Each agent appears as a separate node in the agent graph
- Handoff edges show task delegation between agents
- The timeline shows interleaved events from all agents
- Cost rolls up per agent in the agents table
Integration status: @treeship/a2a is published and tested with unit tests. Full end-to-end testing with a live Hermes server is pending. If you test it, please report results at github.com/zerkerlabs/treeship/issues.
What is NOT captured
- Internal Hermes reasoning: only task lifecycle events at the A2A boundary
- Sub-tool calls within Hermes: use
treeship session event --type agent.called_toolfor granular tool tracking - Network connections: not auto-captured by the A2A middleware