Types
All TypeScript types exported by the SDK.
TaskResult
Returned by LocalEngine.execute() (TypeScript) and client.run_sync() (Python).
interface TaskResult {
status: TaskStatus;
output: string;
steps: Step[];
total_tokens: number;
total_cost_usd: number;
duration_ms: number;
}
type TaskStatus = "pending" | "running" | "completed" | "failed" | "cancelled";Step
A single execution step within a run.
interface Step {
index: number;
action: StepAction;
result?: unknown;
tokens_used: number;
cost_usd: number;
duration_ms: number;
}
type StepAction =
| { type: "tool_call"; tool: string; input: Record<string, unknown>; tool_use_id: string }
| { type: "response"; content: string }
| { type: "error"; message: string };ToolDefinition
Defines a tool that agents can use.
interface ToolDefinition<TInput = unknown, TOutput = unknown> {
name: string;
description: string;
parameters: Record<string, unknown>; // JSON Schema
execute: (input: TInput, ctx: ExecutionContext) => Promise<TOutput>;
}ExecutionContext
Passed to tool execute functions.
interface ExecutionContext {
agent_name: string;
task_id: string;
step_index: number;
mode: ExecutionMode;
signal: AbortSignal;
}
type ExecutionMode = "local" | "cloud";AgentConfig
Configuration for creating an Agent.
interface AgentConfig {
name: string;
description?: string;
model: string;
instructions: string | (() => string);
max_steps: number;
budget_usd?: number;
tools: ToolDefinition[];
}AgentDefinition
Serialized agent definition (output of agent.toDefinition()).
interface AgentDefinition {
name: string;
description?: string;
model: string;
instructions: string;
max_steps: number;
budget_usd?: number;
tools: { name: string; description: string; parameters: Record<string, unknown> }[];
}AgentMetadata
Returned by agent.deploy().
interface AgentMetadata {
id: string;
version: string;
created_at: string;
deployed_at?: string;
}RunStatusResponse
Cloud run status (from agent.status()).
type RunStatus =
| "queued"
| "running"
| "paused"
| "completed"
| "failed"
| "cancelled"
| "budget_exceeded";CloudConfig
Configuration for cloud operations.
interface CloudConfig {
api_key: string;
base_url: string; // default: "https://api.getpapayya.com"
}LogEntry
A single log line from agent.logs().
interface LogEntry {
timestamp: string;
level: string;
message: string;
}