|
1 | | -"""LowCode Agent graph construction - wrapper delegating to uipath_langchain.agent.graph.""" |
| 1 | +"""Agent graph construction - wrapper delegating to uipath_langchain.agent.graph.""" |
2 | 2 |
|
3 | | -from pathlib import Path |
4 | 3 | from typing import Any, Optional, Union |
5 | 4 |
|
6 | 5 | from langgraph.graph import StateGraph |
| 6 | +from uipath.agent.models.agent import LowCodeAgentDefinition |
7 | 7 | from uipath_langchain.agent.react import ( |
8 | 8 | AgentGraphConfig, |
9 | 9 | AgentGraphState, |
|
12 | 12 | ) |
13 | 13 | from uipath_langchain.agent.tools import create_tools_from_resources |
14 | 14 |
|
15 | | -from .constants import ( |
16 | | - AGENT_CONFIG_FILENAME, |
17 | | - AGENT_LOOP_RECURSION_LIMIT, |
18 | | -) |
19 | | -from .input_loader import load_agent_configuration, load_input_arguments |
| 15 | +from .input_utils import validate_input_data |
20 | 16 | from .llm_utils import create_llm |
21 | 17 | from .message_utils import build_agent_messages |
22 | 18 |
|
| 19 | +AGENT_LOOP_RECURSION_LIMIT = 50 |
| 20 | + |
23 | 21 |
|
24 | | -async def build_lowcode_agent_graph( |
| 22 | +async def build_agent_graph( |
| 23 | + agent_definition: LowCodeAgentDefinition, |
25 | 24 | input_data: Optional[Union[str, dict[str, Any]]] = None, |
26 | 25 | ) -> StateGraph[AgentGraphState]: |
27 | 26 | """Build LangGraph agent from agent.json configuration and optional input data.""" |
28 | 27 |
|
29 | | - agent_json_path = Path.cwd() / AGENT_CONFIG_FILENAME |
30 | | - agent_definition = load_agent_configuration(agent_json_path) |
31 | | - input_arguments = load_input_arguments( |
32 | | - agent_definition.input_schema, input_data=input_data |
33 | | - ) |
| 28 | + input_arguments = validate_input_data(agent_definition.input_schema, input_data) |
34 | 29 |
|
35 | 30 | tools = await create_tools_from_resources(agent_definition) |
36 | 31 | llm = create_llm( |
|
0 commit comments