# `ReqManagedAgents.Providers.ClaudeManagedAgents.Client`
[🔗](https://github.com/cash-mckeeman/req_managed_agents/blob/v0.13.0/req_managed_agents/lib/req_managed_agents/providers/claude_managed_agents/client.ex#L1)

Low-level control-plane HTTP client for Claude Managed Agents (agents, sessions,
events) over `Req`. The long-lived SSE event stream lives in
`ReqManagedAgents.Providers.ClaudeManagedAgents.Stream`.

Build one with `new/1`; pass it as the first argument to every call. All
requests carry the `managed-agents-2026-04-01` beta header.

# `t`

```elixir
@type t() :: %ReqManagedAgents.Providers.ClaudeManagedAgents.Client{
  anthropic_version: String.t(),
  api_key: String.t(),
  base_url: String.t(),
  beta: String.t(),
  files_beta: String.t(),
  profile: atom(),
  receive_timeout: timeout(),
  req_options: keyword()
}
```

# `list_all_events`

Fetch ALL events for a session, paging via the API's opaque `next_page` cursor
(limit 100/page). Passes the cursor back as the `page` query param;
stops when `next_page` is absent/blank, or if a cursor repeats (a guard against
a pathological server). Returns the flat event list.

# `list_thread_events`

```elixir
@spec list_thread_events(
  t() | ReqManagedAgents.Client.t(),
  String.t(),
  String.t(),
  map()
) ::
  {:ok, map()} | {:error, term()}
```

Lists persisted events for one thread using `page` / `next_page` pagination.

# `list_threads`

```elixir
@spec list_threads(t() | ReqManagedAgents.Client.t(), String.t(), map()) ::
  {:ok, map()} | {:error, term()}
```

Lists session threads using the API's `page` / `next_page` pagination.

# `new`

```elixir
@spec new(keyword()) :: t()
```

Build a client. Resolves `:api_key` from the option, then
`Application.get_env(:req_managed_agents, :api_key)`, then `ANTHROPIC_API_KEY`.
Other keys fall back to the same application env, then defaults.

# `send_event`

Convenience for a single event.

---

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