# `A2A.TaskStore`
[🔗](https://github.com/actioncard/a2a-elixir/blob/main/lib/a2a/task_store.ex#L1)

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
    end

## Configuring an Agent with a Store

    MyAgent.start_link(task_store: {A2A.TaskStore.ETS, :my_tasks})

# `ref`

```elixir
@type ref() :: term()
```

# `delete`

```elixir
@callback delete(ref(), task_id :: String.t()) :: :ok | {:error, term()}
```

Deletes a task by ID.

# `delete_push_config`
*optional* 

```elixir
@callback delete_push_config(ref(), task_id :: String.t(), config_id :: String.t()) :: :ok
```

Deletes a push notification config.

Idempotent — deleting a config that is not present returns `:ok`.

# `get`

```elixir
@callback get(ref(), task_id :: String.t()) :: {:ok, A2A.Task.t()} | {:error, :not_found}
```

Retrieves a task by ID.

# `get_push_config`
*optional* 

```elixir
@callback get_push_config(ref(), task_id :: String.t(), config_id :: String.t()) ::
  {:ok, A2A.PushNotificationConfig.t()} | {:error, :not_found}
```

Retrieves a push notification config by task ID and config ID.

# `list`

```elixir
@callback list(ref(), context_id :: String.t()) :: {:ok, [A2A.Task.t()]}
```

Lists all tasks for a given context ID.

# `list_all`
*optional* 

```elixir
@callback list_all(ref(), opts :: keyword()) :: {:ok, map()}
```

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)

# `list_push_configs`
*optional* 

```elixir
@callback list_push_configs(ref(), task_id :: String.t()) ::
  {:ok, [A2A.PushNotificationConfig.t()]}
```

Lists every push notification config registered for a task.

# `put`

```elixir
@callback put(ref(), A2A.Task.t()) :: :ok | {:error, term()}
```

Stores or updates a task.

# `set_push_config`
*optional* 

```elixir
@callback set_push_config(ref(), A2A.PushNotificationConfig.t()) ::
  {:ok, A2A.PushNotificationConfig.t()} | {:error, term()}
```

Stores or replaces a push notification config.

Configs are identified by `id` within the scope of their `task_id`. Stores
that implement the push callbacks own them entirely — the agent keeps no
in-memory copy, so a delete here is authoritative.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
