AgentDefinition
AgentDefinition<
ToolProviderContext,Tools,TOutput> =object
Defined in: packages/core/src/agent/types.ts:72
Type Parameters
Section titled “Type Parameters”ToolProviderContext
Section titled “ToolProviderContext”ToolProviderContext = unknown
Tools extends ToolSet = ToolSet
TOutput
Section titled “TOutput”TOutput = string
Properties
Section titled “Properties”id:
string
Defined in: packages/core/src/agent/types.ts:77
maxRetries?
Section titled “maxRetries?”
optionalmaxRetries?:number
Defined in: packages/core/src/agent/types.ts:113
AI SDK streamText maxRetries: retryable errors from the request
itself, before response streaming starts. Overridable per call via
AgentRunInput.maxRetries. Omit to keep the SDK default (2).
0 disables those retries.
memory?
Section titled “memory?”
optionalmemory?:AgentMemoryConfig
Defined in: packages/core/src/agent/types.ts:131
model?
Section titled “model?”
optionalmodel?:LanguageModel
Defined in: packages/core/src/agent/types.ts:80
Required unless AdlRuntimeConfig.defaults.model is set.
outputSchema?
Section titled “outputSchema?”
optionaloutputSchema?:z.ZodType<TOutput>
Defined in: packages/core/src/agent/types.ts:99
Default Zod schema for structured output on every episode.
When set, AgentRunResult.output is inferred from the schema; when omitted,
TOutput is string and output is the episode text.
stopWhen?
Section titled “stopWhen?”
optionalstopWhen?:AgentStopWhen
Defined in: packages/core/src/agent/types.ts:106
AI SDK stopWhen for this agent’s
run / stream. Overridable per call via AgentRunInput.stopWhen.
Defaults to DEFAULT_AGENT_STOP_WHEN (stepCountIs(20)).
Pass stepCountIs(1) when a workflow should own each model step.
streamRetries?
Section titled “streamRetries?”
optionalstreamRetries?:number
Defined in: packages/core/src/agent/types.ts:130
Retry the current model step when the provider stream fails after it started. Overridable per call via AgentRunInput.streamRetries.
Omit to leave this off. 0 disables it. A positive value is forwarded to AI
SDK streamText streamRetries (reruns the step on { type: "error" }
chunks; earlier completed steps stay). A stream that instead rejects with
a retryable HTTP 200 APICallError — a socket close while reading a
successful response — is turned into such a chunk, so one budget covers both.
Text is not buffered: a dropped attempt’s partial text may already be on
textStream / fullStream / agent_text_delta. The SDK excludes it from
the result, structured output, and stored messages, and holds tool calls
until an attempt finishes. Requires a model object; a string model id
fails with INVALID_INPUT. The last failure still rejects the episode.
systemPrompt
Section titled “systemPrompt”systemPrompt:
AgentSystemPrompt
Defined in: packages/core/src/agent/types.ts:78
titleWorkflow?
Section titled “titleWorkflow?”
optionaltitleWorkflow?:Workflow<ConversationTitleInput,ConversationTitleOutput>
Defined in: packages/core/src/agent/types.ts:142
Optional workflow that names the conversation after the first successful episode
on a new memoryScope. It receives the transcript and must return { title: string }.
Pin those types with adl.createWorkflow<ConversationTitleInput, ConversationTitleOutput>
(Zod input / output are optional). Failures are ignored.
The runtime runs this workflow with { isolated: true } so it is a separate
persisted run and is not nested inside another workflow’s tree. Omit it from
adl.config workflows if it should not appear in the inspection UI.
tools?
Section titled “tools?”
optionaltools?:Tools|ToolProvider<Tools,ToolProviderContext>
Defined in: packages/core/src/agent/types.ts:93
A fixed tool set, or a provider resolved once per call — typed directly against
ExtendedToolProviderContext<ToolProviderContext> since a definition (unlike the
per-call AgentRunInput.tools override) is never widened into a heterogeneous
AnyAgent[] registry, so it’s safe to keep ToolProviderContext
fully generic here. Overridable per call via AgentRunInput.tools.
The framework never parses or validates toolProviderContext — a ToolProvider that
wants Zod validation/defaults calls .parse() itself inside getTools (see
createToolProvider’s doc comment for the recipe). Combine several providers, each with
their own context needs, via combineToolProviders.