Skip to content

Commit 1389d3a

Browse files
authored
chore: modify template agent (#760)
1 parent e57c1cc commit 1389d3a

File tree

11 files changed

+122
-412
lines changed

11 files changed

+122
-412
lines changed

template/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A quickstart UiPath LangGraph agent. It answers user queries using live tools an
1515
| Tool | Description |
1616
| ------------------ | ------------------------------------------------ |
1717
| `get_current_time` | Returns the current UTC date and time (ISO 8601) |
18-
| `web_search` | Searches the web via DuckDuckGo |
18+
| `get_weather` | Returns weather data for a city (mock data) |
1919

2020
### LLM Providers
2121

@@ -43,7 +43,7 @@ flowchart TD
4343
```json
4444
// Input
4545
{
46-
"query": "What is the current UTC time?"
46+
"query": "What's the weather like in London?"
4747
}
4848

4949
// Output
@@ -64,7 +64,7 @@ uv run uipath debug agent --file input.json
6464

6565
## Evaluation
6666

67-
The agent ships with a tool call order evaluator that verifies the ReAct node calls `get_current_time` **before** `web_search` when given a time-dependent query.
67+
The agent ships with a tool call order evaluator that verifies the ReAct node calls `get_current_time` **before** `get_weather` when given a time-and-weather query, and an LLM judge that checks weather output for semantic similarity.
6868

6969
```bash
7070
uv run uipath eval

template/evaluations/eval-sets/evaluation-set-default.json

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,30 @@
44
"name": "Default Evaluation Set",
55
"evaluatorRefs": [
66
"evaluator-llm-judge-output",
7-
"evaluator-tool-call-order"
7+
"evaluator-tool-call-order",
8+
"evaluator-tool-call-arguments",
9+
"evaluator-tool-call-count"
810
],
911
"evaluations": [
1012
{
1113
"id": "ada5a2c1-976c-470b-964f-eb70a5e61eb4",
12-
"name": "Current time tool should be called before web search",
14+
"name": "Weather in Paris",
1315
"inputs": {
14-
"query": "search the web using current time as input"
15-
},
16-
"evaluationCriterias": {
17-
"evaluator-tool-call-order": null
18-
},
19-
"createdAt": "2026-03-23T17:10:17.394Z",
20-
"updatedAt": "2026-03-23T17:10:40.659Z"
21-
},
22-
{
23-
"id": "cf113553-5055-4cbf-a97f-e3801b05acd8",
24-
"name": "UiPath details",
25-
"inputs": {
26-
"query": "tell me about UiPath"
16+
"query": "Is it good weather for a walk in Paris?"
2717
},
2818
"evaluationCriterias": {
2919
"evaluator-llm-judge-output": {
30-
"expectedOutput": "{\n \"response\": \"# UiPath Overview: **UiPath** is a global software company and a leading platform for **Robotic Process Automation (RPA)** and **Agentic Automation**. Here are the key details:\\\\n\\\\n## Company Background\\\\n- **Founded:** 2005 by Daniel Dines and Marius Tirca\\\\n- **Headquarters:** New York City, United States\\\\n- **Status:** Public company\\\\n- **Funding:** Raised $1.96B from investors like Accel, Coatue, and Alkeon Capital Management\\\\n\\\\n## What It Does\\\\nUiPath specializes in automating repetitive, routine business tasks by using software robots that mimic human actions across digital systems. The platform helps organizations:\\\\n- Automate end-to-end business processes\\\\n- Reduce manual work and improve efficiency\\\\n- Enhance enterprise digital transformation\\\\n\\\\n## Core Offerings\\\\n- **RPA (Robotic Process Automation):** Build, manage, and deploy bots to automate repetitive tasks\\\\n- **AI Integration:** Advanced AI capabilities through collaborations with NVIDIA, OpenAI, Google, Microsoft, and Snowflake\\\\n- **UiPath Studio Web:** Browser-based tool for building cross-platform automations with templates and collaboration features\\\\n- **Agentic Automation:** AI agents that can orchestrate workflows with robots and human effort\\\\n\\\\n## Business Model Evolution\\\\n- **Shifting to consumption-based pricing:** Moving from traditional \\\"per-user seat\\\" licensing to \\\"pay-per-action\\\" models\\\\n- This reflects the changing value proposition as AI agents become more capable\\\\n\\\\n## Recent Developments\\\\n- Announced acquisition of **WorkFusion** (a pioneer in AI agents for financial crime compliance)\\\\n- Expanding AI capabilities and partnerships with major tech companies\\\\n- Offering globally recognized certification programs for automation expertise\\\\n\\\\nUiPath is positioned as one of the leading enterprise automation platforms for digital transformation\"\n}"
31-
}
20+
"expectedOutput": "{\n \"response\": \"Yes, it's quite good weather for a walk in Paris! The current conditions are:**Temperature**: 18°C (64°F) - mild and pleasant spring weather **Wind**: 12 km/h (7 mph) - light, manageable breeze **Conditions**: Partly cloudy - perfect for a walk without being too sunny or too gray\"\n}"
21+
},
22+
"evaluator-tool-call-order": null,
23+
"evaluator-tool-call-arguments": null,
24+
"evaluator-tool-call-count": null
3225
},
33-
"createdAt": "2026-04-08T15:19:44.377Z",
34-
"updatedAt": "2026-04-08T15:21:50.470Z"
26+
"createdAt": "2026-03-23T17:10:17.394Z",
27+
"updatedAt": "2026-04-09T07:11:59.193Z"
3528
}
3629
],
3730
"fileName": "evaluation-set-default.json",
38-
"updatedAt": "2026-04-08T15:21:50.470Z",
31+
"updatedAt": "2026-04-09T07:11:59.193Z",
3932
"selectedEntrypoint": "agent"
40-
}
33+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"version": "1.0",
3+
"fileName": "tool-call-arguments.json",
4+
"id": "evaluator-tool-call-arguments",
5+
"description": "Verify tool call arguments match expected values",
6+
"evaluatorTypeId": "uipath-tool-call-args",
7+
"evaluatorConfig": {
8+
"strict": false,
9+
"subset": false,
10+
"name": "Tool Call Arguments",
11+
"defaultEvaluationCriteria": {
12+
"toolCalls": [
13+
{
14+
"name": "get_weather",
15+
"args": {
16+
"city": "Paris"
17+
}
18+
}
19+
]
20+
}
21+
},
22+
"createdAt": "2026-04-09T07:09:28.326Z",
23+
"updatedAt": "2026-04-09T07:09:31.178Z"
24+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"version": "1.0",
3+
"fileName": "tool-call-count.json",
4+
"id": "evaluator-tool-call-count",
5+
"description": "Verify tool call counts match expected values",
6+
"evaluatorTypeId": "uipath-tool-call-count",
7+
"evaluatorConfig": {
8+
"strict": false,
9+
"name": "Tool Call Count",
10+
"defaultEvaluationCriteria": {
11+
"toolCallsCount": {
12+
"get_weather": [
13+
"=",
14+
1
15+
],
16+
"get_current_time": [
17+
"=",
18+
1
19+
]
20+
}
21+
}
22+
},
23+
"createdAt": "2026-04-09T07:09:51.451Z",
24+
"updatedAt": "2026-04-09T07:09:53.843Z"
25+
}

