Skip to content

Interface: AgentOptions

@providerprotocol/agents


@providerprotocol/agents / index / AgentOptions

Defined in: src/agent/types.ts:47

Configuration options for creating an agent instance.

Extends LLMOptions from @providerprotocol/ai for full UPP (Unified Provider Protocol) passthrough, allowing all provider-specific parameters to be configured.

The agent options combine UAP-specific configuration (execution strategy, middleware, checkpointing) with UPP LLM configuration (model, params, tools, system prompt). This enables agents to leverage the full power of the underlying LLM while adding agentic capabilities like state management and middleware pipelines.

import { agent } from '@providerprotocol/agents';
import { anthropic } from '@providerprotocol/ai/anthropic';
import { loop } from '@providerprotocol/agents/execution';
const options: AgentOptions = {
model: anthropic('claude-sonnet-4-20250514'),
params: { max_tokens: 4096 },
tools: [myTool],
system: 'You are a helpful assistant.',
execution: loop({ maxIterations: 10 }),
middleware: [loggingMiddleware],
};
  • Partial<Omit<LLMOptions, "model">>

optional _llmInstance: LLMInstance<unknown>

Defined in: src/agent/types.ts:123

Internal

Pre-created LLM instance for dependency injection.

Used primarily for testing to inject mock LLM instances. Not intended for production use.


optional checkpoints: CheckpointStore

Defined in: src/agent/types.ts:104

Checkpoint store for step-level state persistence.

When provided, the agent will persist state checkpoints after each execution step, enabling recovery and replay capabilities.

CheckpointStore


optional config: ProviderConfig

Defined in: node_modules/@providerprotocol/ai/dist/index.d.ts:580

Provider infrastructure configuration (optional - uses env vars if omitted)

Partial.config


optional execution: ExecutionStrategy

Defined in: src/agent/types.ts:72

Execution strategy that controls how the agent processes requests.

The execution strategy determines the control flow of agent execution, including how tool calls are handled and when to stop iterating.

loop() - Standard agentic loop with tool execution


optional middleware: Middleware[]

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

Ordered middleware pipeline for request/response processing.

Middleware functions are executed in order for before hooks and in reverse order for after hooks. This enables cross-cutting concerns like logging, context management, and error handling.

Middleware


model: ModelReference

Defined in: src/agent/types.ts:61

Model reference from a UPP provider factory.

Must be created using a provider factory function like anthropic(), openai(), google(), etc. from @providerprotocol/ai.

import { anthropic } from '@providerprotocol/ai/anthropic';
model: anthropic('claude-sonnet-4-20250514')

optional params: unknown

Defined in: node_modules/@providerprotocol/ai/dist/index.d.ts:582

Model-specific parameters (temperature, max_tokens, etc.)

Partial.params


optional sessionId: string

Defined in: src/agent/types.ts:113

Session identifier for checkpointing.

Per UAP-1.0 Section 3.4, session IDs must be UUIDv4. If not provided and checkpoints are enabled, a UUIDv4 will be auto-generated.


optional strategy: AgentStrategy

Defined in: src/agent/types.ts:93

Agent lifecycle hooks for customizing execution behavior.

Strategy hooks provide fine-grained control over the execution loop, including iteration limits and custom termination conditions.


optional structure: JSONSchema

Defined in: node_modules/@providerprotocol/ai/dist/index.d.ts:590

Structured output schema (JSON Schema)

Partial.structure


optional system: string

Defined in: node_modules/@providerprotocol/ai/dist/index.d.ts:584

System prompt for all inferences

Partial.system


optional tools: Tool<unknown, unknown>[]

Defined in: node_modules/@providerprotocol/ai/dist/index.d.ts:586

Tools available to the model

Partial.tools


optional toolStrategy: ToolUseStrategy

Defined in: node_modules/@providerprotocol/ai/dist/index.d.ts:588

Tool execution strategy

Partial.toolStrategy