Documentation / @agentick/core / LifecycleCallbacks
Interface: LifecycleCallbacks ​
Defined in: core/src/app/types.ts:62
Lifecycle callbacks for session execution.
These provide a cleaner alternative to event listeners for common lifecycle events. Callbacks defined on AppOptions are inherited by all sessions; callbacks on SessionOptions override or supplement them.
Example ​
const app = createApp(MyAgent, {
model,
onTickStart: (tick) => console.log(`Tick ${tick} starting`),
onComplete: (result) => console.log(`Done: ${result.response}`),
});
// Session can add its own callbacks
const session = app.session({
onEvent: (event) => { ... }, // Receives all events
});Extended by ​
Properties ​
onComplete()? ​
optionalonComplete: (result) =>void
Defined in: core/src/app/types.ts:87
Called when execution completes successfully.
Parameters ​
result ​
The final result
Returns ​
void
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
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
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
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