+
    ~j~                       ^ RI Ht ^ RIt^ RIHtHtHtHtHt ^ RI	H
t
 ^ RIt]'       d   ^ RIHt ^RIHt ^RIHtHt ^RIHt ^R	IHtHtHtHtHtHtHt ^R
IHtHtH t H!t!H"t" ^RI#H$t$ ^RI%H&t&H't' ^RI(H)t)H*t* ^RI+H,t,H-t- ^RI.H/t/H0t0 ^RI1H2t2H3t3H4t4H5t5H6t6 ^RI7H8t8 ^RI9H:t: ^RI;H<t< ^RI=H>t> RR.t? ! R R]&4      t@ ! R R]'4      tA ! R R4      tB ! R R4      tC ! R R4      tD ! R R 4      tER# )!    )annotationsN)TYPE_CHECKINGDictListOptionalcast)chain)AsyncIterator)AsyncAnthropic)EnvironmentWorkerEnvironmentWorkerTools)_legacy_response)BodyOmitQueryHeadersNotGivenomit	not_given)is_givenpath_templatemaybe_transformstrip_not_givenasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncPageCursorAsyncPageCursor)AsyncPaginatormake_request_options)work_list_paramswork_poll_paramswork_stop_paramswork_update_paramswork_heartbeat_params)AnthropicBetaParam)BetaSelfHostedWork)BetaSelfHostedWorkQueueStats)#BetaSelfHostedWorkHeartbeatResponseWork	AsyncWorkc                     ] tR t^(t]R R l4       t]R R l4       tR]RRRRR	RR
]/R R llt	R]RRRRR	RR
]/R R llt
R]R]R]RRRRR	RR
]/R R lltR]RRRRR	RR
]/R R lltR]R]R]RRRRR	RR
]/R R lltR]R]R]R]RRRRR	RR
]/R R lltR]RRRRR	RR
]/R R lltR ]R]RRRRR	RR
]/R! R" lltR#tR# )$r-   c                   V ^8  d   QhRR/# )   returnWorkWithRawResponse )formats   "/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/anthropic/resources/beta/environments/work.py__annotate__Work.__annotate__*   s     ) )#6 )    c                    \        V 4      # z
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
)r3   selfs   &r6   with_raw_responseWork.with_raw_response)   s     #4((r9   c                   V ^8  d   QhRR/# )r1   r2   WorkWithStreamingResponser4   )r5   s   "r6   r7   r8   4   s     / /)B /r9   c                    \        V 4      # z
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
)rA   r<   s   &r6   with_streaming_responseWork.with_streaming_response3   s     )..r9   betasextra_headersNextra_query
extra_bodytimeoutc               8    V ^8  d   QhRRRRRRRRRR	R
RRRRR/# r1   work_idstrenvironment_idrF   List[AnthropicBetaParam] | OmitrG   Headers | NonerH   Query | NonerI   Body | NonerJ   'float | httpx.Timeout | None | NotGivenr2   r*   r4   )r5   s   "r6   r7   r8   <   Z     9
 9
9
 	9

 /9
 &9
 "9
  9
 99
 
9
r9   c          
        V'       g   \        RV: 24      hV'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpV P                  \        RVVR7      \        WEWgR	7      \        R
7      # )  
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.

Args:
  betas: Optional header to specify the beta version(s) you want to use.

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
=Expected a non-empty value for `environment_id` but received 6Expected a non-empty value for `work_id` but received anthropic-beta,c              3  8   "   T F  p\        V4      x  K  	  R # 5iNrN   .0es   & r6   	<genexpr> Work.retrieve.<locals>.<genexpr>c        5Lec!ffe   managed-agents-2026-04-01:/v1/environments/{environment_id}/work/{work_id}?beta=truerO   rM   rG   rH   rI   rJ   optionscast_to

