The whole hunk
from line 1, old and new numbered
/
lines
from line 1
1---
2title: Work
3url: https://platform.claude.com/docs/en/api/beta/environments/work
4---
5
16# Work
27
38## Get Work Item
from line 27
2227
2328 - `string`
2429
25 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 41 more`
30 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 42 more`
2631
2732 - `"message-batches-2024-09-24"`
2833
from line 75
7075
7176 - `"user-profiles-2026-08-18"`
7277
78 - `"user-profiles-2026-09-04"`
79
7380 - `"advisor-tool-2026-03-01"`
7481
7582 - `"managed-agents-2026-04-01"`
from line 119
112119
113120 - `"mid-conversation-system-clear-at-2026-08-21"`
114121
122- `"anthropic-workspace-id": optional string`
123
115124### Returns
116125
117126- `BetaSelfHostedWork object`
from line 131
122131 receive new messages. The environment worker polls for work to execute in a
123132 self-hosted sandbox.
124133
134 - `type: "work"`
135
136 The type of object (always 'work')
137
138 default: work
139
125140 - `id: string`
126141
127142 Work identifier (e.g., 'work_...')
from line 153
138153
139154 The actual work to be performed
140155
141 - `id: string`
142
143 Session identifier (e.g., 'session_...')
144
145156 - `type: "session"`
146157
147158 Type of work data
148159
160 - `id: string`
161
162 Session identifier (e.g., 'session_...')
163
149164 - `environment_id: string`
150165
151166 Environment identifier this work belongs to (e.g., `env_...`)
from line 203
188203
189204 RFC 3339 timestamp when work execution stopped
190205
191 - `type: "work"`
192
193 The type of object (always 'work')
194
195 default: work
196
197206### Example
198207
199208```bash
from line 271
262271
263272 - `string`
264273
265 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 41 more`
274 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 42 more`
266275
267276 - `"message-batches-2024-09-24"`
268277
from line 319
310319
311320 - `"user-profiles-2026-08-18"`
312321
322 - `"user-profiles-2026-09-04"`
323
313324 - `"advisor-tool-2026-03-01"`
314325
315326 - `"managed-agents-2026-04-01"`
from line 377
366377 receive new messages. The environment worker polls for work to execute in a
367378 self-hosted sandbox.
368379
380 - `type: "work"`
381
382 The type of object (always 'work')
383
384 default: work
385
369386 - `id: string`
370387
371388 Work identifier (e.g., 'work_...')
from line 399
382399
383400 The actual work to be performed
384401
385 - `id: string`
386
387 Session identifier (e.g., 'session_...')
388
389402 - `type: "session"`
390403
391404 Type of work data
392405
406 - `id: string`
407
408 Session identifier (e.g., 'session_...')
409
393410 - `environment_id: string`
394411
395412 Environment identifier this work belongs to (e.g., `env_...`)
from line 449
432449
433450 RFC 3339 timestamp when work execution stopped
434451
435 - `type: "work"`
436
437 The type of object (always 'work')
438
439 default: work
440
441452### Example
442453
443454```bash
from line 505
494505
495506 - `string`
496507
497 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 41 more`
508 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 42 more`
498509
499510 - `"message-batches-2024-09-24"`
500511
from line 553
542553
543554 - `"user-profiles-2026-08-18"`
544555
556 - `"user-profiles-2026-09-04"`
557
545558 - `"advisor-tool-2026-03-01"`
546559
547560 - `"managed-agents-2026-04-01"`
from line 607
594607 receive new messages. The environment worker polls for work to execute in a
595608 self-hosted sandbox.
596609
610 - `type: "work"`
611
612 The type of object (always 'work')
613
614 default: work
615
597616 - `id: string`
598617
599618 Work identifier (e.g., 'work_...')
from line 629
610629
611630 The actual work to be performed
612631
613 - `id: string`
614
615 Session identifier (e.g., 'session_...')
616
617632 - `type: "session"`
618633
619634 Type of work data
620635
636 - `id: string`
637
638 Session identifier (e.g., 'session_...')
639
621640 - `environment_id: string`
622641
623642 Environment identifier this work belongs to (e.g., `env_...`)
from line 679
660679
661680 RFC 3339 timestamp when work execution stopped
662681
663 - `type: "work"`
664
665 The type of object (always 'work')
666
667 default: work
668
669682### Example
670683
671684```bash
from line 746
733746
734747 - `string`
735748
736 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 41 more`
749 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 42 more`
737750
738751 - `"message-batches-2024-09-24"`
739752
from line 794
781794
782795 - `"user-profiles-2026-08-18"`
783796
797 - `"user-profiles-2026-09-04"`
798
784799 - `"advisor-tool-2026-03-01"`
785800
786801 - `"managed-agents-2026-04-01"`
from line 844
829844
830845 Response after recording a heartbeat for a work item.
831846
847 - `type: "work_heartbeat"`
848
849 The type of response
850
851 default: work_heartbeat
852
832853 - `last_heartbeat: string`
833854
834855 RFC 3339 timestamp of the actual heartbeat from DB
from line 876
855876
856877 Effective TTL applied to the lease
857878
858 - `type: "work_heartbeat"`
859
860 The type of response
861
862 default: work_heartbeat
863
864879### Example
865880
866881```bash
from line 920
905920
906921 - `string`
907922
908 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 41 more`
923 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 42 more`
909924
910925 - `"message-batches-2024-09-24"`
911926
from line 968
953968
954969 - `"user-profiles-2026-08-18"`
955970
971 - `"user-profiles-2026-09-04"`
972
956973 - `"advisor-tool-2026-03-01"`
957974
958975 - `"managed-agents-2026-04-01"`
from line 1012
9951012
9961013 - `"mid-conversation-system-clear-at-2026-08-21"`
9971014
1015- `"anthropic-workspace-id": optional string`
1016
9981017### Body parameters
9991018
10001019- `force: optional boolean`
from line 1032
10131032 receive new messages. The environment worker polls for work to execute in a
10141033 self-hosted sandbox.
10151034
1035 - `type: "work"`
1036
1037 The type of object (always 'work')
1038
1039 default: work
1040
10161041 - `id: string`
10171042
10181043 Work identifier (e.g., 'work_...')
from line 1054
10291054
10301055 The actual work to be performed
10311056
1032 - `id: string`
1033
1034 Session identifier (e.g., 'session_...')
1035
10361057 - `type: "session"`
10371058
10381059 Type of work data
10391060
1061 - `id: string`
1062
1063 Session identifier (e.g., 'session_...')
1064
10401065 - `environment_id: string`
10411066
10421067 Environment identifier this work belongs to (e.g., `env_...`)
from line 1104
10791104
10801105 RFC 3339 timestamp when work execution stopped
10811106
1082 - `type: "work"`
1083
1084 The type of object (always 'work')
1085
1086 default: work
1087
10881107### Example
10891108
10901109```bash
from line 1172
11531172
11541173 - `string`
11551174
1156 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 41 more`
1175 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 42 more`
11571176
11581177 - `"message-batches-2024-09-24"`
11591178
from line 1220
12011220
12021221 - `"user-profiles-2026-08-18"`
12031222
1223 - `"user-profiles-2026-09-04"`
1224
12041225 - `"advisor-tool-2026-03-01"`
12051226
12061227 - `"managed-agents-2026-04-01"`
from line 1274
12531274
12541275 List of work items
12551276
1277 - `type: "work"`
1278
1279 The type of object (always 'work')
1280
1281 default: work
1282
12561283 - `id: string`
12571284
12581285 Work identifier (e.g., 'work_...')
from line 1296
12691296
12701297 The actual work to be performed
12711298
1272 - `id: string`
1273
1274 Session identifier (e.g., 'session_...')
1275
12761299 - `type: "session"`
12771300
12781301 Type of work data
12791302
1303 - `id: string`
1304
1305 Session identifier (e.g., 'session_...')
1306
12801307 - `environment_id: string`
12811308
12821309 Environment identifier this work belongs to (e.g., `env_...`)
from line 1346
13191346
13201347 RFC 3339 timestamp when work execution stopped
13211348
1322 - `type: "work"`
1323
1324 The type of object (always 'work')
1325
1326 default: work
1327
13281349 - `next_page: string or null`
13291350
13301351 Opaque cursor for fetching the next page of results
from line 1411
13901411
13911412 - `string`
13921413
1393 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 41 more`
1414 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 42 more`
13941415
13951416 - `"message-batches-2024-09-24"`
13961417
from line 1459
14381459
14391460 - `"user-profiles-2026-08-18"`
14401461
1462 - `"user-profiles-2026-09-04"`
1463
14411464 - `"advisor-tool-2026-03-01"`
14421465
14431466 - `"managed-agents-2026-04-01"`
from line 1503
14801503
14811504 - `"mid-conversation-system-clear-at-2026-08-21"`
14821505
1506- `"anthropic-workspace-id": optional string`
1507
14831508### Body parameters
14841509
14851510- `metadata: map[string]`
from line 1521
14961521 receive new messages. The environment worker polls for work to execute in a
14971522 self-hosted sandbox.
14981523
1524 - `type: "work"`
1525
1526 The type of object (always 'work')
1527
1528 default: work
1529
14991530 - `id: string`
15001531
15011532 Work identifier (e.g., 'work_...')
from line 1543
15121543
15131544 The actual work to be performed
15141545
1515 - `id: string`
1516
1517 Session identifier (e.g., 'session_...')
1518
15191546 - `type: "session"`
15201547
15211548 Type of work data
15221549
1550 - `id: string`
1551
1552 Session identifier (e.g., 'session_...')
1553
15231554 - `environment_id: string`
15241555
15251556 Environment identifier this work belongs to (e.g., `env_...`)
from line 1593
15621593
15631594 RFC 3339 timestamp when work execution stopped
15641595
1565 - `type: "work"`
1566
1567 The type of object (always 'work')
1568
1569 default: work
1570
15711596### Example
15721597
15731598```bash
from line 1651
16261651
16271652 - `string`
16281653
1629 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 41 more`
1654 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 42 more`
16301655
16311656 - `"message-batches-2024-09-24"`
16321657
from line 1699
16741699
16751700 - `"user-profiles-2026-08-18"`
16761701
1702 - `"user-profiles-2026-09-04"`
1703
16771704 - `"advisor-tool-2026-03-01"`
16781705
16791706 - `"managed-agents-2026-04-01"`
from line 1743
17161743
17171744 - `"mid-conversation-system-clear-at-2026-08-21"`
17181745
1746- `"anthropic-workspace-id": optional string`
1747
17191748### Returns
17201749
17211750- `BetaSelfHostedWorkQueueStats object`
from line 1753
17241753
17251754 Uses Redis Stream consumer group metrics for O(1) queries.
17261755
1756 - `type: "work_queue_stats"`
1757
1758 The type of object
1759
1760 default: work_queue_stats
1761
17271762 - `depth: number`
17281763
17291764 Number of work items waiting to be picked up (lag from consumer group)
from line 1773
17381773
17391774 default: 0
17401775
1741 - `type: "work_queue_stats"`
1742
1743 The type of object
1744
1745 default: work_queue_stats
1746
17471776 - `workers_polling: number or null`
17481777
17491778 Number of workers that have polled for work in the last 30 seconds. Requires worker_id to be sent with poll requests.
from line 1810
17811810 receive new messages. The environment worker polls for work to execute in a
17821811 self-hosted sandbox.
17831812
1813 - `type: "work"`
1814
1815 The type of object (always 'work')
1816
1817 default: work
1818
17841819 - `id: string`
17851820
17861821 Work identifier (e.g., 'work_...')
from line 1832
17971832
17981833 The actual work to be performed
17991834
1800 - `id: string`
1801
1802 Session identifier (e.g., 'session_...')
1803
18041835 - `type: "session"`
18051836
18061837 Type of work data
18071838
1839 - `id: string`
1840
1841 Session identifier (e.g., 'session_...')
1842
18081843 - `environment_id: string`
18091844
18101845 Environment identifier this work belongs to (e.g., `env_...`)
from line 1882
18471882
18481883 RFC 3339 timestamp when work execution stopped
18491884
1850 - `type: "work"`
1851
1852 The type of object (always 'work')
1853
1854 default: work
1855
18561885### Beta Self Hosted Work Heartbeat Response
18571886
18581887- `BetaSelfHostedWorkHeartbeatResponse object`
from line 1888
18591888
18601889 Response after recording a heartbeat for a work item.
18611890
1891 - `type: "work_heartbeat"`
1892
1893 The type of response
1894
1895 default: work_heartbeat
1896
18621897 - `last_heartbeat: string`
18631898
18641899 RFC 3339 timestamp of the actual heartbeat from DB
from line 1920
18851920
18861921 Effective TTL applied to the lease
18871922
1888 - `type: "work_heartbeat"`
1889
1890 The type of response
1891
1892 default: work_heartbeat
1893
18941923### Beta Self Hosted Work List Response
18951924
18961925- `BetaSelfHostedWorkListResponse object`
from line 1930
19011930
19021931 List of work items
19031932
1933 - `type: "work"`
1934
1935 The type of object (always 'work')
1936
1937 default: work
1938
19041939 - `id: string`
19051940
19061941 Work identifier (e.g., 'work_...')
from line 1952
19171952
19181953 The actual work to be performed
19191954
1920 - `id: string`
1921
1922 Session identifier (e.g., 'session_...')
1923
19241955 - `type: "session"`
19251956
19261957 Type of work data
19271958
1959 - `id: string`
1960
1961 Session identifier (e.g., 'session_...')
1962
19281963 - `environment_id: string`
19291964
19301965 Environment identifier this work belongs to (e.g., `env_...`)
from line 2002
19672002
19682003 RFC 3339 timestamp when work execution stopped
19692004
1970 - `type: "work"`
1971
1972 The type of object (always 'work')
1973
1974 default: work
1975
19762005 - `next_page: string or null`
19772006
19782007 Opaque cursor for fetching the next page of results
from line 2014
19852014
19862015 Uses Redis Stream consumer group metrics for O(1) queries.
19872016
2017 - `type: "work_queue_stats"`
2018
2019 The type of object
2020
2021 default: work_queue_stats
2022
19882023 - `depth: number`
19892024
19902025 Number of work items waiting to be picked up (lag from consumer group)
from line 2034
19992034
20002035 default: 0
20012036
2002 - `type: "work_queue_stats"`
2003
2004 The type of object
2005
2006 default: work_queue_stats
2007
20082037 - `workers_polling: number or null`
20092038
20102039 Number of workers that have polled for work in the last 30 seconds. Requires worker_id to be sent with poll requests.
from line 2069
20402069 This resource type is used when work represents a session that needs to be executed
20412070 in a self-hosted environment.
20422071
2043 - `id: string`
2044
2045 Session identifier (e.g., 'session_...')
2046
20472072 - `type: "session"`
20482073
20492074 Type of work data
2075
2076 - `id: string`
2077
2078 Session identifier (e.g., 'session_...')
20502079