CallbackContext

class CallbackContext(invocationContext: InvocationContext, eventActions: EventActions? = null) : ReadonlyContext

The context provided to agents and tools during a callback, such as when a tool is run.

It provides access to the current invocation context, event actions, and state.

Constructors

Link copied to clipboard
constructor(invocationContext: InvocationContext, eventActions: EventActions? = null)

Properties

Link copied to clipboard
Link copied to clipboard
open override val agentName: String

The name of the agent that is being invoked.

Link copied to clipboard
open override val artifactService: ArtifactService?

The ArtifactService instance.

Link copied to clipboard
open override val branch: String?

The branch of the invocation context.

Link copied to clipboard
Link copied to clipboard
open override val invocationId: String

The unique ID of this invocation.

Link copied to clipboard
open override val memoryService: MemoryService?

The MemoryService instance.

Link copied to clipboard
open override val runConfig: RunConfig?

The run configuration for this invocation.

Link copied to clipboard
open override val session: Session

The session that this invocation is a part of.

Link copied to clipboard
open override val state: Map<String, Any>

The state of the session.

Link copied to clipboard
open override val userContent: Content?

The user content that this invocation is processing.

Link copied to clipboard
open override val userId: String

The user ID of the user that initiated the session.

Functions

Link copied to clipboard
suspend fun addSessionToMemory()

Triggers memory generation for the current session.

Link copied to clipboard
open suspend override fun getEvents(currentInvocation: Boolean, currentBranch: Boolean): List<Event>

Returns the events from the current session.

Link copied to clipboard

Merges the given event actions into the current event actions.

Link copied to clipboard
fun updateState(key: String, value: Any)

Updates the state delta in the event actions.