ValueErrorr   r   joinr	   r   _getr   r#   r*   r=   rM   rO   rF   rG   rH   rI   rJ   s   &&$$$$$$r6   retrieveWork.retrieve<   s    @ \]k\noppUV]U`abb	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`yyL-
 )+Q[ '  

 
	
r9   c               <    V ^8  d   QhRRRRRRRRRR	R
RRRRRRR/	# r1   rM   rN   rO   metadatazDict[str, Optional[str]]rF   rP   rG   rQ   rH   rR   rI   rS   rJ   rT   r2   r*   r4   )r5   s   "r6   r7   r8   w   d     >
 >
>
 	>

 +>
 />
 &>
 ">
  >
 9>
 
>
r9   c                  V'       g   \        RV: 24      hV'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpV P                  \        RVVR7      \        R	V/\        P                  4      \        WVWxR
7      \        R7      # )  
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.

Args:
  metadata: Metadata patch. Set a key to a string to upsert it, or to null to delete it.
      Omit the field to preserve existing metadata.

  betas: Optional header to specify the beta version(s) you want to use.

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
rX   rY   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   Work.update.<locals>.<genexpr>   rd   re   rf   rg   rh   rv   ri   bodyrk   rl   )rn   r   r   ro   r	   r   _postr   r   r'   WorkUpdateParamsr#   r*   	r=   rM   rO   rv   rF   rG   rH   rI   rJ   s	   &&$$$$$$$r6   updateWork.updatew   s    H \]k\noppUV]U`abb	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`zzL-
 !*h!79K9\9\](+Q[ '  
 	
r9   limitpagec               <    V ^8  d   QhRRRRRRRRR	R
RRRRRRRR/	# )r1   rO   rN   r   
int | Omitr   Optional[str] | OmitrF   rP   rG   rQ   rH   rR   rI   rS   rJ   rT   r2   z"SyncPageCursor[BetaSelfHostedWork]r4   )r5   s   "r6   r7   r8      so     C
 C
C
 	C

 #C
 /C
 &C
 "C
  C
 9C
 
,C
r9   c                  V'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpV P                  \        RVR7      \        \        ,          \        VVVV\        RVR	V/\        P                  4      R
7      \        R7      # )  
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.

Args:
  limit: Maximum number of work items to return

  page: Opaque cursor from previous response for pagination

  betas: Optional header to specify the beta version(s) you want to use.

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
rX   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   Work.list.<locals>.<genexpr>   rd   re   rf   0/v1/environments/{environment_id}/work?beta=truerO   r   r   rG   rH   rI   rJ   queryr   rk   model)rn   r   r   ro   r	   r   _get_api_listr   r    r*   r#   r   r$   WorkListParams	r=   rO   r   r   rF   rG   rH   rI   rJ   s	   &&$$$$$$$r6   list	Work.list   s    J \]k\nopp	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`!!L]kl 23(+'%% %33 %! " 
 	
r9   c               8    V ^8  d   QhRRRRRRRRRR	R
RRRRR/# rL   r4   )r5   s   "r6   r7   r8      Z     :
 :
:
 	:

 /:
 &:
 ":
  :
 9:
 
:
r9   c          
        V'       g   \        RV: 24      hV'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpV P                  \        RVVR7      \        WEWgR	7      \        R
7      # )  
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.

Args:
  betas: Optional header to specify the beta version(s) you want to use.

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
rX   rY   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   Work.ack.<locals>.<genexpr>$  rd   re   rf   >/v1/environments/{environment_id}/work/{work_id}/ack?beta=truerh   ri   rj   
rn   r   r   ro   r	   r   r~   r   r#   r*   rq   s   &&$$$$$$r6   ackWork.ack   s    B \]k\noppUV]U`abb	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`zzP-
 )+Q[ '  

 
	
r9   desired_ttl_secondsexpected_last_heartbeatc               @    V ^8  d   QhRRRRRRRRRR	R
RRRRRRRRR/
# r1   rM   rN   rO   r   Optional[int] | Omitr   r   rF   rP   rG   rQ   rH   rR   rI   rS   rJ   rT   r2   r,   r4   )r5   s   "r6   r7   r8   8  z     L
 L
L
 	L

 2L
 "6L
 /L
 &L
 "L
  L
 9L
 
-L
r9   c                  V'       g   \        RV: 24      hV'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpV P                  \        RVVR7      \        VVVV	\        R	VR
V/\        P                  4      R7      \        R7      # )
  
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.

Args:
  desired_ttl_seconds: Desired TTL in seconds

  expected_last_heartbeat: Expected last_heartbeat for conditional update (optimistic concurrency). Use
      literal 'NO_HEARTBEAT' to claim an unclaimed lease (first heartbeat). For
      subsequent heartbeats, echo the server's previous last_heartbeat value exactly.
      Returns 412 Precondition Failed if the actual value doesn't match.

  betas: Optional header to specify the beta version(s) you want to use.

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
rX   rY   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   !Work.heartbeat.<locals>.<genexpr>h  rd   re   rf   D/v1/environments/{environment_id}/work/{work_id}/heartbeat?beta=truerh   r   r   r   rj   )rn   r   r   ro   r	   r   r~   r   r#   r   r(   WorkHeartbeatParamsr,   
r=   rM   rO   r   r   rF   rG   rH   rI   rJ   s
   &&$$$$$$$$r6   	heartbeatWork.heartbeat8  s   R \]k\noppUV]U`abb	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`zzV-
 )+'%%-/B13J *== 8'  
 	
