Interface: AgentOptions
Defined in: packages/agentos/src/api/agent.ts:112
Configuration options for the agent factory function.
Extends BaseAgentConfig with backward-compatible convenience fields.
All BaseAgentConfig fields (rag, discovery, permissions, emergent, voice,
etc.) are accepted and stored in config but are not actively wired in the
lightweight agent — they will be consumed by agency() and the full runtime.
Extends
BaseAgentConfig
Extended by
Properties
apiKey?
optionalapiKey:string
Defined in: packages/agentos/src/api/types.ts:1261
Override the provider API key instead of reading from environment variables.
Inherited from
BaseAgentConfig.apiKey
avatar?
optionalavatar:AvatarConfig
Defined in: packages/agentos/src/api/types.ts:1400
Avatar visual presentation configuration.
Inherited from
BaseAgentConfig.avatar
baseUrl?
optionalbaseUrl:string
Defined in: packages/agentos/src/api/types.ts:1263
Override the provider base URL (useful for local proxies or Ollama).
Inherited from
BaseAgentConfig.baseUrl
cache?
optionalcache:false| {ttl?:"5m"|"1h"; }
Defined in: packages/agentos/src/api/agent.ts:251
Per-call prompt-cache control forwarded to every generate / stream /
session call this agent makes (same contract as
GenerateTextOptions.cache): false sends zero cache markers;
{ ttl: '1h' } re-times the auto markers — including the moving
conversation-history tail — onto the 1-hour cache. Set '1h' for agent
loops whose steps gap past the 5-minute default cache TTL (multi-minute
tool executions between LLM steps), where the default-paced history
marker expires between steps and every step re-writes the whole prefix.
Unset -> the provider's default marker pacing.
chainOfThought?
optionalchainOfThought:string|boolean
Defined in: packages/agentos/src/api/agent.ts:124
Chain-of-thought reasoning instruction.
false— disable CoT injection.true(default for agents) — inject the default CoT instruction when tools are present.string— inject a custom CoT instruction when tools are present.
channels?
optionalchannels:Record<string,Record<string,unknown>>
Defined in: packages/agentos/src/api/types.ts:1405
Channel adapter configurations keyed by channel name. Values are channel-specific option objects passed through opaquely.
Inherited from
BaseAgentConfig.channels
cognitiveMechanisms?
optionalcognitiveMechanisms:CognitiveMechanismsConfig
Defined in: packages/agentos/src/api/types.ts:1450
Cognitive mechanisms config — 8 neuroscience-backed memory mechanisms. All HEXACO-modulated (emotionality, conscientiousness, openness, etc.).
- Pass
{}for sensible defaults (all 8 mechanisms enabled). - Omit entirely to disable (zero overhead — no code paths execute).
- Provide per-mechanism overrides to tune individual parameters.
Requires memory to be enabled (true or a MemoryConfig object).
If cognitiveMechanisms is set but memory is disabled, a warning is logged
and the mechanisms config is ignored.
See
Inherited from
BaseAgentConfig.cognitiveMechanisms
controls?
optionalcontrols:ResourceControls
Defined in: packages/agentos/src/api/types.ts:1427
Resource limits (tokens, cost, time). agency() and the full runtime
enforce every field against the entire run. The lightweight agent()
helper forwards two of them per call: maxTotalTokens caps each LLM
call's completion output (mapped to maxTokens when no explicit
maxTokens is set, NOT the prompt+completion run total) and
maxDurationMs bounds each LLM request (mapped to requestTimeout).
The remaining fields stay agency()-only.
Inherited from
BaseAgentConfig.controls
customModelParams?
optionalcustomModelParams:Record<string,unknown>
Defined in: packages/agentos/src/api/types.ts:1371
Provider-specific TOP-LEVEL request-payload parameters forwarded verbatim
on every generate/stream/session call via
ModelCompletionOptions.customModelParams. Providers spread these onto
the outgoing request body — the escape hatch for params the typed options
don't model, e.g. OpenRouter provider-routing preferences:
customModelParams: { provider: { sort: 'throughput' } }
Inherited from
BaseAgentConfig.customModelParams
dependsOn?
optionaldependsOn:string[]
Defined in: packages/agentos/src/api/types.ts:1434
Names of other agents in the agency that must complete before this agent runs.
Used with strategy: 'graph' to build an explicit dependency DAG.
Agents with no dependsOn are roots and run first.
Example
`dependsOn: ['researcher']` — this agent waits for `researcher` to finish.
Inherited from
BaseAgentConfig.dependsOn
discovery?
optionaldiscovery:DiscoveryConfig
Defined in: packages/agentos/src/api/types.ts:1382
Runtime capability discovery configuration.
Inherited from
BaseAgentConfig.discovery
effort?
optionaleffort:string
Defined in: packages/agentos/src/api/types.ts:1359
Reasoning-effort control forwarded to every generate/stream/session call.
On effort-capable Claude models (Opus 4.5+, Sonnet 4.6, Fable/Mythos 5) the
provider sends output_config.effort (low|medium|high|xhigh|max). On
OpenAI reasoning models (o-series, GPT-5.x) the provider sends
reasoning_effort (chat) / reasoning.effort (Responses), with max
clamping to xhigh — OpenAI's ceiling — and a model-aware guard capping
xhigh → high on ids not probe-verified for xhigh (gpt-5.5/5.6 families
are verified). Independent of thinking; ignored on unsupported
models/values. Works per-agent in agency() rosters — each sub-agent may
pin its own depth.
Inherited from
BaseAgentConfig.effort
emergent?
optionalemergent:EmergentConfig
Defined in: packages/agentos/src/api/types.ts:1396
Emergent agent synthesis configuration.
Inherited from
BaseAgentConfig.emergent
fallbackProviders?
optionalfallbackProviders:FallbackProviderEntry[]
Defined in: packages/agentos/src/api/agent.ts:137
Ordered list of fallback providers to try when the primary provider fails with a retryable error (HTTP 402/429/5xx, network errors).
Defaults to auto-built chain when omitted — fallback is on by
default. Pass [] for strict single-provider mode, or supply a
custom array to control the chain. Applied to every generate(),
stream(), and session.send() / session.stream() call made
through this agent.
See
GenerateTextOptions.fallbackProviders
guardrails?
optionalguardrails:string[] |GuardrailsConfig
Defined in: packages/agentos/src/api/types.ts:1388
Guardrail policy identifiers or structured config.
string[]— shorthand; applies to both input and output.GuardrailsConfig— full control with separate input/output lists.
Inherited from
BaseAgentConfig.guardrails
history?
optionalhistory:false|Partial<SessionHistoryConfig>
Defined in: packages/agentos/src/api/agent.ts:260
Session conversation-history policy (spec 2026-07-20 §1a/§1c). Sessions
maintain a lossless transcript by default — independent of the memory
subsystem — bounded past maxTokens (default 120K estimated) by
chunk-amortized whole-block eviction. false restores stateless
sessions (the pre-0.10 memory: false behavior). Partial objects
override individual bounds.
hitl?
optionalhitl:HitlConfig
Defined in: packages/agentos/src/api/types.ts:1394
Human-in-the-loop approval configuration.
Inherited from
BaseAgentConfig.hitl
hostPolicy?
optionalhostPolicy:HostLLMPolicy
Defined in: packages/agentos/src/api/agent.ts:148
Host-level routing hints forwarded to the high-level generation helpers.
instructions?
optionalinstructions:string
Defined in: packages/agentos/src/api/types.ts:1257
Free-form system instructions prepended to the system prompt.
Inherited from
BaseAgentConfig.instructions
maxSteps?
optionalmaxSteps:number
Defined in: packages/agentos/src/api/types.ts:1292
Maximum number of agentic steps (LLM calls) per invocation. Defaults to 5.
Inherited from
BaseAgentConfig.maxSteps
maxTokens?
optionalmaxTokens:number
Defined in: packages/agentos/src/api/types.ts:1325
Upper bound on completion tokens for each LLM call the agent makes.
Forwarded to the underlying generateText / streamText call on
every generate(), stream(), and session.send() invocation.
Caps tail spend when a model misbehaves and yaps past the intended output size. Omit to use the provider default — AnthropicProvider defaults to 16000 (set 2026-05-17; was 4096), OpenAIProvider defaults to 4096, GeminiProvider defaults to 8192. Set to ~2× the agent's typical response size so normal calls finish naturally and only runaway generations hit the cap.
Example
// Cap a roleplay agent at 1024 — short turns, fast feedback.
const companion = agent({
provider: 'anthropic',
model: 'claude-sonnet-4-6',
instructions: 'Reply in character. 2-3 sentences.',
maxTokens: 1024,
});
// Tool-use agent emitting verbose JSON — go big so structured
// output doesn't truncate mid-token. Opus 4.7 supports 32000.
const codegen = agent({
provider: 'anthropic',
model: 'claude-opus-4-7',
tools: { GenerateCode, RunTests, JudgeOutput },
maxTokens: 16000,
});
Inherited from
BaseAgentConfig.maxTokens
memory?
optionalmemory:boolean|MemoryConfig
Defined in: packages/agentos/src/api/types.ts:1378
Memory configuration.
true— enable in-memory conversation history with default settings.false— disable memory; every call is stateless.MemoryConfig— full control over memory subsystems.
Inherited from
BaseAgentConfig.memory
memoryProvider?
optionalmemoryProvider:AgentMemoryProvider
Defined in: packages/agentos/src/api/agent.ts:219
Optional memory provider. When provided, memory auto-wires on all four agent call paths (see AgentMemoryProvider for hook contract).
getContextruns before each LLM call; result prepended as a system message.observeruns after each LLM call as fire-and-forget.
memoryProviderOptions?
optionalmemoryProviderOptions:MemoryProviderHookOptions
Defined in: packages/agentos/src/api/agent.ts:227
Optional tunables for the automatic memoryProvider hooks.
timeoutMs bounds each getContext call before the turn ships without
memory (default MEMORY_TIMEOUT_MS, 5000); tokenBudget is forwarded to
getContext as the recall ceiling (default DEFAULT_MEMORY_TOKEN_BUDGET,
2000). Both fall back to the historical module constants when omitted.
model?
optionalmodel:string
Defined in: packages/agentos/src/api/types.ts:1250
Model identifier. Accepted in two formats:
- Plain model name (e.g.
"gpt-4o") whenprovideris also set. Preferred. "provider:model"combined string (e.g."openai:gpt-4o").
Inherited from
BaseAgentConfig.model
name?
optionalname:string
Defined in: packages/agentos/src/api/types.ts:1259
Display name for the agent, injected into the system prompt.
Inherited from
BaseAgentConfig.name
observability?
optionalobservability:ObservabilityConfig
Defined in: packages/agentos/src/api/types.ts:1415
Observability and telemetry configuration.
Inherited from
BaseAgentConfig.observability
on?
optionalon:AgencyCallbacks
Defined in: packages/agentos/src/api/types.ts:1417
Event callbacks fired at various lifecycle points during the run.
Inherited from
BaseAgentConfig.on
onAfterGeneration()?
optionalonAfterGeneration: (result) =>Promise<void|GenerationHookResult>
Defined in: packages/agentos/src/api/agent.ts:208
Post-generation hook, called after each LLM step.
Parameters
result
Returns
Promise<void | GenerationHookResult>
onBeforeGeneration()?
optionalonBeforeGeneration: (context) =>Promise<void|GenerationHookContext>
Defined in: packages/agentos/src/api/agent.ts:206
Pre-generation hook, called before each LLM step.
Parameters
context
Returns
Promise<void | GenerationHookContext>
onBeforeToolExecution()?
optionalonBeforeToolExecution: (info) =>Promise<ToolCallHookInfo|null>
Defined in: packages/agentos/src/api/agent.ts:210
Pre-tool-execution hook.
Parameters
info
Returns
Promise<ToolCallHookInfo | null>
onFallback()?
optionalonFallback: (error,fallbackProvider) =>void
Defined in: packages/agentos/src/api/agent.ts:144
Callback invoked when a fallback provider is about to be tried.
Parameters
error
Error
The error that triggered the fallback.
fallbackProvider
string
The provider identifier being tried next.
Returns
void
output?
optionaloutput:unknown
Defined in: packages/agentos/src/api/types.ts:1411
Output schema for structured generation.
Accepts a Zod schema at runtime; typed as unknown here to avoid a
hard dependency on the zod package in the types layer.
Inherited from
BaseAgentConfig.output
permissions?
optionalpermissions:PermissionsConfig
Defined in: packages/agentos/src/api/types.ts:1392
Fine-grained tool and resource permission overrides.
Inherited from
BaseAgentConfig.permissions
personality?
optionalpersonality:Partial<{agreeableness:number;conscientiousness:number;emotionality:number;extraversion:number;honesty:number;honesty_humility:number;honestyHumility:number;openness:number;opennessToExperience:number; }>
Defined in: packages/agentos/src/api/types.ts:1271
HEXACO-inspired personality trait overrides (0–1 scale).
Encoded as a human-readable trait string appended to the system prompt.
The SOUL.md spellings honestyHumility / honesty_humility and
opennessToExperience are accepted for honesty and openness; when
both spellings are given, the canonical key wins.
Inherited from
BaseAgentConfig.personality
policyTier?
optionalpolicyTier:"safe"|"standard"|"mature"|"private-adult"
Defined in: packages/agentos/src/api/agent.ts:160
Caller's intended content policy tier, forwarded to every generate() /
stream() / session call this agent makes (same contract as
GenerateTextOptions.policyTier): on 'mature' / 'private-adult'
with no explicit fallbackProviders, the auto-built fallback chain
prepends uncensored legs so a content-policy refusal from the primary
re-routes to a model that can complete the request, and the model router
receives the tier as a routing hint. Unset keeps the availability-only
chain and tier-agnostic routing. A per-call policyTier in extra
overrides this value.
provenance?
optionalprovenance:AgencyProvenanceConfig
Defined in: packages/agentos/src/api/types.ts:1413
Provenance and audit-trail configuration.
Inherited from
BaseAgentConfig.provenance
provider?
optionalprovider:string
Defined in: packages/agentos/src/api/types.ts:1255
Provider name (e.g. "openai", "anthropic", "ollama").
Auto-detected from environment API keys when omitted.
Inherited from
BaseAgentConfig.provider
rag?
optionalrag:RagConfig
Defined in: packages/agentos/src/api/types.ts:1380
Retrieval-Augmented Generation configuration.
Inherited from
BaseAgentConfig.rag
responseSchema?
optionalresponseSchema:ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>
Defined in: packages/agentos/src/api/agent.ts:204
Optional Zod schema for validating the LLM's structured output.
When provided, the agent's generate() result includes a parsed field
with the Zod-validated and typed output. JSON extraction and validation
happen automatically in the onAfterGeneration hook. On validation failure,
the agent retries internally (up to controls.maxValidationRetries ?? 1).
When omitted, behavior is unchanged — result.parsed is undefined.
This is a non-breaking additive change.
Example
import { z } from 'zod';
const myAgent = agent({
name: 'Extractor',
instructions: 'Extract entities as JSON',
responseSchema: z.object({ entities: z.array(z.string()) }),
});
const result = await myAgent.generate('Find entities in: ...');
console.log(result.parsed?.entities); // string[]
router?
optionalrouter:IModelRouter
Defined in: packages/agentos/src/api/agent.ts:146
Model router for intelligent provider selection per-call.
routerParams?
optionalrouterParams:Partial<ModelRouteParams>
Defined in: packages/agentos/src/api/agent.ts:180
Routing hints passed to the model router's selectModel() call.
Useful for declaring capability requirements up-front so the router can pick a model that actually supports what the agent needs:
agent({
name: 'World Architect',
router: policyAwareRouter,
routerParams: { requiredCapabilities: ['json_mode'] },
output: WorldIdentitySchema,
});
When omitted, the router receives a minimal default params object
(taskHint only, plus function_calling in requiredCapabilities when
tools are declared).
security?
optionalsecurity:object
Defined in: packages/agentos/src/api/types.ts:1390
Security tier controlling permitted tools and capabilities.
tier
tier:
SecurityTier
Inherited from
BaseAgentConfig.security
skills?
optionalskills:SkillEntry[]
Defined in: packages/agentos/src/api/agent.ts:232
Optional skill entries to inject into the system prompt. Skill content is appended to the system prompt as markdown sections.
soul?
optionalsoul:string| {content:string; } | {path:string; }
Defined in: packages/agentos/src/api/agent.ts:292
Per-agent identity loaded from a SOUL.md workspace (the OpenClaw / aaronjmars-soul.md convention). Three forms are accepted:
-
Workspace path — points at a directory containing SOUL.md and optional companion files (STYLE.md, IDENTITY.md, AGENTS.md, MEMORY.md, examples/):
agent({ provider: 'anthropic', soul: '~/.agentos/agents/aria' }); -
Direct file path — points at a single SOUL.md file:
agent({ provider: 'anthropic', soul: './personas/aria.soul.md' }); -
Inline content — pass the soul markdown directly (useful for tests and ephemeral agents):
agent({ provider: 'anthropic', soul: { content: SOUL_MARKDOWN_STRING } });
Loading semantics: at agent boot the runtime reads SOUL.md, parses YAML
frontmatter into an IPersonaDefinition (HEXACO traits, voice, mood,
hardLimits), and injects the markdown body as the FIRST system message —
before instructions, chainOfThought, personality, or skills. STYLE.md
is appended as a second system message when present.
See
- loadSoul in
@framers/agentos/cognition/substrate/personas/SoulLoaderfor the loader implementation and full SOUL.md format spec. - https://github.com/aaronjmars/soul.md for the cross-framework convention.
systemBlocks?
optionalsystemBlocks:SystemContentBlock[]
Defined in: packages/agentos/src/api/agent.ts:239
Structured system prompt blocks with cache breakpoints.
When provided, takes precedence over the assembled string from
instructions, name, personality, and skills.
Use this for prompt caching support with Anthropic.
thinking?
optionalthinking:false| {budgetTokens:number; }
Defined in: packages/agentos/src/api/types.ts:1346
Extended-thinking switch forwarded to Claude models on every
generate() / stream() / session call this agent makes. Any positive
budgetTokens turns adaptive thinking on (the number itself is not
sent). false turns thinking off with the model's own off shape; Opus
5.5, Fable and Mythos always think. Omitted keeps the model's default:
thinking on for Opus 5 and later, Sonnet 5 and later, Fable and Mythos,
off for older models. Other providers ignore it.
Example
const codegen = agent({
provider: 'anthropic',
model: 'claude-opus-5',
tools: { GenerateCode, RunTests, JudgeOutput },
maxTokens: 24000,
thinking: { budgetTokens: 8000 },
});
Inherited from
BaseAgentConfig.thinking
tools?
optionaltools:AdaptableToolInput
Defined in: packages/agentos/src/api/types.ts:1290
Tools available to the agent on every call.
Accepts:
- a named high-level tool map
- an
ExternalToolRegistry(Record,Map, or iterable) - a prompt-only
ToolDefinitionForLLM[]
Inherited from
BaseAgentConfig.tools
usageLedger?
optionalusageLedger:AgentOSUsageLedgerOptions
Defined in: packages/agentos/src/api/agent.ts:117
Top-level usage ledger shorthand. When present, forwarded to
observability.usageLedger internally.
verifyCitations?
optionalverifyCitations:VerifyCitationsConfig
Defined in: packages/agentos/src/api/types.ts:1483
Auto-verify citations after every generation.
When set, the agent retrieves sources for each user input, runs
generation, then scores each atomic claim in the response against the
retrieved sources via CitationVerifier. The resulting VerifiedResponse
is attached to the generation result's grounding field — no separate
verifier.verify(text, sources) call needed.
Pass a config object with the embedding function and the source retriever the verifier should use:
Example
const docsAgent = agent({
provider: 'openai',
model: 'gpt-4o',
verifyCitations: {
embedFn: (texts) => embeddingManager.embedBatch(texts),
retrieve: (query) => retriever.search(query),
},
});
const result = await docsAgent.generate('How do I configure a guardrail?');
console.log(result.text);
console.log(result.grounding?.overallGrounded);
for (const claim of result.grounding?.claims ?? []) {
if (claim.verdict !== 'supported') console.warn(claim.text);
}
Inherited from
BaseAgentConfig.verifyCitations
voice?
optionalvoice:VoiceConfig
Defined in: packages/agentos/src/api/types.ts:1398
Voice interface configuration.
Inherited from
BaseAgentConfig.voice