OptionaldbSQL database exposed to tool code as ctx.db. When omitted, the runtime
connects one itself from DATABASE_URL in the provider env (self-hosted
aai dev parity with the platform's database switch); with neither,
ctx.db access throws.
The agent's own env — what tool code sees as ctx.env. Typed
AgentEnv: a withHostCredentialFallback result (which may carry
host/shell credentials) is a compile error here — pass it as
RuntimeOptions.providerEnv instead.
OptionalfetchOverride the fetch implementation used by built-in tools (web_search,
visit_webpage, get_page_design, fetch_json). Defaults to builtinFetch():
SSRF-screened unless the spawner declared a real container around the
process (AAI_SANDBOX_CONTAINED=1), in which case the sandbox is the
boundary and the screen is skipped. Override only in tests.
OptionalllmLLM provider descriptor, from a factory like anthropic(...).
OptionalloggerStructured logger for runtime and session logs. Defaults to the console.
OptionalonHost/relay mode hook. When set, inbound tool_result frames are routed to
this handler (which settles the relay's pending call) and the session skips
its own tool_call emit since the relay executeTool emits it. Paired with
a relay executeTool + toolSchemas. See host-mode.ts.
OptionalproviderEnvironment used to resolve provider credentials (STT/TTS/LLM). Defaults to RuntimeOptions.env.
Exists so a self-hosted caller can let shell-exported credentials reach
the provider resolvers without also placing them in ctx.env, where agent
tool code could read them and come to depend on host-level variables that
do not exist in production. The platform passes neither — it resolves
everything from the agent's own stored env.
OptionalrunIn-sandbox executor for the run_code builtin. Only the platform's
guest harness provides one — it runs inside the Modal sandbox, which is
the security boundary. Without it, run_code refuses to evaluate code in
this process (the self-hosted guard).
Optionals2sS2S endpoint URL and audio sample rates. Defaults to DEFAULT_S2S_CONFIG.
OptionalsessionTimeout in ms for session.start() (S2S connection setup).
Defaults to 10 000 (10 s).
OptionalshutdownMaximum time in milliseconds to wait for sessions to stop during
shutdown(). Defaults to 30_000 (30 s).
OptionalsttSTT provider descriptor (SttProvider). Must be set together with
llm and tts to route sessions through the pipeline path; leave all
three unset to fall back to the agent's own provider fields (which
default to the all-AssemblyAI pipeline when the agent declares none).
OptionaltoolSystem prompt guidance for builtin tools. Passed through in sandbox mode.
OptionalttsTTS provider descriptor (TtsProvider).
Configuration for createRuntime.
Configures the agent, environment, database, logging, and S2S connection.