langgraph_agent_toolkit.core.models.transport module
Own HTTP connections for OpenAI and Azure model calls.
- class langgraph_agent_toolkit.core.models.transport.LLMTransportConfig(*, async_transport='httpx', max_connections=1000, max_keepalive_connections=100, keepalive_expiry=5, connect_timeout=5, read_timeout=600, write_timeout=600, pool_timeout=600, max_retries=2, shutdown_timeout=10, max_pools=32)[source][source]
Bases:
BaseModelSet connection limits for each endpoint and credential configuration.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
async_transport (Literal['httpx', 'aiohttp'])
max_connections (Annotated[int, Gt(gt=0)])
max_keepalive_connections (Annotated[int, Ge(ge=0)])
keepalive_expiry (Annotated[float, Gt(gt=0), _PydanticGeneralMetadata(allow_inf_nan=False)])
connect_timeout (Annotated[float, Gt(gt=0), _PydanticGeneralMetadata(allow_inf_nan=False)])
read_timeout (Annotated[float, Gt(gt=0), _PydanticGeneralMetadata(allow_inf_nan=False)])
write_timeout (Annotated[float, Gt(gt=0), _PydanticGeneralMetadata(allow_inf_nan=False)])
pool_timeout (Annotated[float, Gt(gt=0), _PydanticGeneralMetadata(allow_inf_nan=False)])
max_retries (Annotated[int, Ge(ge=0)])
shutdown_timeout (Annotated[float, Gt(gt=0), _PydanticGeneralMetadata(allow_inf_nan=False)])
max_pools (Annotated[int, Gt(gt=0)])
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- async_transport: Literal['httpx', 'aiohttp']
- max_connections: int
- max_keepalive_connections: int
- keepalive_expiry: float
- connect_timeout: float
- read_timeout: float
- write_timeout: float
- pool_timeout: float
- max_retries: int
- shutdown_timeout: float
- max_pools: int
- class langgraph_agent_toolkit.core.models.transport.LLMTransportManager(config=None)[source][source]
Bases:
objectReuse HTTP clients inside one worker and one event loop.
Enter this manager before model construction. Bind it during graph startup and each request. Close it after all model calls finish. Explicit clients and explicit socket options keep the caller’s existing behavior.
- Parameters:
config (LLMTransportConfig | None)
- __init__(config=None)[source][source]
- Parameters:
config (LLMTransportConfig | None)
- Return type:
None
- bind()[source]
- Return type:
Iterator[LLMTransportManager]
- langgraph_agent_toolkit.core.models.transport.current_llm_transport_manager()[source][source]
Return the manager bound to the current request.
- Return type:
LLMTransportManager | None