Treeship
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 init

Add 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.10

What appears in the receipt

SectionContentCapture method
Agent identity"hermes", model, hostMiddleware config [AUTO]
A2A task eventsTask received, completed, failedMiddleware lifecycle [AUTO]
HandoffsFrom/to agent with task IDonHandoff() call [EXPLICIT]
CostModel, tokens, costEnv vars [EXPLICIT]
ArtifactsSigned 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_tool for granular tool tracking
  • Network connections: not auto-captured by the A2A middleware