Skip to content

feat: Addition of DF tool#721

Closed
milind-jain-uipath wants to merge 15 commits intomainfrom
feat-df-agent-integrations-fixes
Closed

feat: Addition of DF tool#721
milind-jain-uipath wants to merge 15 commits intomainfrom
feat-df-agent-integrations-fixes

Conversation

@milind-jain-uipath
Copy link

@milind-jain-uipath milind-jain-uipath commented Mar 24, 2026

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_datafabric tool 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_context
  • react/types.py - Define AgentResources type alias
  • tools/datafabric_tool/ - New module: schema fetching, formatting, entity detection, query_datafabric tool, SQL guidelines and constraints
  • tools/tool_factory.py - Register DF tool, skip DF contexts in generic resource loop
  • tools/context_tool.py - Guard: raise error if DF context is accidentally routed here

Companion PR

https://github.com/UiPath/uipath-agents-python/pull/379

Testing

  • Tested the integration with Local robot run. Please ignore the error thrown from the tool - that is the folder level integration we are doing in FQS.
Screen.Recording.2026-03-24.at.4.48.53.PM.mov

@milind-jain-uipath
Copy link
Author

@claude

@milind-jain-uipath
Copy link
Author

@claude review

@milind-jain-uipath milind-jain-uipath force-pushed the feat-df-agent-integrations-fixes branch from 68e68c2 to 55a49b2 Compare March 24, 2026 09:11
@milind-jain-uipath milind-jain-uipath changed the title Feat df agent integrations fixes feat: Addition of DF tool Mar 24, 2026
@milind-jain-uipath milind-jain-uipath marked this pull request as ready for review March 24, 2026 11:37
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets move this to a helper method behind datafabric_tool folder. Few principles:

  1. Resources_for_init is a new extension getting introduced in the infra, so that it can be used by other resources if required.
  2. 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:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you introduce a Pydantic model which is the final structured model for the use case?

"sql_query": sql_query,
}

return BaseUiPathStructuredTool(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this under context_tool method to keep the boundary of tool_factory clean. Since datafabric is still a context.

@milind-jain-uipath
Copy link
Author

creating a clean PR #726 for addressing the commit lint.
Will be fixing the review comments in the new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants