Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.a2aproject.sdk.server.agentexecution;

import org.a2aproject.sdk.server.events.EventQueue;
import org.a2aproject.sdk.server.tasks.AgentEmitter;
import org.a2aproject.sdk.spec.A2AError;
import org.a2aproject.sdk.spec.TaskNotCancelableError;

/**
* Core business logic interface for implementing A2A agent functionality.
Expand Down Expand Up @@ -97,6 +97,7 @@
* @see org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler
* @see org.a2aproject.sdk.spec.AgentCard
*/
@FunctionalInterface
public interface AgentExecutor {
/**
* Executes the agent's business logic for a message.
Expand Down Expand Up @@ -135,7 +136,7 @@ public interface AgentExecutor {
* <p>
* <b>Error Handling:</b>
* <ul>
* <li>Throw {@link org.a2aproject.sdk.spec.TaskNotCancelableError} if your agent does not support
* <li>Throw {@link TaskNotCancelableError} if your agent does not support
* cancellation at all (e.g., fire-and-forget agents)</li>
* <li>Throw {@link A2AError} if cancellation is supported but failed to execute
* (e.g., unable to interrupt running operation)</li>
Expand All @@ -144,8 +145,10 @@ public interface AgentExecutor {
*
* @param context the request context for the task being canceled
* @param emitter the agent emitter for sending the cancellation event
* @throws org.a2aproject.sdk.spec.TaskNotCancelableError if this agent does not support cancellation
* @throws TaskNotCancelableError if this agent does not support cancellation
* @throws A2AError if cancellation is supported but failed to execute
*/
void cancel(RequestContext context, AgentEmitter emitter) throws A2AError;
default void cancel(RequestContext context, AgentEmitter emitter) throws A2AError {
throw new TaskNotCancelableError("Agent execution is not cancelable.");
}
}
Loading