Class: Anthropic::Resources::Beta::Environments::Work
- Inherits:
-
Object
- Object
- Anthropic::Resources::Beta::Environments::Work
- Defined in:
- lib/anthropic/resources/beta/environments/work.rb,
sig/anthropic/resources/beta/environments/work.rbs
Instance Method Summary collapse
-
#ack(work_id, environment_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWork
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments.
-
#heartbeat(work_id, environment_id:, desired_ttl_seconds: nil, expected_last_heartbeat: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWorkHeartbeatResponse
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments.
-
#initialize(client:) ⇒ Work
constructor
private
A new instance of Work.
-
#list(environment_id, limit: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Environments::BetaSelfHostedWork>
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments.
-
#poll(environment_id, block_ms: nil, reclaim_older_than_ms: nil, betas: nil, anthropic_worker_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWork?
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments.
-
#retrieve(work_id, environment_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWork
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments.
-
#stats(environment_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWorkQueueStats
Get statistics about the work queue for an environment.
-
#stop(work_id, environment_id:, force: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWork
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments.
-
#update(work_id, environment_id:, metadata:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWork
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments.
Constructor Details
#initialize(client:) ⇒ Work
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 Work.
313 314 315 |
# File 'lib/anthropic/resources/beta/environments/work.rb', line 313 def initialize(client:) @client = client end |
Instance Method Details
#ack(work_id, environment_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWork
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.
Acknowledge receipt of a work item, transitioning it from 'queued' to 'starting' and removing it from the queue.
143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/anthropic/resources/beta/environments/work.rb', line 143 def ack(work_id, params) parsed, = Anthropic::Beta::Environments::WorkAckParams.dump_request(params) environment_id = parsed.delete(:environment_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["v1/environments/%1$s/work/%2$s/ack?beta=true", environment_id, work_id], headers: parsed.transform_keys(betas: "anthropic-beta"), model: Anthropic::Beta::Environments::BetaSelfHostedWork, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |
#heartbeat(work_id, environment_id:, desired_ttl_seconds: nil, expected_last_heartbeat: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWorkHeartbeatResponse
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.
Record a heartbeat for a work item to maintain the lease.
Some parameter documentations has been truncated, see Models::Beta::Environments::WorkHeartbeatParams for more details.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/anthropic/resources/beta/environments/work.rb', line 185 def heartbeat(work_id, params) query_params = [:desired_ttl_seconds, :expected_last_heartbeat] parsed, = Anthropic::Beta::Environments::WorkHeartbeatParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params)) environment_id = parsed.delete(:environment_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["v1/environments/%1$s/work/%2$s/heartbeat?beta=true", environment_id, work_id], query: query, headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"), model: Anthropic::Beta::Environments::BetaSelfHostedWorkHeartbeatResponse, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |
#list(environment_id, limit: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Environments::BetaSelfHostedWork>
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.
List work items in an environment.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/anthropic/resources/beta/environments/work.rb', line 107 def list(environment_id, params = {}) query_params = [:limit, :page] parsed, = Anthropic::Beta::Environments::WorkListParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: ["v1/environments/%1$s/work?beta=true", environment_id], query: query, headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"), page: Anthropic::Internal::PageCursor, model: Anthropic::Beta::Environments::BetaSelfHostedWork, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |
#poll(environment_id, block_ms: nil, reclaim_older_than_ms: nil, betas: nil, anthropic_worker_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWork?
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.
Long poll for work items in the queue.
Some parameter documentations has been truncated, see Models::Beta::Environments::WorkPollParams for more details.
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/anthropic/resources/beta/environments/work.rb', line 230 def poll(environment_id, params = {}) query_params = [:block_ms, :reclaim_older_than_ms] parsed, = Anthropic::Beta::Environments::WorkPollParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: ["v1/environments/%1$s/work/poll?beta=true", environment_id], query: query, headers: parsed.except(*query_params).transform_keys( betas: "anthropic-beta", anthropic_worker_id: "anthropic-worker-id" ), model: Anthropic::Beta::Environments::BetaSelfHostedWork, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |
#retrieve(work_id, environment_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWork
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.
Retrieve detailed information about a specific work item.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/anthropic/resources/beta/environments/work.rb', line 28 def retrieve(work_id, params) parsed, = Anthropic::Beta::Environments::WorkRetrieveParams.dump_request(params) environment_id = parsed.delete(:environment_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["v1/environments/%1$s/work/%2$s?beta=true", environment_id, work_id], headers: parsed.transform_keys(betas: "anthropic-beta"), model: Anthropic::Beta::Environments::BetaSelfHostedWork, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |
#stats(environment_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWorkQueueStats
Get statistics about the work queue for an environment.
260 261 262 263 264 265 266 267 268 269 |
# File 'lib/anthropic/resources/beta/environments/work.rb', line 260 def stats(environment_id, params = {}) parsed, = Anthropic::Beta::Environments::WorkStatsParams.dump_request(params) @client.request( method: :get, path: ["v1/environments/%1$s/work/stats?beta=true", environment_id], headers: parsed.transform_keys(betas: "anthropic-beta"), model: Anthropic::Beta::Environments::BetaSelfHostedWorkQueueStats, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |
#stop(work_id, environment_id:, force: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWork
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.
Stop a work item, initiating graceful or forced shutdown.
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/anthropic/resources/beta/environments/work.rb', line 293 def stop(work_id, params) parsed, = Anthropic::Beta::Environments::WorkStopParams.dump_request(params) environment_id = parsed.delete(:environment_id) do raise ArgumentError.new("missing required path argument #{_1}") end header_params = {betas: "anthropic-beta"} @client.request( method: :post, path: ["v1/environments/%1$s/work/%2$s/stop?beta=true", environment_id, work_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Beta::Environments::BetaSelfHostedWork, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |
#update(work_id, environment_id:, metadata:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Environments::BetaSelfHostedWork
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.
Update work item metadata with merge semantics.
Some parameter documentations has been truncated, see Models::Beta::Environments::WorkUpdateParams for more details.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/anthropic/resources/beta/environments/work.rb', line 68 def update(work_id, params) parsed, = Anthropic::Beta::Environments::WorkUpdateParams.dump_request(params) environment_id = parsed.delete(:environment_id) do raise ArgumentError.new("missing required path argument #{_1}") end header_params = {betas: "anthropic-beta"} @client.request( method: :post, path: ["v1/environments/%1$s/work/%2$s?beta=true", environment_id, work_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Beta::Environments::BetaSelfHostedWork, options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **} ) end |