Conversation
…h/uipath-langchain-python into feat-df-agent-integrations
…tions # Conflicts: # src/uipath_langchain/agent/react/agent.py # src/uipath_langchain/agent/react/init_node.py # src/uipath_langchain/agent/react/types.py # src/uipath_langchain/agent/tools/__init__.py # tests/agent/react/test_create_agent.py
|
@claude review |
68e68c2 to
55a49b2
Compare
| def graph_state_init(state: Any) -> Any: | ||
| async def graph_state_init(state: Any) -> Any: | ||
| # --- Data Fabric schema fetch (INIT-time) --- | ||
| schema_context: str | None = None |
There was a problem hiding this comment.
lets move this to a helper method behind datafabric_tool folder. Few principles:
- Resources_for_init is a new extension getting introduced in the infra, so that it can be used by other resources if required.
- DataFabric may not be the tool always for resoures_for_init. Check for resource and then invoke the helper.
Similar pattern as tools_factory.py.
| resolved_messages: Sequence[SystemMessage | HumanMessage] | Overwrite | ||
| if callable(messages): | ||
| resolved_messages = list(messages(state)) | ||
| if schema_context: |
There was a problem hiding this comment.
should be keyed to additional_context_available. That derives from schema_context.
| "Fetching Data Fabric schemas for %d identifier(s)", | ||
| len(entity_identifiers), | ||
| ) | ||
| entities = await fetch_entity_schemas(entity_identifiers) |
There was a problem hiding this comment.
This should be single api outside tool
| modifiers = [] | ||
| if field.is_primary_key: | ||
| modifiers.append("PK") | ||
| if field.is_foreign_key and field.reference_entity: |
There was a problem hiding this comment.
I think we should skip this reference_entity inclusion. Its irrelevant for VDOs as we dont allow them there. For LDO, it creates more confusion as its a denormalized.
| return type_name | ||
|
|
||
|
|
||
| def format_schemas_for_context(entities: list[Entity]) -> str: |
There was a problem hiding this comment.
Can you introduce a Pydantic model which is the final structured model for the use case?
| "sql_query": sql_query, | ||
| } | ||
|
|
||
| return BaseUiPathStructuredTool( |
There was a problem hiding this comment.
Check if langgraph has a tool that is more refined to accept 'sql' over 'sql string' , Currently we put description to format the sql query but a more refined tool over BaseUiPathStructuredTool makes more sense here.
| return create_process_tool(resource) | ||
|
|
||
| elif isinstance(resource, AgentContextResourceConfig): | ||
| if resource.is_datafabric: |
There was a problem hiding this comment.
I would prefer this under context_tool method to keep the boundary of tool_factory clean. Since datafabric is still a context.
|
creating a clean PR #726 for addressing the commit lint. |
Summary
Adds Data Fabric tool support. Enables agents to query Data Fabric entities using SQL by injecting entity schemas into the system prompt at INIT time and providing a generic query_datafabric tool.
What it does: When an agent has Data Fabric entity contexts configured in Studio Web, the INIT node fetches entity metadata (table names, column names, types) from the Data Fabric API at startup. This metadata is formatted as markdown with SQL guidelines and constraints, then appended to the system prompt. A generic
query_datafabrictool is registered that accepts raw SQL and dispatches it to the Data Fabric API.Changes
react/agent.py- Add resources param, pass to create_init_node()react/init_node.py- Fetch DF schemas at INIT, inject into system prompt via additional_contextreact/types.py- Define AgentResources type aliastools/datafabric_tool/- New module: schema fetching, formatting, entity detection, query_datafabric tool, SQL guidelines and constraintstools/tool_factory.py- Register DF tool, skip DF contexts in generic resource looptools/context_tool.py- Guard: raise error if DF context is accidentally routed hereCompanion PR
https://github.com/UiPath/uipath-agents-python/pull/379
Testing
Screen.Recording.2026-03-24.at.4.48.53.PM.mov