agent.*
Agent execution and control RPC methods
Agent methods control Aleph's core AI execution loop (the Think→Act harness). agent.* is the direct entry used by panels and external integrations; chat-oriented clients normally use the chat.* family — both share the same execution adapter underneath.
Methods
| Method | Description |
|---|---|
agent.run | Start a run (asynchronous; returns run_id immediately) |
agent.status | Poll a run's state by run_id |
agent.cancel | Cancel an in-flight run |
agent.list | List agents registered in the router |
Historical aliases such as
agent.history/agent.clear/agent.respondToInput/agent.eventsare not RPCs. Usechat.history/chat.clearfor session reads andevents.*for streaming.
agent.run
Start an agent run. The handler returns immediately with a run_id; the actual response is delivered as streaming events on the stream.* and agent.* topics.
Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "agent.run",
"params": {
"input": "Summarize today's news",
"session_key": "agent:main:main",
"thinking": "medium"
}
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"run_id": "run-uuid-123",
"session_key": "agent:main:main",
"accepted_at": "2026-03-15T10:00:00Z"
}
}Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | Yes | User input; must be non-empty |
session_key | string | No | Session key; auto-derived if omitted |
channel | string | No | Channel identifier (e.g. "cli:term1") |
peer_id | string | No | Per-peer session isolation key |
stream | boolean | No | Whether to emit streaming events (default true) |
thinking | string | No | Reasoning depth: off / minimal / low / medium / high / xhigh (default minimal) |
attachments | object[] | No | File attachments (name / mime_type / base64 data) |
agent_id | string | No | Explicit target agent, bypasses channel binding |
project_root | string | No | Project root, overrides the default workspace |
model_override | object | No | Per-turn model override (see model_override) |
exec_tier | string | No | Execution tier chosen in the composer (first-turn only) |
mode | string | No | Session mode: chat / work / code |
voice_input | boolean | No | Mark the turn as ASR-transcribed speech |
Response fields:
| Field | Description |
|---|---|
run_id | Unique run identifier; pair with agent.status / agent.cancel |
session_key | Resolved session key |
accepted_at | RFC3339 UTC timestamp |
agent.status
Look up the current state of a run by run_id.
Request:
{
"jsonrpc": "2.0",
"id": 2,
"method": "agent.status",
"params": { "run_id": "run-uuid-123" }
}Response:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"run_id": "run-uuid-123",
"session_key": "agent:main:main",
"status": "running",
"elapsed_ms": 1247
}
}status is one of running / completed / failed / cancelled. An unknown run_id returns -32602 Invalid params.
agent.cancel
Cancel an in-flight run. The cancel token is forwarded to the execution adapter; the run stops at the next safe checkpoint and releases its resources.
Request:
{
"jsonrpc": "2.0",
"id": 3,
"method": "agent.cancel",
"params": { "run_id": "run-uuid-123" }
}Response:
{ "jsonrpc": "2.0", "id": 3, "result": { "run_id": "run-uuid-123", "cancelled": true } }cancelled indicates the cancel request was accepted; the transitional state until the run truly stops is visible via agent.status.
agent.list
List every agent registered in the AgentRouter plus the current default.
Request:
{ "jsonrpc": "2.0", "id": 4, "method": "agent.list" }Response:
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"agents": [
{ "id": "main", "name": "Main", "enabled": true, "is_default": true }
],
"default": "main"
}
}Each entry exposes id / name / enabled / is_default, exactly as returned by AgentRouter::list_agents().
Streaming Events
After agent.run is accepted, the event bus delivers run lifecycle changes as WebSocket notifications (topic names come from GatewayEventFrame::topic_name()):
| Topic | Description |
|---|---|
run.accepted | Run queued and started |
agent.reasoning | Reasoning-phase output |
agent.reasoning.block | Reasoning block (dual-process cognition) |
agent.tool.start | Tool call begins |
agent.tool.update | Tool progress update |
agent.tool.end | Tool call ends |
agent.trace | Execution-trace event |
agent.response.chunk | Response text chunk |
agent.context.gauge | Context-window utilisation |
agent.run.complete | Run completed successfully |
agent.run.error | Run failed |
agent.run.retrying | Failure-driven retry |
agent.ask.user | ask_user clarification request |
agent.clarification.ended | Clarification round resolved |
agent.uncertainty | Model uncertainty signal |
agent.model.resolved | Model selection resolved |
Non-streaming events share the same bus:
| Topic | Description |
|---|---|
session.updated / session.lifecycle.changed | Session changes |
running.set.changed | Active-run set changes |
channel.message / channel.typing / channel.status / channel.error | Channel events |
config.changed | Configuration change |
approval.requested / approval.resolved / approval.expired | Approval requests |
cron.job.changed / heartbeat.task.changed | Scheduler task changes |
team.changed | Team changes |
acp.sessions.changed | ACP session changes |
gateway.token.rotated / gateway.device.revoked | Gateway credential events |
surface.notify / surface.approval | Surface notifications |
runtimes.install.progress | Runtime installation progress |
Session Key Formats
The session_key parameter determines context isolation. See the Protocol page for WebSocket transport details.
| Format | Example | Description |
|---|---|---|
| Main | agent:main:main | Shared cross-channel session |
| DM | agent:main:telegram:dm:user123 | Per-user direct message |
| Group | agent:main:discord:group:guild-id | Group/channel chat |
| Task | agent:main:cron:daily-summary | Cron or webhook task |
| Ephemeral | agent:main:ephemeral:uuid | Temporary, non-persistent |
Thinking Levels
thinking controls how much reasoning the agent performs before responding.
| Level | Use Case |
|---|---|
off | Fast, direct answers |
minimal | Simple queries (default) |
low | Standard conversation |
medium | Complex tasks |
high | Multi-step reasoning |
xhigh | Deep analysis |
See Also
- Methods Reference -- All method namespaces
- events.* -- Subscribe to agent events
- chat.* -- Chat interface (
chat.send/chat.abort/ ...) - session.* -- Session management