template/evaluations/evaluators/tool-call-order.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"defaultEvaluationCriteria": {
1111
"toolCallsOrder": [
1212
"get_current_time",
13-
"web_search"
13+
"get_weather"
1414
]
1515
}
1616
},

template/input.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"query": "What is the current UTC time?"
2+
"query": "What's the weather like in London?"
33
}

template/main.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
from typing import Annotated, Any, TypedDict
33

44
from langchain.agents import create_agent
5-
from langchain_community.tools import DuckDuckGoSearchRun
6-
from langchain_community.utilities import DuckDuckGoSearchAPIWrapper
75
from langchain_core.messages import HumanMessage, SystemMessage
86
from langchain_core.tools import tool
97
from langgraph.graph import END, START, StateGraph
@@ -52,11 +50,27 @@ def get_current_time() -> str:
5250
return datetime.now(timezone.utc).isoformat()
5351

5452

55-
web_search = DuckDuckGoSearchRun(
56-
name="web_search",
57-
description="Search the web for information.",
58-
api_wrapper=DuckDuckGoSearchAPIWrapper(backend="duckduckgo"),
59-
)
53+
@tool
54+
def get_weather(city: str, utc_time: str) -> str:
55+
"""Get the current weather for a city. Requires the current UTC time from get_current_time.
56+
57+
Args:
58+
city: The city name, e.g. 'Paris' or 'Tokyo'.
59+
utc_time: The current UTC time.
60+
"""
61+
62+
WEATHER_DATA = {
63+
"paris": "Weather in Paris, France: 18°C, wind 12 km/h, partly cloudy",
64+
"london": "Weather in London, UK: 14°C, wind 20 km/h, overcast",
65+
"new york": "Weather in New York, USA: 22°C, wind 8 km/h, clear sky",
66+
"tokyo": "Weather in Tokyo, Japan: 26°C, wind 5 km/h, sunny",
67+
"sydney": "Weather in Sydney, Australia: 19°C, wind 15 km/h, light rain",
68+
}
69+
70+
weather = WEATHER_DATA.get(city.lower().strip())
71+
if weather:
72+
return f"{weather} (as of {utc_time})"
73+
return f"Weather data not available for {city}"
6074

6175

6276
async def prepare(input: InputModel) -> dict[str, Any]:
@@ -70,7 +84,7 @@ async def prepare(input: InputModel) -> dict[str, Any]:
7084

7185
react_agent = create_agent(
7286
model=llm,
73-
tools=[get_current_time, web_search],
87+
tools=[get_current_time, get_weather],
7488
response_format=AgentResponse,
7589
)
7690

template/pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ version = "0.0.1"
44
description = "uipath-langchain-template-agent"
55
authors = [{ name = "John Doe", email = "john.doe@myemail.com" }]
66
dependencies = [
7-
"ddgs>=9.11.4",
8-
"langchain-community>=0.4.1",
97
"uipath-langchain[bedrock,vertex]>=0.9.21, <0.10.0",
108
]
119
requires-python = ">=3.11"

0 commit comments

Comments
 (0)