Skip to content

AgentDefinition

AgentDefinition<ToolProviderContext, Tools, TOutput> = object

Defined in: packages/core/src/agent/types.ts:57

ToolProviderContext = unknown

Tools extends ToolSet = ToolSet

TOutput = string

id: string

Defined in: packages/core/src/agent/types.ts:62


optional memory?: AgentMemoryConfig

Defined in: packages/core/src/agent/types.ts:92


optional model?: LanguageModel

Defined in: packages/core/src/agent/types.ts:65

Required unless AdlRuntimeConfig.defaults.model is set.


optional outputSchema?: z.ZodType<TOutput>

Defined in: packages/core/src/agent/types.ts:84

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.


optional stopWhen?: AgentStopWhen

Defined in: packages/core/src/agent/types.ts:91

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.


systemPrompt: AgentSystemPrompt

Defined in: packages/core/src/agent/types.ts:63


optional titleWorkflow?: Workflow<ConversationTitleInput, ConversationTitleOutput>

Defined in: packages/core/src/agent/types.ts:103

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.


optional tools?: Tools | ToolProvider<Tools, ToolProviderContext>

Defined in: packages/core/src/agent/types.ts:78

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.