-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy path__init__.py
More file actions
59 lines (47 loc) · 1.77 KB
/
__init__.py
File metadata and controls
59 lines (47 loc) · 1.77 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""Deep agent support, built on the optional `deepagents` package.
Install the optional extra to use this module:
pip install 'uipath-langchain[deep]'
uv add 'uipath-langchain[deep]'
The `deepagents` types re-exported here (``SubAgent``, ``CompiledSubAgent``,
``BackendProtocol``, ``BackendFactory``) are loaded lazily so importing this
package without the extra installed does not crash — only attribute access
will raise ``ImportError`` with the install hint.
"""
from .agent import create_deep_agent, create_deep_agent_graph
from .types import DeepAgentGraphState
from .utils import create_state_with_input
_INSTALL_HINT = (
"deepagents is required for deep agents. Install with: "
"pip install 'uipath-langchain[deep]' "
"(or: uv add 'uipath-langchain[deep]')"
)
def __getattr__(name: str):
if name in ("SubAgent", "CompiledSubAgent"):
try:
import deepagents
return getattr(deepagents, name)
except ImportError as exc:
raise ImportError(_INSTALL_HINT) from exc
if name == "BackendProtocol":
try:
from deepagents.backends import BackendProtocol
return BackendProtocol
except ImportError as exc:
raise ImportError(_INSTALL_HINT) from exc
if name == "BackendFactory":
try:
from deepagents.backends.protocol import BackendFactory
return BackendFactory
except ImportError as exc:
raise ImportError(_INSTALL_HINT) from exc
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
__all__ = [
"BackendFactory",
"BackendProtocol",
"CompiledSubAgent",
"DeepAgentGraphState",
"SubAgent",
"create_deep_agent",
"create_deep_agent_graph",
"create_state_with_input",
]