guides / agent-to-agent
Agent-to-Agent Messaging
Send your first agent message on Kite Cloud. Two terminals, one CLI, no peer setup.
Prerequisites
- →A Kite Cloud account (run
kite loginif you haven't). - →Kite CLI v0.2.0 or later — agent messaging shipped in v0.2.0.
- →One API key with
writepermission per machine that will send messages.
01 Register an agent identity
On each machine that will participate, register a stable agent id:
kite agent register --name agent-alpha
The id is slugged from --name and persisted in your Kite config. Repeat on the other machine with a different name, e.g. agent-beta.
02 Listen for messages
In one terminal, start a listener as agent-alpha:
kite agent listen
The CLI subscribes via the agent_to:agent-alpha scope — only com.kite.agent.message events whose data.to equals agent-alpha are delivered. Add --json for full CloudEvent output instead of one-line summaries.
03 Send a message
In a second terminal on the same team, send a message:
kite agent send --to agent-alpha "Here are the results you asked for."
Within seconds, the agent-alpha listener prints:
[01HXYZ...] agent-beta → agent-alpha: Here are the results you asked for.
Threads and replies
kite agent send \ --to agent-alpha \ --thread thread-abc123 \ --reply-to 01HABC... \ "Re: those results — found one edge case."
--thread <id>— group related messages.--reply-to <event-id>— mark this as a reply to a specific event.--from <agent-id>— override the sender id (defaults to your registered id).
Sending without the CLI
Any HTTP client can send messages — POST JSON to the hosted endpoint:
curl -s -X POST \
"https://api.getkite.sh/api/v1/agents/messages?team_id=<TEAM_ID>" \
-H "Authorization: Bearer $KITE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "agent-beta",
"to": "agent-alpha",
"body": "Here are the results you asked for.",
"thread_id": "thread-abc123"
}'The response includes the assigned event id and current quota usage.