Skip to content

AgentOptions

Namespace: Vercel.AI

public sealed class AgentOptions

Agent settings.

Inheritance: object

View source

public Instructions? Instructions { get; set; }

System instructions: a string, one SystemModelMessage, or an array of them.

Value: Instructions

View source

public int? MaxOutputTokens { get; set; }

Maximum output tokens.

Value: int?

View source

public ILanguageModel? Model { get; set; }

Explicit model.

Value: ILanguageModel

View source

public string? ModelId { get; set; }

Gateway model id.

Value: string

View source

public Func<StreamAbortContext, CancellationToken, Task>? OnAbort { get; set; }

Called after TimeoutConfiguration) is aborted. See OnAbort.

Value: Func<StreamAbortContext, CancellationToken, Task>

View source

public Func<GenerateTextOptions, GenerateTextOptions?>? PrepareCall { get; set; }

Called before each TimeoutConfiguration) and TimeoutConfiguration) call with the options the agent would use, including the default StopWhen. Return replacement options, or null to keep them. A returned options object that sets StopWhen replaces the default limit. Maps to prepareCall.

Value: Func<GenerateTextOptions, GenerateTextOptions>

View source

public IReadOnlyDictionary<string, Func<JsonElement, CancellationToken, Task<JsonElement>>>? RefineToolInput { get; set; }

Refines the parsed input of tool calls. See RefineToolInput. PrepareCall can replace it.

Value: IReadOnlyDictionary<string, Func<JsonElement, CancellationToken, Task<JsonElement>>>

View source

public ToolCallRepairFunction? RepairToolCall { get; set; }

Repairs a tool call that failed to parse. See RepairToolCall. PrepareCall can replace it.

Value: ToolCallRepairFunction

View source

public StopCondition? StopWhen { get; set; }

Stop condition. Defaults to 10 steps.

Value: StopCondition

View source

public double? Temperature { get; set; }

Temperature.

Value: double?

View source

public TimeoutConfiguration? Timeout { get; set; }

Timeout of each TimeoutConfiguration) and TimeoutConfiguration) call. See Timeout. PrepareCall can replace it. Maps to timeout of ToolLoopAgentSettings.

Value: TimeoutConfiguration

View source

public int? ToolCallConcurrency { get; set; }

Maximum number of tool calls that may execute concurrently within a step. See ToolCallConcurrency. PrepareCall can replace it.

Value: int?

View source

public IReadOnlyList<Tool>? Tools { get; set; }

Tools.

Value: IReadOnlyList<Tool>

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product