接口 AgentExecutor
public interface AgentExecutor
Agent Executor interface.
Implementations of this interface contain the core logic of the agent, executing tasks based on requests and publishing updates to an event queue.
This is the Java equivalent of Python's AgentExecutor using Reactor.
-
方法概要
修饰符和类型方法说明reactor.core.publisher.Mono<Void>Request the agent to cancel an ongoing task.reactor.core.publisher.Mono<Void>execute(RequestContext context, EventQueue eventQueue) Execute the agent's logic for a given request context.
-
方法详细资料
-
execute
Execute the agent's logic for a given request context.The agent should read necessary information from the `context` and publish `Task` or `Message` events, or `TaskStatusUpdateEvent` / `TaskArtifactUpdateEvent` to the `eventQueue`. This method should return once the agent's execution for this request is complete or yields control (e.g., enters an input-required state).
- 参数:
context- The request context containing the message, task ID, etc.eventQueue- The queue to publish events to.- 返回:
- A Mono that completes when the agent execution is finished.
-
cancel
Request the agent to cancel an ongoing task.The agent should attempt to stop the task identified by the task_id in the context and publish a `TaskStatusUpdateEvent` with state `TaskState.canceled` to the `eventQueue`.
- 参数:
taskId- The task ID to cancel.- 返回:
- A Mono that completes when the cancellation is processed.
-