AgentConfig
Constructor
Instance methods
agent.generate(options)
generateText parameters (prompt or messages) with:
system?: string– overrides the default instructions.structuredOutput?: Output.Output<OUTPUT, PARTIAL>– schema-based generation (Zod).runtime?: RuntimeStore<STATE>– shared runtime (seeRuntimeStore).telemetry?: AgentTelemetryOverrides– mergesfunctionId,metadata,recordInputs,recordOutputs.loopTools?: boolean/maxStepTools?: number– per-call overrides for the tool loop.
GenerateTextResult enriched with loopTool?: boolean.
agent.stream(options)
textStream,fullStream,text,response,usage,steps.experimental_partialOutputStreamwhenstructuredOutputis provided.toAIStreamResponse()/toDataStreamResponse()to integrate with HTTP streaming responses.
agent.withTelemetry(enabled?: boolean)
Enable or disable telemetry by mutating the instance. Returns this for chaining.
Utility types
AgentTools– union between AI SDKToolSetand provider dictionaries.AgentGenerateResult<T>– alias ofGenerateTextResult+loopTool.AgentStreamResult<T>– alias ofStreamTextResult+loopTool.AgentTelemetryOverrides–functionId,metadata,recordInputs?,recordOutputs?.
Runtime handling
Whenruntime is provided:
- a
RuntimeStoresnapshot is created for the call duration; onCleanuphandlers run at the end (success, error, or cancellation);RuntimeStore.mergeExperimentalContextmerges manually passedexperimental_contextwith the runtime state.