Documentation / @agentick/core / AppOptions
Interface: AppOptions
Defined in: core/src/app/types.ts:458
Configuration options for creating an App instance.
AppOptions configure the execution runner - things that apply across all sessions created from this app.
Extends
Properties
devTools?
optionaldevTools:boolean
Defined in: core/src/app/types.ts:506
Enable DevTools event emission for all sessions created by this app.
When true, lifecycle events (execution_start, tick_start, tick_end, execution_end, fiber_snapshot) are emitted to the DevTools emitter.
Default
falseinbox?
optionalinbox:InboxStorage
Defined in: core/src/app/types.ts:538
Override default in-memory inbox with a durable backend.
The inbox enables external message delivery to sessions. A MemoryInboxStorage is created automatically if not provided.
inheritDefaults?
optionalinheritDefaults:boolean
Defined in: core/src/app/types.ts:661
Whether to inherit middleware and telemetry from the global Agentick instance.
When true (default), the app inherits:
- Middleware registered via
Agentick.use('*', mw),Agentick.use('tool:*', mw), etc. - Telemetry provider from
Agentick.telemetryProvider
Set to false for isolated apps (useful in testing).
Default
trueExample
// App inherits Agentick defaults (default behavior)
const app = createApp(MyAgent, { model });
// Isolated app - no Agentick middleware
const testApp = createApp(TestAgent, { model, inheritDefaults: false });maxTicks?
optionalmaxTicks:number
Defined in: core/src/app/types.ts:480
Maximum number of ticks before stopping execution.
Default
10maxTimelineEntries?
optionalmaxTimelineEntries:number
Defined in: core/src/app/types.ts:628
Maximum timeline entries to keep in memory per session. When exceeded, oldest entries are trimmed after each tick. Default: unbounded.
mcpServers?
optionalmcpServers:Record<string,MCPConfig>
Defined in: core/src/app/types.ts:474
MCP server configurations.
model?
optionalmodel:EngineModel<ModelInput,ModelOutput>
Defined in: core/src/app/types.ts:463
Override model from JSX (for testing/mocking). If not provided, uses the model from <Model> component in JSX tree.
onAfterPersist()?
optionalonAfterPersist: (sessionId,snapshot) =>void|Promise<void>
Defined in: core/src/app/types.ts:579
Called after a session snapshot has been persisted.
Parameters
sessionId
string
The ID of the persisted session
snapshot
The snapshot that was saved
Returns
void | Promise<void>
onAfterRestore()?
optionalonAfterRestore: (session,snapshot) =>void|Promise<void>
Defined in: core/src/app/types.ts:603
Called after a session has been restored.
Parameters
session
The restored session
snapshot
The snapshot that was used
Returns
void | Promise<void>
onAfterSend()?
optionalonAfterSend: (session,result) =>void
Defined in: core/src/app/types.ts:614
Called after send completes successfully.
Parameters
session
result
Returns
void
onBeforePersist()?
optionalonBeforePersist: (session,snapshot) =>boolean|void|SessionSnapshot|Promise<boolean|void|SessionSnapshot>
Defined in: core/src/app/types.ts:568
Called before a session snapshot is persisted to store.
Use this to:
- Cancel persistence (return false)
- Modify the snapshot before saving (return modified snapshot)
Parameters
session
The session being persisted
snapshot
The snapshot that will be saved
Returns
boolean | void | SessionSnapshot | Promise<boolean | void | SessionSnapshot>
false to cancel, modified snapshot, or void to proceed
onBeforeRestore()?
optionalonBeforeRestore: (sessionId,snapshot) =>boolean|void|SessionSnapshot|Promise<boolean|void|SessionSnapshot>
Defined in: core/src/app/types.ts:592
Called before a session is restored from storage.
Use this to:
- Cancel restoration (return false)
- Migrate/transform old snapshot formats (return modified snapshot)
Parameters
sessionId
string
The ID of the session being restored
snapshot
The snapshot loaded from storage
Returns
boolean | void | SessionSnapshot | Promise<boolean | void | SessionSnapshot>
false to cancel, modified snapshot, or void to proceed
onBeforeSend()?
optionalonBeforeSend: <P>(session,input) =>void|SendInput<P>
Defined in: core/src/app/types.ts:609
Called before send is executed. Return a modified input to override what is sent.
Type Parameters
P
P
Parameters
session
Session<P>
input
SendInput<P>
Returns
void | SendInput<P>
onComplete()?
optionalonComplete: (result) =>void
Defined in: core/src/app/types.ts:87
Called when execution completes successfully.
Parameters
result
The final result
Returns
void
Inherited from
onError()?
optionalonError: (error) =>void
Defined in: core/src/app/types.ts:93
Called when an error occurs during execution.
Parameters
error
Error
The error that occurred
Returns
void
Inherited from
onEvent()?
optionalonEvent: (event) =>void
Defined in: core/src/app/types.ts:67
Called for every stream event. Use this for fine-grained event handling.
Parameters
event
Returns
void
Inherited from
onSessionClose()?
optionalonSessionClose: (sessionId) =>void
Defined in: core/src/app/types.ts:555
Called when a session is closed and removed from the registry.
Parameters
sessionId
string
Returns
void
onSessionCreate()?
optionalonSessionCreate: (session) =>void
Defined in: core/src/app/types.ts:550
Called when a session is created.
Parameters
session
Returns
void
onTickEnd()?
optionalonTickEnd: (tick,usage?) =>void
Defined in: core/src/app/types.ts:81
Called when a tick ends.
Parameters
tick
number
The tick number
usage?
Token usage for this tick
Returns
void
Inherited from
onTickStart()?
optionalonTickStart: (tick,executionId) =>void
Defined in: core/src/app/types.ts:74
Called when a tick starts.
Parameters
tick
number
The tick number (1-indexed)
executionId
string
The execution ID
Returns
void
Inherited from
LifecycleCallbacks.onTickStart
onToolConfirmation()?
optionalonToolConfirmation: (call,message) =>Promise<boolean>
Defined in: core/src/app/types.ts:621
Callback for tool confirmation. Called when a tool with requiresConfirmation is invoked. Return true to allow, false to deny.
Parameters
call
message
string
Returns
Promise<boolean>
resolve?
optionalresolve:ResolveConfig
Defined in: core/src/app/types.ts:639
Resolve configuration for loading data before session render.
When a session is restored from a store, resolve functions receive the snapshot as context. Results are available via useResolved(key).
When resolve is set, snapshots are NOT auto-applied on restore — the resolve function controls reconstruction (Layer 2).
runner?
optionalrunner:ExecutionRunner
Defined in: core/src/app/types.ts:496
Execution runner for all sessions created by this app.
Controls how compiled context reaches the model and how tool calls execute. Default: standard model→tool_use protocol (no transformation).
Example
const app = createApp(MyAgent, {
model,
runner: replRunner({ sandbox: true }),
});sessionResolver()?
optionalsessionResolver: (message) =>string|Promise<string|null> |null
Defined in: core/src/app/types.ts:545
Route incoming messages to session IDs. Used by app.receive().
Return a session ID to route to, or null to create a new session.
Parameters
message
Returns
string | Promise<string | null> | null
sessions?
optionalsessions:SessionManagementOptions
Defined in: core/src/app/types.ts:530
Session management configuration.
Controls persistence, limits, and auto-cleanup of sessions.
Example
const app = createApp(MyAgent, {
sessions: {
store: new RedisSessionStore(redis),
maxActive: 100,
idleTimeout: 5 * 60 * 1000, // 5 minutes
},
});signal?
optionalsignal:AbortSignal
Defined in: core/src/app/types.ts:512
App-level abort signal. All sessions will respect this signal.
tools?
optionaltools:ExecutableTool<(input,ctx?) =>ContentBlock[] |Promise<ContentBlock[]>>[]
Defined in: core/src/app/types.ts:469
Additional tools to make available. These are merged with tools from <Tool> components in JSX.