Claudio.ManagedAgents.Sessions (Claudio v0.7.0)

View Source

Managed Agents sessions (/v1/sessions) — one run of an agent in an environment, plus its events and mounted resources.

Beta managed-agents-2026-04-01, attached per request. Returns raw decoded bodies; see Claudio.ManagedAgents.

A session created without initial_events starts idle; sending a user.message starts it. Typed events and the run loop (stream, custom tools, confirmations) come in a later release; for now events are plain maps:

{:ok, session} = Sessions.create(client, %{agent: agent_id, environment_id: env_id})

{:ok, _} =
  Sessions.send_events(client, session["id"], [
    %{type: "user.message", content: [%{type: "text", text: "Summarise the repo."}]}
  ])

{:ok, %{"data" => events}} = Sessions.list_events(client, session["id"], order: :asc)

Resources

create/2 takes resources: (file, github_repository, memory_store). Mid-session, add_resource/3 accepts only file resources, and a file resource needs the agent's agent_toolset_20260401 with read enabled. update_resource/4 rotates a github_repository's authorization_token — the only update the API accepts.

Neither archive/2 nor delete/2 works on a running session; interrupt it and wait for idle first. delete/2 removes events, sandbox and produced files.

Summary

Functions

Mounts a resource mid-session. Only file resources are accepted after creation.

Archives a session (keeps history, blocks new events). Not allowed while running.

Creates a session. agent (an id, or %{type: "agent", id: …, version: …}) and environment_id are required by the API.

Deletes a session permanently. Not allowed while running.

Removes a resource from a session.

Retrieves a session (status, resolved agent snapshot, usage, stats).

Retrieves one session resource.

Lists sessions. Options include statuses: [...], created_at: [gte: …], agent_id, agent_version, deployment_id, memory_store_id, include_archived, order, limit, page.

Lists a session's events. Options: types: [...], created_at: [...], order, limit, page.

Lists a session's resources.

Sends events (a list of event maps) to a session: POST …/events with %{"events" => events}.

Updates a session: title, metadata, budget, and (while idle) agent.tools / agent.mcp_servers.

Updates a resource — in practice, rotates a github_repository's authorization_token.

Functions

add_resource(client, id, resource)

@spec add_resource(Req.Request.t(), String.t(), map()) ::
  Claudio.ManagedAgents.result()

Mounts a resource mid-session. Only file resources are accepted after creation.

archive(client, id)

Archives a session (keeps history, blocks new events). Not allowed while running.

create(client, params)

Creates a session. agent (an id, or %{type: "agent", id: …, version: …}) and environment_id are required by the API.

delete(client, id)

Deletes a session permanently. Not allowed while running.

delete_resource(client, id, rid)

@spec delete_resource(Req.Request.t(), String.t(), String.t()) ::
  Claudio.ManagedAgents.result()

Removes a resource from a session.

get(client, id)

Retrieves a session (status, resolved agent snapshot, usage, stats).

get_resource(client, id, rid)

@spec get_resource(Req.Request.t(), String.t(), String.t()) ::
  Claudio.ManagedAgents.result()

Retrieves one session resource.

list(client, opts \\ [])

Lists sessions. Options include statuses: [...], created_at: [gte: …], agent_id, agent_version, deployment_id, memory_store_id, include_archived, order, limit, page.

list_events(client, id, opts \\ [])

Lists a session's events. Options: types: [...], created_at: [...], order, limit, page.

list_resources(client, id, opts \\ [])

@spec list_resources(Req.Request.t(), String.t(), keyword()) ::
  Claudio.ManagedAgents.result()

Lists a session's resources.

send_events(client, id, events)

@spec send_events(Req.Request.t(), String.t(), [map()]) ::
  Claudio.ManagedAgents.result()

Sends events (a list of event maps) to a session: POST …/events with %{"events" => events}.

update(client, id, params)

Updates a session: title, metadata, budget, and (while idle) agent.tools / agent.mcp_servers.

update_resource(client, id, rid, params)

@spec update_resource(Req.Request.t(), String.t(), String.t(), map()) ::
  Claudio.ManagedAgents.result()

Updates a resource — in practice, rotates a github_repository's authorization_token.