Behaviour for pluggable task persistence.
Implementations store and retrieve A2A.Task structs. Each callback
receives a store reference (opaque term) that the implementation uses
to locate its storage — e.g., an ETS table name or a connection PID.
Implementing a Custom Store
defmodule MyApp.RedisTaskStore do
@behaviour A2A.TaskStore
@impl true
def get(conn, task_id) do
# ...
end
# ... other callbacks
endConfiguring an Agent with a Store
MyAgent.start_link(task_store: {A2A.TaskStore.ETS, :my_tasks})
Summary
Callbacks
Deletes a task by ID.
Retrieves a task by ID.
Lists all tasks for a given context ID.
Lists tasks with filtering and pagination options.
Stores or updates a task.
Types
@type ref() :: term()
Callbacks
Deletes a task by ID.
@callback get(ref(), task_id :: String.t()) :: {:ok, A2A.Task.t()} | {:error, :not_found}
Retrieves a task by ID.
@callback list(ref(), context_id :: String.t()) :: {:ok, [A2A.Task.t()]}
Lists all tasks for a given context ID.
Lists tasks with filtering and pagination options.
Options
:context_id— filter by context ID:status— filter by task state atom:status_timestamp_after— filter to tasks updated after this DateTime:page_size— max results to return (default 50):page_token— opaque cursor for pagination:history_length— number of history entries to include (default 0):include_artifacts— whether to include artifacts (default false)
@callback put(ref(), A2A.Task.t()) :: :ok | {:error, term()}
Stores or updates a task.