Interface AgentCallRecord

A complete record of a single agent invocation within an agency run. Appended to GenerateTextResult.agentCalls and surfaced in ApprovalRequest.context.

interface AgentCallRecord {
    agent: string;
    input: string;
    output: string;
    toolCalls: {
        name: string;
        args: unknown;
        result?: unknown;
        error?: string;
    }[];
    guardrailResults?: {
        id: string;
        passed: boolean;
        action: string;
    }[];
    usage: {
        promptTokens: number;
        completionTokens: number;
        totalTokens: number;
        costUSD?: number;
    };
    durationMs: number;
    emergent?: boolean;
}

Properties

agent: string

Name of the agent that was invoked.

input: string

Input prompt or message sent to the agent.

output: string

Final text output produced by the agent.

toolCalls: {
    name: string;
    args: unknown;
    result?: unknown;
    error?: string;
}[]

Ordered list of tool invocations made during this call.

Type declaration

  • name: string

    Tool name.

  • args: unknown

    Arguments supplied by the model.

  • Optional result?: unknown

    Return value from the tool (present on success).

  • Optional error?: string

    Error message if the tool failed.

guardrailResults?: {
    id: string;
    passed: boolean;
    action: string;
}[]

Guardrail evaluation results for this agent call.

Type declaration

  • id: string

    Guardrail identifier.

  • passed: boolean

    Whether the guardrail check passed.

  • action: string

    Action taken by the guardrail (e.g. "allow", "block", "redact").

usage: {
    promptTokens: number;
    completionTokens: number;
    totalTokens: number;
    costUSD?: number;
}

Token usage for this individual agent call.

Type declaration

  • promptTokens: number
  • completionTokens: number
  • totalTokens: number
  • Optional costUSD?: number

    Cost in USD for this call, when available.

durationMs: number

Wall-clock milliseconds for this agent call.

emergent?: boolean

Whether this agent was synthesised at runtime by the emergent subsystem.