Claudio.ManagedAgents.Sessions (Claudio v0.7.0)
View SourceManaged 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
@spec add_resource(Req.Request.t(), String.t(), map()) :: Claudio.ManagedAgents.result()
Mounts a resource mid-session. Only file resources are accepted after creation.
@spec archive(Req.Request.t(), String.t()) :: Claudio.ManagedAgents.result()
Archives a session (keeps history, blocks new events). Not allowed while running.
@spec create(Req.Request.t(), map()) :: Claudio.ManagedAgents.result()
Creates a session. agent (an id, or %{type: "agent", id: …, version: …}) and
environment_id are required by the API.
@spec delete(Req.Request.t(), String.t()) :: Claudio.ManagedAgents.result()
Deletes a session permanently. Not allowed while running.
@spec delete_resource(Req.Request.t(), String.t(), String.t()) :: Claudio.ManagedAgents.result()
Removes a resource from a session.
@spec get(Req.Request.t(), String.t()) :: Claudio.ManagedAgents.result()
Retrieves a session (status, resolved agent snapshot, usage, stats).
@spec get_resource(Req.Request.t(), String.t(), String.t()) :: Claudio.ManagedAgents.result()
Retrieves one session resource.
@spec list( Req.Request.t(), keyword() ) :: Claudio.ManagedAgents.result()
Lists sessions. Options include statuses: [...], created_at: [gte: …], agent_id,
agent_version, deployment_id, memory_store_id, include_archived, order, limit,
page.
@spec list_events(Req.Request.t(), String.t(), keyword()) :: Claudio.ManagedAgents.result()
Lists a session's events. Options: types: [...], created_at: [...], order, limit,
page.
@spec list_resources(Req.Request.t(), String.t(), keyword()) :: Claudio.ManagedAgents.result()
Lists a session's resources.
@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}.
@spec update(Req.Request.t(), String.t(), map()) :: Claudio.ManagedAgents.result()
Updates a session: title, metadata, budget, and (while idle) agent.tools /
agent.mcp_servers.
@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.