r9   block_msreclaim_older_than_msanthropic_worker_idc               @    V ^8  d   QhRRRRRRRRRR	R
RRRRRRRRR/
# r1   rO   rN   r   r   r   rF   rP   r   z
str | OmitrG   rQ   rH   rR   rI   rS   rJ   rT   r2   zOptional[BetaSelfHostedWork]r4   )r5   s   "r6   r7   r8     z     J
 J
J
 '	J

  4J
 /J
 (J
 &J
 "J
  J
 9J
 
&J
r9   c                  V'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        RV/4      CT;'       g    / CpRR/T;'       g    / CpV P                  \        RVR7      \        VVVV	\        R	VR
V/\        P                  4      R7      \        R7      # )F  
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.

Args:
  block_ms: How long to wait for work to arrive before returning. Must be 1-999 in
      milliseconds. Defaults to non-blocking (returns immediately if no work is
      available).

  reclaim_older_than_ms: Reclaim unacknowledged work items older than this many milliseconds. If omitted,
      uses the default (5000ms).

  betas: Optional header to specify the beta version(s) you want to use.

  anthropic_worker_id: Unique identifier for the specific worker polling, used to track aggregated
      environment-level work metrics in Console

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
rX   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   Work.poll.<locals>.<genexpr>  rd   re   rf   Anthropic-Worker-ID5/v1/environments/{environment_id}/work/poll?beta=truer   r   r   r   rj   )rn   r   r   ro   r	   r   rp   r   r#   r   r%   WorkPollParamsr*   
r=   rO   r   r   rF   r   rG   rH   rI   rJ   s
   &&$$$$$$$$r6   poll	Work.poll  s    X \]k\nopp

$ '*hhu5Le5LOjNk/l&m")+>	

 ""

 *+F`=K^K^\^`yyQbpq(+'%%"H/1F %33 '  
 	
r9   c               4    V ^8  d   QhRRRRRRRRR	R
RRRR/# r1   rO   rN   rF   rP   rG   rQ   rH   rR   rI   rS   rJ   rT   r2   r+   r4   )r5   s   "r6   r7   r8     P     -
 -
-
 /	-
 &-
 "-
  -
 9-
 
&-
r9   c          
     R   V'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpV P                  \        RVR7      \        W4WVR7      \        R	7      # )
}  
Get statistics about the work queue for an environment.

