Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
runtime.cpython-313.pyc68 linesDownload Raw Back to __pycache__
1�

2��j!���SSKJr SSKrSSKJrJr SSKJrJrJ	r	J3r4 \RS:�a\5"SSS9rO\6"S5r\RS:�aSS	KJ
r
 OSS	KJ
r
 SS7KJr \(aSSKJr SS
/r\	Sr\"SSSS9"SS\\55r\"SSSS9"SS\\\\55r\"SSSS9"SS\\\\55r\
"S
\\\\-\4S9rg)�)�annotationsN)�	dataclass�field)�
TYPE_CHECKING�Generic�Literal�TypeVar)��
�ContextT��default)r8�)�
TypeAliasType)�BaseUser)�	BaseStore�
AccessContext�
ServerRuntime)zthreads.create_runzthreads.updatezthreads.readzassistants.readT)�kw_only�slots�frozenc�h�\rSrSr%SrS\S'\"SS9rS\S'S	\S9'\SSj5r	SSjr10S
rg)�_ServerRuntimeBase�$zqBase for server runtime variants.11 12!!! warning "Beta"13    This API is in beta and may change in future releases.14r�access_contextNr
zBaseUser | None�userr�storec�2�[U[5(aU$g)a�Narrow to the execution runtime, or `None` if not in an execution context.15 16When the server calls the graph factory for `threads.create_run`, the returned17object provides access to `context` (typed by the graph's18`context_schema`). For all other access contexts (introspection, state19reads, state updates), this returns `None`.20 21Use this to conditionally set up expensive resources (MCP tool servers,22database connections, etc.) that are only needed during execution:23 24```python25import contextlib26from langgraph_sdk.runtime import ServerRuntime27 28@contextlib.asynccontextmanager29async def my_factory(runtime: ServerRuntime[MyCtx]):30    if ert := runtime.execution_runtime:31        # Only connect to MCP servers when actually executing a run.32        # Introspection calls (get_schema, get_graph, ...) skip this.33        mcp_tools = await connect_mcp(ert.context.mcp_endpoint)34        yield create_agent(model, tools=mcp_tools)35        await disconnect_mcp()36    else:37        yield create_agent(model, tools=[])38```39N)�40isinstance�_ExecutionRuntime��selfs �[D:\code\apps\devtools\python\user_packages\Python313\site-packages\langgraph_sdk/runtime.py�execution_runtime�$_ServerRuntimeBase.execution_runtimeas��8�d�-�.�.��K��c�f�URc[SURS35eUR$)aRReturn the authenticated user, or raise if not available.41 42When custom auth is configured, `user` is set for all access contexts43(the factory is only called from HTTP handlers where the auth44middleware has already run). This method raises only when no custom45auth is configured.46 47Raises:48    PermissionError: If no user is authenticated.49z3No authenticated user available in access_context='z3'. Ensure custom auth is configured for the server.)r�PermissionErrorrr!s r#�ensure_user�_ServerRuntimeBase.ensure_user�sB���9�9��!�E�d�FY�FY�EZ�[C�C��
��y�y�r&�)�returnz"_ExecutionRuntime[ContextT] | None)r,r)�__name__�50__module__�__qualname__�__firstlineno__�__doc__�__annotations__rr�propertyr$r)�__static_attributes__r+r&r#rr$sI���"�!�,�\"�$�/�D�/�/�L���C�
����>r&rc�0�\rSrSr%Sr\"SS9rS\S'Srg)r �u�Runtime for `threads.create_run` — the graph will be fully executed.51 52Access this via `.execution_runtime` on `ServerRuntime`. Do not53construct directly.54 55!!! warning "Beta"56    This API is in beta and may change in future releases.57Nr
r�contextr+)	r-r.r/r0r1rr7r2r4r+r&r#r r �s����d�+�G�X�+�r&r c��\rSrSrSrSrg)�_ReadRuntime�aRuntime for non-execution access contexts.58 59Used for introspection (`assistants.read`), state operations60(`threads.read`), and state updates (`threads.update`).61No `context` is available.62 63!!! warning "Beta"64    This API is in beta and may change in future releases.65r+N)r-r.r/r0r1r4r+r&r#r9r9�s��r&r9)�type_params)�66__future__r�sys�dataclassesrr�typingrrrr	�version_inforr�typing_extensions�langgraph_sdk.auth.typesr�langgraph.store.baser�__all__rrr r9rr+r&r#�<module>rEs/��"�67�(�;�;����w���z�4�0�H��z�"�H����w��$�/�-��.��������
��4�t�D�1�l���*�l�2�l�^�4�t�D�1��*�8�4�g�h�6G��2��"�4�t�D�1�	�%�h�/���1B�	�2�	����h��,�x�"8�8����
�686r&
codekingpro/portable-devtools · Team Ai