ReqManagedAgents.Client (ReqManagedAgents v0.1.0)

Copy Markdown View Source

Low-level control-plane HTTP client for Claude Managed Agents (agents, sessions, events) over Req. The long-lived SSE event stream lives in ReqManagedAgents.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.

Summary

Functions

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.

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.

Convenience for a single event.

Types

t()

@type t() :: %ReqManagedAgents.Client{
  anthropic_version: term(),
  api_key: term(),
  base_url: term(),
  beta: term(),
  files_beta: term(),
  profile: term(),
  receive_timeout: term(),
  req_options: term()
}

Functions

list_all_events(c, session_id, params \\ %{})

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.

new(opts \\ [])

@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(c, session_id, event)

Convenience for a single event.