Args:
  betas: Optional header to specify the beta version(s) you want to use.

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
rX   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   Work.stats.<locals>.<genexpr>  rd   re   rf   6/v1/environments/{environment_id}/work/stats?beta=truer   ri   rj   
rn   r   r   ro   r	   r   rp   r   r#   r+   r=   rO   rF   rG   rH   rI   rJ   s   &&$$$$$r6   stats
Work.stats  s    4 \]k\nopp	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`yyRcqr(+Q[ 1  
 	
r9   forcec               <    V ^8  d   QhRRRRRRRRRR	R
RRRRRRR/	# r1   rM   rN   rO   r   zbool | OmitrF   rP   rG   rQ   rH   rR   rI   rS   rJ   rT   r2   r*   r4   )r5   s   "r6   r7   r8     d     =
 =
=
 	=

 =
 /=
 &=
 "=
  =
 9=
 
=
r9   c                  V'       g   \        RV: 24      hV'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpV P                  \        RVVR7      \        R	V/\        P                  4      \        WVWxR
7      \        R7      # )  
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.

Args:
  force: If true, immediately stop work without graceful shutdown

  betas: Optional header to specify the beta version(s) you want to use.

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
rX   rY   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   Work.stop.<locals>.<genexpr>+  rd   re   rf   ?/v1/environments/{environment_id}/work/{work_id}/stop?beta=truerh   r   ri   r|   )rn   r   r   ro   r	   r   r~   r   r   r&   WorkStopParamsr#   r*   	r=   rM   rO   r   rF   rG   rH   rI   rJ   s	   &&$$$$$$$r6   stop	Work.stop  s    F \]k\noppUV]U`abb	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`zzQ-
 !'5!13C3R3RS(+Q[ '  
 	
r9   r4   )__name__
__module____qualname____firstlineno__r   r>   rD   r   r   rr   r   r   r   r   r   r   r   __static_attributes__r4   r9   r6   r-   r-   (   s]   ) ) / /9

 269
 )-9
 %)9
 #'9
 <E9
v>
 26>
 )->
 %)>
 #'>
 <E>
@C
 !	C

 &*C
 26C
 )-C
 %)C
 #'C
 <EC
J:

 26:
 )-:
 %):
 #':
 <E:
xL

 59L
 9=L
 26L
 )-L
 %)L
 #'L
 <EL
\J
 *.	J

 7;J
 26J
 +/J
 )-J
 %)J
 #'J
 <EJ
X-
 26	-
 )--
 %)-
 #'-
 <E-
^=

 "=
 26=
 )-=
 %)=
 #'=
 <E=
 =
r9   c                     ] tR tRt]R R l4       t]R R l4       tR]RRR	RR
RR]/R R llt	R]RRR	RR
RR]/R R llt
R]R]R]RRR	RR
RR]/R R lltR]RRR	RR
RR]/R R lltR]R]R]RRR	RR
RR]/R R lltR]R]R]R]RRR	RR
RR]/R R lltR]RRR	RR
RR]/R R  lltR!]R]RRR	RR
RR]/R" R# lltR$RR]RRR%R&R'R(RR/R) R* lltR+RR,RR-RR.RR/R&R0]R$RRR/R1 R2 lltR3tR# )4r.   iA  c                   V ^8  d   QhRR/# )r1   r2   AsyncWorkWithRawResponser4   )r5   s   "r6   r7   AsyncWork.__annotate__C  s     . .#; .r9   c                    \        V 4      # r;   )r   r<   s   &r6   r>   AsyncWork.with_raw_responseB  s     (--r9   c                   V ^8  d   QhRR/# )r1   r2   AsyncWorkWithStreamingResponser4   )r5   s   "r6   r7   r   M  s     4 4)G 4r9   c                    \        V 4      # rC   )r   r<   s   &r6   rD   !AsyncWork.with_streaming_responseL  s     .d33r9   rF   rG   NrH   rI   rJ   c               8    V ^8  d   QhRRRRRRRRRR	R
RRRRR/# rL   r4   )r5   s   "r6   r7   r   U  rU   r9   c          
       "   V'       g   \        RV: 24      hV'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpV P                  \        RVVR7      \        WEWgR	7      \        R
7      G Rj  xL
 #  L5i)rW   rX   rY   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   %AsyncWork.retrieve.<locals>.<genexpr>|  rd   re   rf   rg   rh   ri   rj   Nrm   rq   s   &&$$$$$$r6   rr   AsyncWork.retrieveU  s     @ \]k\noppUV]U`abb	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`YYL-
 )+Q[ '  

 

 
	
 

#   CAC C6CCCc               <    V ^8  d   QhRRRRRRRRRR	R
RRRRRRR/	# ru   r4   )r5   s   "r6   r7   r     rw   r9   c                 "   V'       g   \        RV: 24      hV'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpT P                  \        RVVR7      \        R	V/\        P                  4      G R
j  xL
 \        WVWxR7      \        R7      G R
j  xL
 #  L" L5i)ry   rX   rY   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   #AsyncWork.update.<locals>.<genexpr>  rd   re   rf   rg   rh   rv   Nri   r|   )rn   r   r   ro   r	   r   r~   r   r   r'   r   r#   r*   r   s	   &&$$$$$$$r6   r   AsyncWork.update  s    H \]k\noppUV]U`abb	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`ZZL-
 -j(-CEWEhEhii(+Q[ '   
 
 	
 j
5   C2AC2 C2;C2C.
C2)C0*C20C2r   r   c               <    V ^8  d   QhRRRRRRRRR	R
RRRRRRRR/	# )r1   rO   rN   r   r   r   r   rF   rP   rG   rQ   rH   rR   rI   rS   rJ   rT   r2   zGAsyncPaginator[BetaSelfHostedWork, AsyncPageCursor[BetaSelfHostedWork]]r4   )r5   s   "r6   r7   r     sp     C
 C
C
 	C

 #C
 /C
 &C
 "C
  C
 9C
 
QC
r9   c                  V'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpV P                  \        RVR7      \        \        ,          \        VVVV\        RVR	V/\        P                  4      R
7      \        R7      # )r   rX   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   !AsyncWork.list.<locals>.<genexpr>  rd   re   rf   r   r   r   r   r   r   )rn   r   r   ro   r	   r   r   r   r!   r*   r#   r   r$   r   r   s	   &&$$$$$$$r6   r   AsyncWork.list  s    J \]k\nopp	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`!!L]kl !34(+'%% %33 %! " 
 	
r9   c               8    V ^8  d   QhRRRRRRRRRR	R
RRRRR/# rL   r4   )r5   s   "r6   r7   r     r   r9   c          
       "   V'       g   \        RV: 24      hV'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpV P                  \        RVVR7      \        WEWgR	7      \        R
7      G Rj  xL
 #  L5i)r   rX   rY   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb    AsyncWork.ack.<locals>.<genexpr>=  rd   re   rf   r   rh   ri   rj   Nr   rq   s   &&$$$$$$r6   r   AsyncWork.ack  s     B \]k\noppUV]U`abb	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`ZZP-
 )+Q[ '   

 

 
	
 

r   r   r   c               @    V ^8  d   QhRRRRRRRRRR	R
RRRRRRRRR/
# r   r4   )r5   s   "r6   r7   r   Q  r   r9   c                 "   V'       g   \        RV: 24      hV'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpT P                  \        RVVR7      \        TTTT	\        R	VR
V/\        P                  4      G Rj  xL
 R7      \        R7      G Rj  xL
 #  L L5i)r   rX   rY   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   &AsyncWork.heartbeat.<locals>.<genexpr>  rd   re   rf   r   rh   r   r   Nr   rj   )rn   r   r   ro   r	   r   r~   r   r#   r   r(   r   r,   r   s
   &&$$$$$$$$r6   r   AsyncWork.heartbeatQ  s&    R \]k\noppUV]U`abb	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`ZZV-
 )+'%1-/B13J *==  8'   
 
 	

