import { Agent } from './agent'; import { AgentOutputSchema } from './agent-outputs'; import { AsyncComputer, Computer } from './computer'; import { InputGuardrail, InputGuardrailResult, OutputGuardrail, OutputGuardrailResult } from './guardrails'; import { Handoff } from './handoffs'; import { ModelResponse, RunItem, TResponseInputItem } from './items'; import { RunHooks } from './lifecycle'; import { ModelSettings } from './models/model-settings'; import { ModelTracing } from './models/interface'; import { RunConfig } from './run'; import { RunContextWrapper } from './run-context'; import { ToolsToFinalOutputResult } from './stream-events'; import { ComputerTool, FunctionTool, FunctionToolResult, Tool } from './tools'; import { ResponseComputerToolCall, ResponseFunctionToolCall } from 'openai/resources/responses/responses'; export declare class QueueCompleteSentinel { } export declare const QUEUE_COMPLETE_SENTINEL: QueueCompleteSentinel; /** * Represents a handoff tool run */ export declare class ToolRunHandoff { handoff: Handoff; toolCall: ResponseFunctionToolCall; constructor(handoff: Handoff, toolCall: ResponseFunctionToolCall); } /** * Represents a function tool run */ export declare class ToolRunFunction { toolCall: ResponseFunctionToolCall; functionTool: FunctionTool; constructor(toolCall: ResponseFunctionToolCall, functionTool: FunctionTool); } /** * Represents a computer action tool run */ export declare class ToolRunComputerAction { toolCall: ResponseComputerToolCall; computerTool: ComputerTool; constructor(toolCall: ResponseComputerToolCall, computerTool: ComputerTool); } /** * Result of processing a model response */ export declare class ProcessedResponse { newItems: RunItem[]; handoffs: ToolRunHandoff[]; functions: ToolRunFunction[]; computerActions: ToolRunComputerAction[]; toolsUsed: string[]; constructor(newItems: RunItem[], handoffs: ToolRunHandoff[], functions: ToolRunFunction[], computerActions: ToolRunComputerAction[], toolsUsed: string[]); /** * Check if there are tools that need to be run */ hasToolsToRun(): boolean; } /** * Represents a handoff to a new agent */ export declare class NextStepHandoff { newAgent: Agent; constructor(newAgent: Agent); } /** * Represents a final output */ export declare class NextStepFinalOutput { output: any; constructor(output: any); } /** * Represents running the agent again */ export declare class NextStepRunAgain { } /** * Result of a single step in the agent run */ export declare class SingleStepResult { /** * The input items i.e. the items before run() was called. May be mutated by handoff input filters. */ originalInput: string | TResponseInputItem[]; /** * The model response for the current step. */ modelResponse: ModelResponse; /** * Items generated before the current step. */ preStepItems: RunItem[]; /** * Items generated during this current step. */ newStepItems: RunItem[]; /** * The next step to take. */ nextStep: NextStepHandoff | NextStepFinalOutput | NextStepRunAgain; constructor( /** * The input items i.e. the items before run() was called. May be mutated by handoff input filters. */ originalInput: string | TResponseInputItem[], /** * The model response for the current step. */ modelResponse: ModelResponse, /** * Items generated before the current step. */ preStepItems: RunItem[], /** * Items generated during this current step. */ newStepItems: RunItem[], /** * The next step to take. */ nextStep: NextStepHandoff | NextStepFinalOutput | NextStepRunAgain); /** * Items generated during the agent run (i.e. everything generated after `originalInput`). */ get generatedItems(): RunItem[]; } /** * Get the model tracing implementation based on configuration */ export declare function getModelTracingImpl(tracingDisabled: boolean, traceIncludeSensitiveData: boolean): ModelTracing; /** * Tracks tool usage by agents */ export declare class AgentToolUseTracker { agentToTools: Array<[Agent, string[]]>; /** * Add tool usage for an agent */ addToolUse(agent: Agent, toolNames: string[]): void; /** * Check if an agent has used any tools */ hasUsedTools(agent: Agent): boolean; } /** * Implementation of the agent run logic */ export declare class RunImpl { /** * Execute tools and side effects for a single step */ static executeToolsAndSideEffects({ agent, allTools, originalInput, preStepItems, newResponse, processedResponse, outputSchema, hooks, contextWrapper, runConfig, toolUseTracker, }: { agent: Agent; allTools: Tool[]; originalInput: string | TResponseInputItem[]; preStepItems: RunItem[]; newResponse: ModelResponse; processedResponse: ProcessedResponse; outputSchema: AgentOutputSchema | null; hooks: RunHooks; contextWrapper: RunContextWrapper; runConfig: RunConfig; toolUseTracker: AgentToolUseTracker; }): Promise; /** * Maybe reset tool choice based on agent configuration and tool usage */ static maybeResetToolChoice(agent: Agent, toolUseTracker: AgentToolUseTracker, modelSettings: ModelSettings): ModelSettings; /** * Process a model response into items, handoffs, functions, and computer actions */ static processModelResponse({ agent, allTools, response, outputSchema, handoffs, }: { agent: Agent; allTools: Tool[]; response: ModelResponse; outputSchema: AgentOutputSchema | null; handoffs: Handoff[]; }): ProcessedResponse; /** * Execute function tool calls */ static executeFunctionToolCalls({ agent, toolRuns, hooks, contextWrapper, config, }: { agent: Agent; toolRuns: ToolRunFunction[]; hooks: RunHooks; contextWrapper: RunContextWrapper; config: RunConfig; }): Promise; /** * Execute computer actions */ static executeComputerActions({ agent, actions, hooks, contextWrapper, config, }: { agent: Agent; actions: ToolRunComputerAction[]; hooks: RunHooks; contextWrapper: RunContextWrapper; config: RunConfig; }): Promise; /** * Execute handoffs */ static executeHandoffs({ agent, originalInput, preStepItems, newStepItems, newResponse, runHandoffs, hooks, contextWrapper, runConfig, }: { agent: Agent; originalInput: string | TResponseInputItem[]; preStepItems: RunItem[]; newStepItems: RunItem[]; newResponse: ModelResponse; runHandoffs: ToolRunHandoff[]; hooks: RunHooks; contextWrapper: RunContextWrapper; runConfig: RunConfig; }): Promise; /** * Execute final output */ static executeFinalOutput({ agent, originalInput, newResponse, preStepItems, newStepItems, finalOutput, hooks, contextWrapper, }: { agent: Agent; originalInput: string | TResponseInputItem[]; newResponse: ModelResponse; preStepItems: RunItem[]; newStepItems: RunItem[]; finalOutput: any; hooks: RunHooks; contextWrapper: RunContextWrapper; }): Promise; /** * Run final output hooks */ static runFinalOutputHooks(agent: Agent, hooks: RunHooks, contextWrapper: RunContextWrapper, finalOutput: any): Promise; /** * Run a single input guardrail */ static runSingleInputGuardrail(agent: Agent, guardrail: InputGuardrail, input: string | TResponseInputItem[], context: RunContextWrapper): Promise; /** * Run a single output guardrail */ static runSingleOutputGuardrail(guardrail: OutputGuardrail, agent: Agent, agentOutput: any, context: RunContextWrapper): Promise; /** * Stream step result to queue */ static streamStepResultToQueue(stepResult: SingleStepResult, queue: any): void; /** * Check for final output from tools */ static checkForFinalOutputFromTools({ agent, toolResults, contextWrapper, config, }: { agent: Agent; toolResults: FunctionToolResult[]; contextWrapper: RunContextWrapper; config: RunConfig; }): Promise; private static isResponseOutputMessage; private static isResponseFileSearchToolCall; private static isResponseFunctionWebSearch; private static isResponseReasoningItem; private static isResponseComputerToolCall; private static isResponseFunctionToolCall; } /** * Creates a trace only if there is no current trace, and manages the trace lifecycle. */ export declare class TraceCtxManager { private workflowName; private traceId; private groupId; private metadata; private disabled; private trace; constructor(workflowName: string, traceId: string | null, groupId: string | null, metadata: Record | null, disabled: boolean); enter(): TraceCtxManager; exit(): void; } /** * Helper class for computer actions */ export declare class ComputerAction { /** * Execute a computer action */ static execute({ agent, action, hooks, contextWrapper, config, }: { agent: Agent; action: ToolRunComputerAction; hooks: RunHooks; contextWrapper: RunContextWrapper; config: RunConfig; }): Promise; /** * Get screenshot from sync computer */ static getScreenshotSync(computer: Computer, toolCall: ResponseComputerToolCall): Promise; /** * Get screenshot from async computer */ static getScreenshotAsync(computer: AsyncComputer, toolCall: ResponseComputerToolCall): Promise; private static isActionClick; private static isActionDoubleClick; private static isActionDrag; private static isActionKeypress; private static isActionMove; private static isActionScreenshot; private static isActionScroll; private static isActionType; private static isActionWait; }