Comma Agents
@comma-agents/daemonProtocol

User Input

Human-in-the-loop — the request_input / user_input message pair.

When a strategy contains a user agent with requireInput: true, the daemon pauses execution and asks the client for input. The client responds with the user's text, and execution resumes.

Event: request_input

Sent by the daemon when a user agent is waiting for human input. Broadcast to all subscribers of the run.

{
  "type": "request_input",
  "runId": "run_abc123",
  "agentName": "user",
  "prompt": "What would you like me to write about?",
  "ts": "2025-01-15T10:30:01.000Z"
}
FieldTypeDescription
type"request_input"Message type discriminator
runIdstringThe run that needs input
agentNamestringThe agent waiting for input
promptstring?Optional prompt to display to the user
requestIdstring?Echoed from the originating start_run
tsstringISO-8601 timestamp

Request: user_input

Sent by the client to provide the requested text. The runId and agentName must match the pending request_input.

{
  "type": "user_input",
  "runId": "run_abc123",
  "agentName": "user",
  "text": "Write a tutorial on TypeScript generics",
  "requestId": "input-1"
}
FieldTypeRequiredDescription
type"user_input"yesMessage type discriminator
runIdstringyesThe run this input is for
agentNamestringyesThe agent that requested input
textstringyesThe user's text response
requestIdstringnoEchoed on any error response

On success, there is no direct response — execution resumes and the next events (e.g., step_completed, agent_output) follow.

If no agent is waiting for input on the specified run, the daemon replies with an error:

{
  "type": "error",
  "code": "NO_PENDING_INPUT",
  "message": "No pending input request for run run_abc123 agent user",
  "ts": "2025-01-15T10:30:02.000Z"
}

Sequence Diagram

Client                          Daemon
  |                               |
  |  prepare_run -> start_run       |
  |  user agent)                  |
  |------------------------------>|
  |                               |
  |       strategy_started        |
  |<------------------------------|
  |                               |
  |         request_input         |
  |  (agentName: "user",          |
  |   prompt: "Enter topic...")   |
  |<------------------------------|
  |                               |
  |  user_input                   |
  |  (text: "TypeScript generics")|
  |------------------------------>|
  |                               |
  |     step_completed, ...       |
  |<------------------------------|
  |                               |
  |     strategy_completed        |
  |<------------------------------|

On this page