agent2agentSourceA2AMiddlewareFetchTask

class FetchTask

Loads a task from the store and places it on env["a2a.task"]. Raises A2A::TaskNotFoundError if the task does not exist.

The task ID is read from the request — by default from request.id, or from request.task_id when id_field: :task_id is specified.

Usage:

on "GetTask" do use A2A::Middleware::FetchTask, store: sqlite_store respond_with -> (env) { task = env["a2a.task"] A2A::Schema["Task"].new(...) } end

For push notification config operations (task_id field):

on "GetTaskPushNotificationConfig" do use A2A::Middleware::FetchTask, store: sqlite_store, id_field: :task_id respond_with -> (env) ... end