s6   C6AC6 C6AC6C2C6-C4.C64C6r   r   r   c               @    V ^8  d   QhRRRRRRRRRR	R
RRRRRRRRR/
# r   r4   )r5   s   "r6   r7   r     r   r9   c                 "   V'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        RV/4      CT;'       g    / CpRR/T;'       g    / CpT P                  \        RVR7      \        TTTT	\        R	VR
V/\        P                  4      G Rj  xL
 R7      \        R7      G Rj  xL
 #  L L5i)r   rX   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   !AsyncWork.poll.<locals>.<genexpr>  rd   re   rf   r   r   r   r   r   Nr   rj   )rn   r   r   ro   r	   r   rp   r   r#   r   r%   r   r*   r   s
   &&$$$$$$$$r6   r   AsyncWork.poll  s    X \]k\nopp

$ '*hhu5Le5LOjNk/l&m")+>	

 ""

 *+F`=K^K^\^`YYQbpq(+'%1"H/1F %33  '  
 
 	

s1   A(C +C ;AC  CC CC C c               4    V ^8  d   QhRRRRRRRRR	R
RRRR/# r   r4   )r5   s   "r6   r7   r     r   r9   c          
     n  "   V'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpV P                  \        RVR7      \        W4WVR7      \        R	7      G R
j  xL
 #  L5i)r   rX   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   "AsyncWork.stats.<locals>.<genexpr>
  rd   re   rf   r   r   ri   rj   Nr   r   s   &&$$$$$r6   r   AsyncWork.stats  s     4 \]k\nopp	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`YYRcqr(+Q[ 1  
 
 	
 
s   A&B5)B595B5.B3/B5r   c               <    V ^8  d   QhRRRRRRRRRR	R
RRRRRRR/	# r   r4   )r5   s   "r6   r7   r     r   r9   c                 "   V'       g   \        RV: 24      hV'       g   \        RV: 24      h/ \        R\        V4      '       d$   RP                  \	        R V 4       R.4      4      M\
        /4      CT;'       g    / CpRR/T;'       g    / CpT P                  \        RVVR7      \        R	V/\        P                  4      G R
j  xL
 \        WVWxR7      \        R7      G R
j  xL
 #  L" L5i)r   rX   rY   rZ   r[   c              3  8   "   T F  p\        V4      x  K  	  R # 5ir]   r^   r_   s   & r6   rb   !AsyncWork.stop.<locals>.<genexpr>D  rd   re   rf   r   rh   r   Nri   r|   )rn   r   r   ro   r	   r   r~   r   r   r&   r   r#   r*   r   s	   &&$$$$$$$r6   r   AsyncWork.stop  s    F \]k\noppUV]U`abb	
$ '*hhu5Le5LOjNk/l&m"	
 ""	
 *+F`=K^K^\^`ZZQ-
 -gu-=?O?^?^__(+Q[ '   
 
 	
 `
r   	worker_iddrainF	auto_stopTc               <    V ^8  d   QhRRRRRRRRRR	R
RRRRRRR/	# )r1   rO   rN   environment_keyr  
str | Noner   zint | None | NotGivenr   z
int | Noner  boolr  rG   rQ   r2   z!AsyncIterator[BetaSelfHostedWork]r4   )r5   s   "r6   r7   r   Y  sq     M
 M
 M
 	M

 M
 (M
  *M
 M
 M
 &M
 
+M
r9   c                   ^RI Hp	 ^RIHp
Hp \        V4      '       g   T
pV	! \        RV P                  4      VRR7      pV! VP                  P                  P                  VVVVVVVR7      # )u  Async-iterate work items claimed from a self-hosted environment.

Each yielded item has been ack'd. The environment key authenticates the
poll, ack, and stop calls via a scoped sub-client (built once per
call). Async only — available on :class:`~anthropic.AsyncAnthropic`
(the sync client does not expose ``poller``).

With the defaults this loops forever and calls ``stop`` after the
consuming ``async for`` body returns or raises (long-running runner
shape). Pass ``drain=True, auto_stop=False`` to drain whatever is queued
and return without owning the stop call (webhook-dispatch shape — each
item is handed off to another process that calls ``stop`` when done).

Args:
  environment_id: The self-hosted environment to claim work from.
  environment_key: The environment key — used as the Bearer credential
    on the scoped sub-client that issues poll / ack / stop requests.
  worker_id: Optional identifier sent on each poll. Defaults to a
    unique, hostname-prefixed id.
  block_ms: How long the server should hold an empty poll open before
    returning (long-poll). Server caps this at 999. Defaults to
    ``POLL_BLOCK_MS`` (999) when not given. Pass ``None`` to omit for a
    non-blocking poll — the server rejects ``0``.
  reclaim_older_than_ms: Reclaim un-ack'd work older than this many ms.
    Forwarded to the underlying poll request.
  drain: When True, return after the first empty poll instead of
    sleeping and re-polling.
  auto_stop: When True (default), call ``stop`` after the consumer's
    loop body completes. Set False when handing items off to another
    process that owns the stop call.
  extra_headers: Optional headers passed through per request on the
    poll / ack / stop calls. They are threaded into each call's
    ``extra_headers=`` and never assigned onto the client, so client
    state is not mutated. Auth and ``x-stainless-helper`` are supplied
    by the scoped sub-client built here (and the parent client's
    ``default_headers`` propagate via its ``client.copy()``); a header
    given here overrides the scoped client's same-named default for
    that request, so use it for caller passthrough (e.g. trace ids),
    not to set auth.
)_copy_client_with_bearer_auth)POLL_BLOCK_MS
aiter_workr   zenvironments-work-poller)
auth_tokenhelper)rO   r  r   r   r  r  rG   )lib._scoped_clientr  lib.environments._pollerr  r  r   r   _clientbetaenvironmentswork)r=   rO   r  r  r   r   r  r  rG   r  r  r  scopeds   &$$$$$$$$    r6   pollerAsyncWork.pollerY  sr    r 	IJ!!$H.!4<<0&-

 KK$$)))"7'	
 		
r9   rO   r  toolsworkdirunrestricted_pathsmax_idlec               <    V ^8  d   QhRRRRRRRRRR	R
RRRRRRR/	# )r1   rO   r  r  r(  zEnvironmentWorkerTools | Noner)  zstr | os.PathLike[str] | Noner*  r  r+  zfloat | None | NotGivenr  rG   rQ   r2   r   r4   )r5   s   "r6   r7   r     sq     L
 L
 #L
 $	L

 -L
 /L
 !L
 *L
 L
 &L
 
L
r9   c                   ^RI Hp	 ^RIHp
 \	        V4      '       g   T
pV	! \        RV P                  4      VVVVVVVVR7	      # )u
  Build an :class:`~anthropic.lib.environments.EnvironmentWorker` bound to this async client.

The full worker: it polls the environment for work, and for each claimed
session sets up the workdir + downloads the session agent's skills, runs
the given ``tools`` against the session's tool-call events while
heartbeating the work-item lease, force-stops the work on exit, and
loops. Composed from this resource's :meth:`poller` and the per-session
session tool runner.

``EnvironmentWorker`` is async only — its ``run`` / ``handle_item``
coroutines need an event loop. With this :class:`~anthropic.AsyncAnthropic`
client the returned worker is ready to ``await worker.run()`` (long-running
poll loop) or ``await worker.handle_item()`` (single already-claimed work
item). It can also be constructed directly:
``EnvironmentWorker(client, ...)``.

Args:
  environment_id: The self-hosted environment to poll for work. Required
    by ``EnvironmentWorker.run``; not used by
    ``EnvironmentWorker.handle_item``.
  environment_key: The environment key — the worker's single credential,
    used as Bearer auth on the control-plane and session-level calls.
  tools: Tools to expose to each claimed session. Either a fixed list or
    a factory invoked once per session with that session's
    ``AgentToolContext``. Defaults to ``beta_agent_toolset_20260401(env)``.
  workdir: Base directory for the per-session ``AgentToolContext``.
    Defaults to ``os.getcwd()`` captured when the worker is constructed
    (TS parity: ``process.cwd()`` at construction).
  unrestricted_paths: Forwarded to the per-session ``AgentToolContext``.
  max_idle: Seconds to keep running after the session goes idle with
    ``stop_reason`` ``end_turn``. Defaults to ``DEFAULT_MAX_IDLE`` (60s)
    when not given. ``None`` disables it.
  worker_id: Optional identifier sent on each poll. Defaults to a unique,
    hostname-prefixed id.
  extra_headers: Optional headers passed through per request on every
    call the worker makes (poll / ack / stop / heartbeat and the
    session tool runner's event stream / list / send). They are
    threaded into each call's ``extra_headers=`` and never assigned
    onto the client, so client state is not mutated. Auth and
    ``x-stainless-helper`` are supplied by the worker's scoped
    sub-clients (and the parent client's ``default_headers`` propagate
    via their ``client.copy()``); a header given here overrides a
    scoped client's same-named default for that request, so use it for
    caller passthrough (e.g. trace ids), not to set auth.
)r   )DEFAULT_MAX_IDLEr   )rO   r  r(  r)  r*  r+  r  rG   )lib.environments._workerr   lib.tools._beta_session_runnerr.  r   r   r!  )r=   rO   r  r(  r)  r*  r+  r  rG   r   r.  s   &$$$$$$$$  r6   workerAsyncWork.worker  sP    x 	CG!!'H !4<<0)+1'

 
	
r9   r4   )r   r   r   r   r   r>   rD   r   r   rr   r   r   r   r   r   r   r   r&  r1  r   r4   r9   r6   r.   r.   A  s   . . 4 49

 269
 )-9
 %)9
 #'9
 <E9
v>
 26>
 )->
 %)>
 #'>
 <E>
@C
 !	C

 &*C
 26C
 )-C
 %)C
 #'C
 <EC
J:

 26:
 )-:
 %):
 #':
 <E:
xL

 59L
 9=L
 26L
 )-L
 %)L
 #'L
 <EL
\J
 *.	J

 7;J
 26J
 +/J
 )-J
 %)J
 #'J
 <EJ
X-
 26	-
 )--
 %)-
 #'-
 <E-
^=

 "=
 26=
 )-=
 %)=
 #'=
 <E=
~M

 !%M
 +4M
 -1M
 M
 M
 )-M
^L
 &*L
 '+	L

 04L
 26L
 $)L
 -6L
 !%L
 )-L
 L
r9   c                  "    ] tR tRtR R ltRtR# )r3   i  c                    V ^8  d   QhRRRR/# r1   r$  r-   r2   Noner4   )r5   s   "r6   r7    WorkWithRawResponse.__annotate__       
 
T 
d 
r9   c                	b   Wn         \        P                  ! VP                  4      V n        \        P                  ! VP                  4      V n        \        P                  ! VP
                  4      V n        \        P                  ! VP                  4      V n        \        P                  ! VP                  4      V n        \        P                  ! VP                  4      V n        \        P                  ! VP                  4      V n	        \        P                  ! VP                  4      V n
        R # r]   )_workr   to_raw_response_wrapperrr   r   r   r   r   r   r   r   r=   r$  s   &&r6   __init__WorkWithRawResponse.__init__  s    
(@@MM
 '>>KK
 %<<II
	 $;;HH
 *AANN
 %<<II
	 &==JJ

 %<<II
	r9   	r:  r   r   r   r   rr   r   r   r   Nr   r   r   r   r=  r   r4   r9   r6   r3   r3         
 
r9   r3   c                  "    ] tR tRtR R ltRtR# )r   i  c                    V ^8  d   QhRRRR/# r1   r$  r.   r2   r6  r4   )r5   s   "r6   r7   %AsyncWorkWithRawResponse.__annotate__       
 
Y 
4 
r9   c                	b   Wn         \        P                  ! VP                  4      V n        \        P                  ! VP                  4      V n        \        P                  ! VP
                  4      V n        \        P                  ! VP                  4      V n        \        P                  ! VP                  4      V n        \        P                  ! VP                  4      V n        \        P                  ! VP                  4      V n	        \        P                  ! VP                  4      V n
        R # r]   )r:  r   async_to_raw_response_wrapperrr   r   r   r   r   r   r   r   r<  s   &&r6   r=  !AsyncWorkWithRawResponse.__init__  s    
(FFMM
 'DDKK
 %BBII
	 $AAHH
 *GGNN
 %BBII
	 &CCJJ

 %BBII
	r9   r?  Nr@  r4   r9   r6   r   r     rA  r9   r   c                  "    ] tR tRtR R ltRtR# )rA   i3  c                    V ^8  d   QhRRRR/# r5  r4   )r5   s   "r6   r7   &WorkWithStreamingResponse.__annotate__4  r8  r9   c                	   Wn         \        VP                  4      V n        \        VP                  4      V n        \        VP                  4      V n        \        VP
                  4      V n        \        VP                  4      V n        \        VP                  4      V n        \        VP                  4      V n        \        VP                  4      V n	        R # r]   )
r:  r   rr   r   r   r   r   r   r   r   r<  s   &&r6   r=  "WorkWithStreamingResponse.__init__4  s    
4MM
 3KK
 1II
	 0HH
 6NN
 1II
	 2JJ

 1II
	r9   r?  Nr@  r4   r9   r6   rA   rA   3  rA  r9   rA   c                  "    ] tR tRtR R ltRtR# )r   iQ  c                    V ^8  d   QhRRRR/# rD  r4   )r5   s   "r6   r7   +AsyncWorkWithStreamingResponse.__annotate__R  rF  r9   c                	   Wn         \        VP                  4      V n        \        VP                  4      V n        \        VP                  4      V n        \        VP
                  4      V n        \        VP                  4      V n        \        VP                  4      V n        \        VP                  4      V n        \        VP                  4      V n	        R # r]   )
r:  r   rr   r   r   r   r   r   r   r   r<  s   &&r6   r=  'AsyncWorkWithStreamingResponse.__init__R  s    
:MM
 9KK
 7II
	 6HH
 <NN
 7II
	 8JJ

 7II
	r9   r?  Nr@  r4   r9   r6   r   r   Q  rA  r9   r   )F
__future__r   ostypingr   r   r   r   r   	itertoolsr	   httpxcollections.abcr
   r!  r   r/  r   r    r   _typesr   r   r   r   r   r   r   _utilsr   r   r   r   r   _compatr   	_resourcer   r   	_responser   r   
paginationr    r!   _base_clientr"   r#   types.beta.environmentsr$   r%   r&   r'   r(   types.anthropic_beta_paramr)   -types.beta.environments.beta_self_hosted_workr*   9types.beta.environments.beta_self_hosted_work_queue_statsr+   @types.beta.environments.beta_self_hosted_work_heartbeat_responser,   __all__r-   r.   r3   r   rA   r   r4   r9   r6   <module>rh     s    # 	 < <  -*V ! L L L g g ' ; Z : A  > P f t;
V
? V
rs

  s

l
 
<
 
<
 
<
 
r9   