Class: Anthropic::Resources::Beta::Sessions
- Inherits:
-
Object
- Object
- Anthropic::Resources::Beta::Sessions
- Defined in:
- lib/anthropic/resources/beta/sessions.rb,
lib/anthropic/resources/beta/sessions/events.rb,
lib/anthropic/resources/beta/sessions/threads.rb,
lib/anthropic/resources/beta/sessions/resources.rb,
lib/anthropic/resources/beta/sessions/threads/events.rb,
sig/anthropic/resources/beta/sessions.rbs,
sig/anthropic/resources/beta/sessions/events.rbs,
sig/anthropic/resources/beta/sessions/threads.rbs,
sig/anthropic/resources/beta/sessions/resources.rbs,
sig/anthropic/resources/beta/sessions/threads/events.rbs
Defined Under Namespace
Classes: Events, Resources, Threads
Instance Attribute Summary collapse
- #events ⇒ Anthropic::Resources::Beta::Sessions::Events readonly
- #resources ⇒ Anthropic::Resources::Beta::Sessions::Resources readonly
- #threads ⇒ Anthropic::Resources::Beta::Sessions::Threads readonly
Instance Method Summary collapse
-
#archive(session_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsSession
Archive Session.
-
#create(agent:, environment_id:, budget: nil, initial_events: nil, metadata: nil, resources: nil, title: nil, vault_ids: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsSession
Create Session.
-
#delete(session_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsDeletedSession
Delete Session.
-
#initialize(client:) ⇒ Sessions
constructor
private
A new instance of Sessions.
-
#list(agent_id: nil, agent_version: nil, created_at_gt: nil, created_at_gte: nil, created_at_lt: nil, created_at_lte: nil, deployment_id: nil, include_archived: nil, limit: nil, memory_store_id: nil, order: nil, page: nil, statuses: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Internal::BidirectionalPageCursor<Anthropic::Models::Beta::BetaManagedAgentsSession>
List Sessions.
-
#retrieve(session_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsSession
Get Session.
-
#update(session_id, agent: nil, budget: nil, metadata: nil, title: nil, vault_ids: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsSession
Update Session.
Constructor Details
#initialize(client:) ⇒ Sessions
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Sessions.
272 273 274 275 276 277 |
# File 'lib/anthropic/resources/beta/sessions.rb', line 272 def initialize(client:) @client = client @events = Anthropic::Resources::Beta::Sessions::Events.new(client: client) @resources = Anthropic::Resources::Beta::Sessions::Resources.new(client: client) @threads = Anthropic::Resources::Beta::Sessions::Threads.new(client: client) end |
Instance Attribute Details
#events ⇒ Anthropic::Resources::Beta::Sessions::Events (readonly)
8 9 10 |
# File 'lib/anthropic/resources/beta/sessions.rb', line 8 def events @events end |
#resources ⇒ Anthropic::Resources::Beta::Sessions::Resources (readonly)
11 12 13 |
# File 'lib/anthropic/resources/beta/sessions.rb', line 11 def resources @resources end |
#threads ⇒ Anthropic::Resources::Beta::Sessions::Threads (readonly)
14 15 16 |
# File 'lib/anthropic/resources/beta/sessions.rb', line 14 def threads @threads end |
Instance Method Details
#archive(session_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsSession
Archive Session
Some parameter documentations has been truncated, see Models::Beta::SessionArchiveParams for more details.
258 259 260 261 262 263 264 265 266 267 |
# File 'lib/anthropic/resources/beta/sessions.rb', line 258 def archive(session_id, params = {}) parsed, = Anthropic::Beta::SessionArchiveParams.dump_request(params) @client.request( method: :post, path: ["v1/sessions/%1$s/archive?beta=true", session_id], headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"), model: Anthropic::Beta::BetaManagedAgentsSession, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |
#create(agent:, environment_id:, budget: nil, initial_events: nil, metadata: nil, resources: nil, title: nil, vault_ids: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsSession
Create Session
Some parameter documentations has been truncated, see Models::Beta::SessionCreateParams for more details.
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/anthropic/resources/beta/sessions.rb', line 48 def create(params) parsed, = Anthropic::Beta::SessionCreateParams.dump_request(params) header_params = {betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"} @client.request( method: :post, path: "v1/sessions?beta=true", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Beta::BetaManagedAgentsSession, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |
#delete(session_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsDeletedSession
Delete Session
Some parameter documentations has been truncated, see Models::Beta::SessionDeleteParams for more details.
229 230 231 232 233 234 235 236 237 238 |
# File 'lib/anthropic/resources/beta/sessions.rb', line 229 def delete(session_id, params = {}) parsed, = Anthropic::Beta::SessionDeleteParams.dump_request(params) @client.request( method: :delete, path: ["v1/sessions/%1$s?beta=true", session_id], headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"), model: Anthropic::Beta::BetaManagedAgentsDeletedSession, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |
#list(agent_id: nil, agent_version: nil, created_at_gt: nil, created_at_gte: nil, created_at_lt: nil, created_at_lte: nil, deployment_id: nil, include_archived: nil, limit: nil, memory_store_id: nil, order: nil, page: nil, statuses: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Internal::BidirectionalPageCursor<Anthropic::Models::Beta::BetaManagedAgentsSession>
List Sessions
Some parameter documentations has been truncated, see Models::Beta::SessionListParams for more details.
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/anthropic/resources/beta/sessions.rb', line 173 def list(params = {}) query_params = [ :agent_id, :agent_version, :created_at_gt, :created_at_gte, :created_at_lt, :created_at_lte, :deployment_id, :include_archived, :limit, :memory_store_id, :order, :page, :statuses ] parsed, = Anthropic::Beta::SessionListParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: "v1/sessions?beta=true", query: query.transform_keys( created_at_gt: "created_at[gt]", created_at_gte: "created_at[gte]", created_at_lt: "created_at[lt]", created_at_lte: "created_at[lte]" ), headers: parsed.except(*query_params).transform_keys( betas: "anthropic-beta", workspace_id: "anthropic-workspace-id" ), page: Anthropic::Internal::BidirectionalPageCursor, model: Anthropic::Beta::BetaManagedAgentsSession, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |
#retrieve(session_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsSession
Get Session
Some parameter documentations has been truncated, see Models::Beta::SessionRetrieveParams for more details.
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/anthropic/resources/beta/sessions.rb', line 79 def retrieve(session_id, params = {}) parsed, = Anthropic::Beta::SessionRetrieveParams.dump_request(params) @client.request( method: :get, path: ["v1/sessions/%1$s?beta=true", session_id], headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"), model: Anthropic::Beta::BetaManagedAgentsSession, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |
#update(session_id, agent: nil, budget: nil, metadata: nil, title: nil, vault_ids: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsSession
Update Session
Some parameter documentations has been truncated, see Models::Beta::SessionUpdateParams for more details.
118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/anthropic/resources/beta/sessions.rb', line 118 def update(session_id, params = {}) parsed, = Anthropic::Beta::SessionUpdateParams.dump_request(params) header_params = {betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"} @client.request( method: :post, path: ["v1/sessions/%1$s?beta=true", session_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Beta::BetaManagedAgentsSession, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |