phaseo-agent 0.1.
Agent definition
Running and continuing
RunOptions fields:
input: Valuecontext: Valuemodel: Option<String>max_steps: Option<usize>
RunOptions::new(input).
ContinueOptions fields:
result: RunResulthuman_input: Option<String>approvals: Vec<ToolDecision>tool_outputs: Vec<ToolOutput>
ContinueOptions::new(result).
Tools
The executor signature is:
Tool exposes id, description, parameters, execute, and require_approval. Prefer its constructors and builder method so executor types and defaults remain consistent.
RuntimeContext passed to an executor contains:
run_idagent_idstep_indexcontexttool_call
Messages and tool calls
Message contains role, content, tool_calls, optional tool_call_id, optional name, and is_error. Create ordinary messages with:
Message::user(content)Message::assistant(content)
ToolCall contains the call id, tool name, and JSON input.
ToolSpec contains the tool id, description, and JSON Schema parameters sent to a model client.
Model clients
ImplementModelClient to use another model transport:
GatewayAgentClient::new(phaseo_client, model)GatewayAgentClient::from_env(model)create_gateway_agent_client(model)
ModelRequest values to POST /responses and normalizes output text, function calls, request metadata, and usage.
ModelRequest contains the agent ID, effective model, instructions, current messages, tool specifications, and application context.
ModelResponse contains:
message: Messageusage: UsageSummaryrequest_id: Option<String>provider: Option<String>model: Option<String>finish_reason: Option<String>
Review and pause types
HumanReviewContext contains the run and agent IDs, step index, current messages, normalized model response, and application context.
Return HumanReviewRequest { reason, payload } from the review callback to pause a run.
HumanPause contains:
reason- JSON
payload kindpending_tool_calls
PendingToolCall contains the original ToolCall, its required input kind, and a human-readable reason.
ToolDecision supplies an approved tool_call_id and optional reason. ToolOutput supplies a tool_call_id and JSON output.
Run records
RunResult contains:
run: RunRecordsteps: Vec<RunStep>output: Valuemessages: Vec<Message>usage: UsageSummary
RunRecord contains the run and agent IDs, effective model and step limit, status, original input, application context, step count, optional pause, optional stop reason, and timestamps.
RunStep contains its index, status, model-attempt count, tool calls, request ID, provider, model, finish reason, optional error, and usage.
UsageSummary contains input_tokens, output_tokens, cached_tokens, total_tokens, and cost.
cost is model-client supplied. The built-in 0.1 Gateway adapter does not currently map Gateway cost_nanos or cost_cents into this field.
RunResult, RunRecord, RunStep, Message, ToolCall, HumanPause, PendingToolCall, ToolDecision, ToolOutput, and UsageSummary support Serde serialization where their definitions derive Serialize and Deserialize.
Events and errors
AgentEvent fields:
event_typerun_idagent_idtimestamp_msdetails
AgentError implements std::error::Error and Display. Use AgentError::new(...) to create one and message() to read its message.