How to call agent using Python script

Hey all,

I have created one agent in the Agent service of UiPath cloud, it is working fine on my prompt and data. Now I want to call this agent using python code, The primary reason of using python code to call this agent is, I want to pass some filtered and structured data from the database to the agent. I tried below endpoint to trigger the agent, but it is giving and error status code of 405 (Method not allowed).

API end point:

https://cloud.uipath.com/{ORGANIZATION_NAME}/{UIPATH_TENANT}/orchestrator\_/api/v1/Agents/UiPath.Server.Configuration.OData.Run

what is the correct way and approach to call this agent using local python code ?

@Akash_Jariwala

you have python sdk which you can leverage as well

cheers

Hi @Akash_Jariwala

UiPath has created a python SDK that can be used when coding a project from scratch. It’s super comprehensive and and allows so much flexibility to build exactly what you need.

UiPath also offers a Python with LangGraph SDK which allows you to build LangChain agents (my personal preference): Getting Started - UiPath SDK

There’s also quite a bit of documentation available if you’re building it for the first time.

You can invoke the deployed agent process through the SDK and pass your filtered data as input arguments:

from uipath.platform import UiPath

client = UiPath()
job = client.processes.invoke(
    name="YourDeployedAgentProcess",
    folder_path="YourFolder",
    input_arguments={"records": filtered_records}
)

Use the deployed process name and match ‘records’ and its data type to your agent’s input schema. Configure SDK authentication and the correct tenant first. The call returns job details; retrieve its result after completion. You don’t need to rebuild the agent in LangGraph.