Skip to main content

Types, Error Signals

The core runtime uses a consistent JSON schema for AgentResult, StreamEvent, ChatMessage, ToolCall, ModelResponse, approval interruptions, and budget errors across all six SDKs. Host SDKs wrap these contracts in native structs, records, interfaces, and exceptions.

import asyncio
from ish import Agent, ApprovalRequired, BudgetExceededError


async def run_checked(agent: Agent, prompt: str) -> None:
try:
result = await agent.run(prompt)
print(result.content, result.total_tokens)
except ApprovalRequired as signal:
print(f"Approval required: {signal.tool_name} ({signal.snapshot_id})")
except BudgetExceededError as err:
print(f"Budget exceeded ({err.metric}): {err.current_value} > {err.limit}")

Results, approvals, runtime errors​

Catch approval interrupts (ApprovalRequired / ApprovalRequiredError / ApprovalRequiredException) and runtime or policy errors cleanly across SDKs:


Core shared fields​

TypeKey fields shared across SDKs
AgentResulttrace_id, content, history, tool_calls_count, duration_ms, total_tokens, prompt_tokens, completion_tokens, total_cost_usd, model_usages
StreamEventevent_type (token, tool_call, observation, done), data, optional trace_id, sequence
ChatMessagerole (user, assistant, system, tool), content, tool_calls, tool_call_id, name
ToolCallid, name, arguments
ModelResponsecontent, tool_calls, prompt_tokens, completion_tokens, total_tokens, provider, model

Error signal catalog​

ConditionPython / TypeScriptRust / GoC# / Java
Human approval interruptApprovalRequired / ApprovalRequiredErrorErr(...) / *ish.IshErrorApprovalRequiredException
Workflow step approvalApprovalRequired / WorkflowStepApprovalRequiredErrorWorkflowStepOutcome::PendingApproval / *ish.IshErrorWorkflowStepApprovalRequiredException
Environment drift on resumeValueError / ApprovalEnvironmentDriftErrorErr(...) / *ish.IshErrorApprovalEnvironmentDriftException
Policy deniedDataPlanePolicyViolationErrorErr(...) / *ish.DataPlanePolicyErrorDataPlanePolicyViolationException
Budget or ABI failureBudgetExceededError / ErrorErr(...) / *ish.IshErrorIshException