
    =Ki!                       S SK Jr  S SKrS SKJrJr  S SKJrJrJ	r	J
r
  \R                  S:  a  \
" SSS9rO\
" S5      r\R                  S:  a  S S	KJr  OS S	KJr  S S
KJr  \(       a  S SKJr  SS/r\	S   r\" SSSS9 " S S\\   5      5       r\" SSSS9 " S S\\   \\   5      5       r\" SSSS9 " S S\\   \\   5      5       r\" S\\   \\   -  \4S9rg)    )annotationsN)	dataclassfield)TYPE_CHECKINGGenericLiteralTypeVar)      ContextTdefault)r
      )TypeAliasType)BaseUser)	BaseStoreAccessContextServerRuntime)zthreads.create_runzthreads.updatezthreads.readzassistants.readT)kw_onlyslotsfrozenc                  h    \ rS rSr% SrS\S'    \" SS9rS\S'    S	\S
'    \SS j5       r	SS jr
Srg)_ServerRuntimeBase$   zqBase for server runtime variants.

!!! warning "Beta"
    This API is in beta and may change in future releases.
r   access_contextNr   zBaseUser | Noneuserr   storec                2    [        U [        5      (       a  U $ g)a  Narrow to the execution runtime, or `None` if not in an execution context.

When the server calls the graph factory for `threads.create_run`, the returned
object provides access to `context` (typed by the graph's
`context_schema`). For all other access contexts (introspection, state
reads, state updates), this returns `None`.

Use this to conditionally set up expensive resources (MCP tool servers,
database connections, etc.) that are only needed during execution:

```python
import contextlib
from langgraph_sdk.runtime import ServerRuntime

@contextlib.asynccontextmanager
async def my_factory(runtime: ServerRuntime[MyCtx]):
    if ert := runtime.execution_runtime:
        # Only connect to MCP servers when actually executing a run.
        # Introspection calls (get_schema, get_graph, ...) skip this.
        mcp_tools = await connect_mcp(ert.context.mcp_endpoint)
        yield create_agent(model, tools=mcp_tools)
        await disconnect_mcp()
    else:
        yield create_agent(model, tools=[])
```
N)
isinstance_ExecutionRuntimeselfs    W/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/langgraph_sdk/runtime.pyexecution_runtime$_ServerRuntimeBase.execution_runtimea   s    8 d-..K    c                f    U R                   c  [        SU R                   S35      eU R                   $ )aR  Return the authenticated user, or raise if not available.

When custom auth is configured, `user` is set for all access contexts
(the factory is only called from HTTP handlers where the auth
middleware has already run). This method raises only when no custom
auth is configured.

Raises:
    PermissionError: If no user is authenticated.
z3No authenticated user available in access_context='z3'. Ensure custom auth is configured for the server.)r   PermissionErrorr   r!   s    r#   ensure_user_ServerRuntimeBase.ensure_user   sB     99!EdFYFYEZ [C C  yyr&    )returnz"_ExecutionRuntime[ContextT] | None)r,   r   )__name__
__module____qualname____firstlineno____doc____annotations__r   r   propertyr$   r)   __static_attributes__r+   r&   r#   r   r   $   sI     "!,\ "$/D//LC >r&   r   c                  0    \ rS rSr% Sr\" SS9rS\S'   Srg)r       u   Runtime for `threads.create_run` — the graph will be fully executed.

Access this via `.execution_runtime` on `ServerRuntime`. Do not
construct directly.

!!! warning "Beta"
    This API is in beta and may change in future releases.
Nr   r   contextr+   )	r-   r.   r/   r0   r1   r   r7   r2   r4   r+   r&   r#   r    r       s     d+GX+r&   r    c                      \ rS rSrSrSrg)_ReadRuntime   a  Runtime for non-execution access contexts.

Used for introspection (`assistants.read`), state operations
(`threads.read`), and state updates (`threads.update`).
No `context` is available.

!!! warning "Beta"
    This API is in beta and may change in future releases.
r+   N)r-   r.   r/   r0   r1   r4   r+   r&   r#   r9   r9      s    r&   r9   )type_params)
__future__r   sysdataclassesr   r   typingr   r   r   r	   version_infor   r   typing_extensionslanggraph_sdk.auth.typesr   langgraph.store.baser   __all__r   r   r    r9   r   r+   r&   r#   <module>rE      s/   " 
 ( ; ;wz40Hz"Hw$/ -.   4tD1l* l 2l^ 4tD1*84gh6G  2" 4tD1	%h/1B 	 2	 h,x"88
6r&   