agentic
A function used to create an agentic function.
The task description that guides the underlying agent’s execution. This describes what the function should do.
Optional. An object containing runtime resources that are available during execution.
Resources in scope may be functions, methods, objects, types or any other value.
Optional configuration object for the agentic function execution.
An optional premise for the agentic function. This will be attached to the system prompt of all invocations of this agentic function.
An optional system prompt for the agentic function. This will be the system prompt of all invocations of this agentic function.
Either
- a
string, or - or an instance of
Template.
The model which backs your agent.One of:
'openai:gpt-3.5-turbo''openai:gpt-4o''openai:gpt-4.1''openai:gpt-5''anthropic:claude-sonnet-4''anthropic:claude-opus-4.1''anthropic:claude-sonnet-4.5''anthropic:claude-opus-4.5'
The default model is
openai:gpt-4.1.Either
- the maximum number of output tokens generated in a single round of inference in a single invocation, or
- an instance of
MaxTokensfor more fine-grained control.
MaxTokens for information on default values.A callback to obtain the token usage of an agentic function for the last invocation.
A callback for streaming model generation.
Each streamed text chunk for each agentic function call, determined by a unique invocation ID, will route to this callback.
Returns a promise that resolves to the result of specified or inferred return type
T.