import type { OpenResponsesClient } from "../clients/openresponses.js"; import { type Model } from "../types.js"; import { type StructuredOutputMode } from "./models.js"; import type { AgentStreamEvent, AgentTool, Hooks, ORInputItem, RetryPolicy, RunOptions } from "./types.js"; interface LoopConfig { name: string; traceName: string; instructions: string; tools: AgentTool[]; model?: Model; outputSchema?: Record; temperature?: number; maxTokens?: number; maxIterations: number; reasoningEffort?: "low" | "medium" | "high"; reasoningSummary?: string; parallelToolExecution: boolean; hooks?: Hooks; /** Explicit trace context — used when ALS propagation isn't reliable (e.g. streaming). */ traceContext?: { spanId: string; traceId: string; }; /** Retry policy for transient LLM call failures. */ retry?: RetryPolicy; /** Behavior when max iterations is reached. */ onMaxIterations?: "throw" | "return_partial"; /** How structured output is delivered when tools are in play. */ structuredOutputMode?: StructuredOutputMode; /** * Optional callback installed by the agent layer to create a platform span * for the synthetic `final_answer` tool call. Receives (callId, argsRaw, * parsedOutput). Never raises — tracing is best-effort. */ recordFinalAnswer?: (callId: string, argumentsRaw: string, output: unknown) => Promise; } /** * Default cap on generated tokens per LLM call when the caller sets none. * Provider defaults (~4096) are a footgun for reasoning models and structured * output: a long reasoning trace can exhaust them before the answer is * emitted, silently truncating the result. 16k is generous headroom while * staying within most models' output limits. Models that cap output lower will * reject it — set `maxTokens` on the agent or per-run options to match such a * model. */ export declare const DEFAULT_MAX_OUTPUT_TOKENS = 16000; /** * Execute the agentic loop (streaming). * * Same logic as runLoop, but uses createStream() and yields AgentStreamEvents. * Text deltas are yielded as they arrive. Tool calls are accumulated from SSE * events and executed after the stream completes for each iteration. */ export declare function streamLoop(client: OpenResponsesClient, config: LoopConfig, input: string | ORInputItem[], options?: RunOptions): AsyncGenerator; export {};