UiPath LangChain Integration

0.9.26 · active · verified Wed Apr 15

The UiPath LangChain Integration SDK enables developers to build and deploy LangGraph agents that interact with the UiPath Cloud Platform. It provides tools for interacting with UiPath processes and activities within LangChain workflows. The current PyPI version is 0.9.26. Its release cadence is currently irregular, with significant future releases (v0.1.0, v0.2.0) announced for late 2025.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the UiPathTools and list available UiPath automation tools. It requires environment variables for UiPath LangChain API Key, API URL, and an optional Agent ID to connect to the UiPath platform. A successful run will list the tools discovered, or provide an error if configuration is incorrect.

import os
from uipath_langchain.tool_interfaces import UiPathTools

# Configure UiPath LangChain integration
# Replace with your actual values or ensure environment variables are set.
# These are placeholders and must be valid for the integration to work.
os.environ["LANGCHAIN_API_KEY"] = os.environ.get("LANGCHAIN_API_KEY", "your_langchain_api_key_here")
os.environ["LANGCHAIN_API_URL"] = os.environ.get("LANGCHAIN_API_URL", "https://cloud.uipath.com/langchain_api")
os.environ["UIPATH_AGENT_ID"] = os.environ.get("UIPATH_AGENT_ID", "your_uipath_agent_id_here")

print("Attempting to initialize UiPathTools...")
try:
    uipath_tools = UiPathTools()
    available_tools = uipath_tools.get_available_tools()
    print(f"\nSuccessfully initialized UiPathTools. Found {len(available_tools)} tools.")
    for tool in available_tools:
        print(f"- Tool Name: {tool.name}, Description: {tool.description}")

    print("\nFor full agent integration, you would typically integrate these tools with a LangChain LLM and AgentExecutor.")
    print("Example:")
    print("  from uipath_langchain.chat_models import UiPathChatModel")
    print("  from langchain.agents import AgentExecutor, create_react_agent")
    print("  from langchain import hub")
    print("  from langchain_core.tools import Tool")
    print("  # llm = UiPathChatModel()")
    print("  # tools_for_agent = [Tool(name=t.name, func=t.func, description=t.description) for t in available_tools]")
    print("  # prompt = hub.pull('hwchase17/react')")
    print("  # agent = create_react_agent(llm, tools_for_agent, prompt)")
    print("  # agent_executor = AgentExecutor(agent=agent, tools=tools_for_agent, verbose=True)")
    print("  # response = agent_executor.invoke({'input': 'Your query that uses a UiPath tool'})")

except Exception as e:
    print(f"\nFailed to initialize UiPathTools: {e}")
    print("Please ensure your LANGCHAIN_API_KEY, LANGCHAIN_API_URL, and UIPATH_AGENT_ID are correctly configured and reachable.")
    print("Also, verify that the UiPath Assistant is running and connected if you expect specific tools.")

view raw JSON →