-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathutils.py
More file actions
26 lines (20 loc) · 756 Bytes
/
utils.py
File metadata and controls
26 lines (20 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Utilities for the deep agent wrapper graph."""
from typing import cast
from pydantic import BaseModel
from .types import DeepAgentGraphState
def create_state_with_input(
input_schema: type[BaseModel] | None,
) -> type[DeepAgentGraphState]:
"""Create combined state by merging DeepAgentGraphState with the input schema.
Mirrors the shallow agent's create_state_with_input pattern:
dynamic multi-inheritance + model_rebuild() for Pydantic resolution.
"""
if input_schema is None:
return DeepAgentGraphState
CompleteState = type(
"CompleteDeepAgentGraphState",
(DeepAgentGraphState, input_schema),
{},
)
cast(type[BaseModel], CompleteState).model_rebuild()
return CompleteState