Skip to main content

Module agents

Module agents 

Source
Expand description

Per-agent runner trait, error types, and agent registry.

Each agent (Claude, Codex, OpenCode, Grok) has a different CLI invocation, output format, and error pattern. This module defines a common trait so the runner can delegate parsing and error classification to the correct implementation.

Modules§

claude
Claude-compatible agent runner.
codex
Codex agent runner.
grok
Grok agent runner.
kimi
Kimi agent runner — extends the Claude-compatible runner.
minimax
MiniMax agent runner — extends the Claude-compatible runner.
opencode
OpenCode agent runner.

Structs§

AgentResult
Structured result from per-agent NDJSON extraction.
ParsedResponse
Parsed response from an agent, including metadata extracted from the agent-specific output envelope.
PermissionRules
Unified permission rules that each agent translates into its native flags.

Enums§

AgentError
Agent-specific error with enough detail for autonomous recovery.
RouterTranscript
Router stdout shape. Each runner reports its own
SandboxLevel
Sandbox level — how much filesystem access the agent gets.
StreamEvent
One step of an agent’s work, as orch stream shows it

Traits§

AgentRunner
Per-agent runner trait.

Functions§

collect_assistant_messages_text
Concatenate text from all assistant-turn messages in the agent’s NDJSON output stream. Used as an intermediate fallback when the type:result envelope text is not valid AgentResponse JSON but an earlier assistant message in the conversation might contain it.
error_class_name
Return the variant name of an AgentError as a static string, for structured logging and result.json output.
find_agent_result
Dispatch to the appropriate per-agent result extractor.
get_runner
Get the appropriate AgentRunner implementation for an agent name.
supports_session
Agents whose CLI takes --session-id for a new session and --resume to continue it
synthesize_response_from_text
Build a synthetic agent response from plain text when structured parsing fails.
truncate_at_char_boundary
Find the largest byte index <= max_bytes that lies on a UTF-8 char boundary. Used for safe string truncation in error messages.