Fired to hand one agent's pending work over to the JS layer for execution: a buffered set of matched events, a due timer, or a user-assigned task with a prompt, depending on which constructor built it. Raised by AgentService.executeAgent and picked up in agents-lib, which listens for the event by name and enqueues a background task to actually run the agent - so the handler that fires this returns before the agent's own logic executes. getResult and setResult exist for a listener that wants to hand a value straight back, but the current listener does not use them.
Implements: CommonAppEvent
Properties
| Property | Returns | Description |
|---|---|---|
| agent | Agent | The agent instance this run belongs to. |
| agentDef | AgentDef | The definition that governs the agent's behaviour: its timers, event handlers and workflow. |
| bufferedEvents | List<String> | The events that matched the event handler, each already serialised to JSON. Present only when this run was triggered by a buffered set of events; null for a timer or task run. |
| eventHandlerDef | AgentDefEventHandler | The event handler definition this run matched against, present when the event was raised for a buffered set of events rather than a timer or a task. |
| prompt | String | The prompt text to run the agent with, supplied together with a task id. |
| result | Object | The value a listener chose to hand back after handling this event, if any. Not populated by the current agents-lib listener, which enqueues a background task rather than returning a result synchronously. |
| taskId | Long | Id of the task that was assigned to this agent, present when a task assignment triggered this run. Only the id is carried, not the task entity, since events must hold serializable data. |
| timer | AgentDefTimer | The timer that came due and triggered this run. |
Methods
getEventHandlerDef() · getAgent() · getAgentDef() · getBufferedEvents() · getTimer() · getTaskId() · getPrompt() · getResult() · setResult(Object result)
getEventHandlerDef()
Returns: AgentDefEventHandler
The event handler definition this run matched against, present when the event was raised for a buffered set of events rather than a timer or a task.
getAgent()
Returns: Agent
The agent instance this run belongs to.
getAgentDef()
Returns: AgentDef
The definition that governs the agent's behaviour: its timers, event handlers and workflow.
getBufferedEvents()
Returns: List<String>
The events that matched the event handler, each already serialised to JSON. Present only when this run was triggered by a buffered set of events; null for a timer or task run.
getTimer()
Returns: AgentDefTimer
The timer that came due and triggered this run.
getTaskId()
Returns: Long
Id of the task that was assigned to this agent, present when a task assignment triggered this run. Only the id is carried, not the task entity, since events must hold serializable data.
getPrompt()
Returns: String
The prompt text to run the agent with, supplied together with a task id.
getResult()
Returns: Object
The value a listener chose to hand back after handling this event, if any. Not populated by the current agents-lib listener, which enqueues a background task rather than returning a result synchronously.
setResult(Object result)
Returns: void
Lets a listener hand a value back to the code that fired this event.
| Parameter | Description |
|---|---|
result | the value for callers of {@link #getResult} to receive |