Skip to content

Commit cdf03d3

Browse files
committed
feat: add template agent for uipath-llamaindex
- workflow with prepare, react_agent, tool_executor, postprocess steps - uses ctx.store for messages (survives debug breakpoint suspend/resume) - get_current_time + get_weather (mock) tools with native achat_with_tools - 4 evaluators: llm-judge, tool-call-order, tool-call-args, tool-call-count - testcase with run.sh and assert.py covering all evaluators - all init-generated files included
1 parent d4f82c1 commit cdf03d3

25 files changed

Lines changed: 6246 additions & 0 deletions

packages/uipath-llamaindex/template/.agent/CLI_REFERENCE.md

Lines changed: 948 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## Required Agent Structure
2+
3+
**IMPORTANT**: All UiPath coded agents MUST follow this standard structure unless explicitly specified otherwise by the user.
4+
5+
### Required Components
6+
7+
Every agent implementation MUST include these two Pydantic models:
8+
9+
```python
10+
from pydantic import BaseModel
11+
12+
class Input(BaseModel):
13+
"""Define input fields that the agent accepts"""
14+
# Add your input fields here
15+
pass
16+
17+
class Output(BaseModel):
18+
"""Define output fields that the agent returns"""
19+
# Add your output fields here
20+
pass
21+
```
22+
23+
### SDK Initialization
24+
25+
```python
26+
from uipath.platform import UiPath
27+
28+
# Initialize with environment variables
29+
uipath = UiPath()
30+
31+
# With explicit credentials
32+
uipath = UiPath(base_url="https://cloud.uipath.com/...", secret="your_token")
33+
34+
# Or with client_id and client_secret
35+
uipath = UiPath(
36+
client_id=UIPATH_CLIENT_ID,
37+
client_secret=UIPATH_CLIENT_SECRET,
38+
scope=UIPATH_SCOPE,
39+
base_url=UIPATH_URL
40+
)
41+
```
42+
43+
### Standard Agent Template
44+
45+
Every agent should follow this basic structure:
46+
47+
```python
48+
from uipath.platform import UiPath
49+
from pydantic import BaseModel
50+
51+
# 1. Define Input, and Output models
52+
class Input(BaseModel):
53+
field: str
54+
55+
class Output(BaseModel):
56+
result: str
57+
58+
# 2. Initialize with environment variables
59+
uipath = UiPath()
60+
61+
# 3. Define the main function (the main function can be named "main", "run" or "execute")
62+
def main(input_data: Input) -> Output:
63+
pass
64+
```

packages/uipath-llamaindex/template/.agent/SDK_REFERENCE.md

Lines changed: 803 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"schemaVersion": 1, "codeVersion": "1.0.10", "lastPushAuthor": "radu.mocanu@uipath.com", "lastPushDate": "2026-04-14T12:29:13.693634+00:00"}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Agent Code Patterns Reference
2+
3+
This document provides practical code patterns for building UiPath coded agents using the UiPath Python SDK.
4+
5+
---
6+
7+
## Documentation Structure
8+
9+
This documentation is split into multiple files for efficient context loading. Load only the files you need:
10+
11+
1. **@.agent/REQUIRED_STRUCTURE.md** - Agent structure patterns and templates
12+
- **When to load:** Creating a new agent or understanding required patterns
13+
- **Contains:** Required Pydantic models (Input, Output), SDK initialization patterns, standard agent template
14+
15+
2. **@.agent/SDK_REFERENCE.md** - Complete SDK API reference
16+
- **When to load:** Calling UiPath SDK methods, working with services (actions, assets, jobs, etc.)
17+
- **Contains:** All SDK services and methods with full signatures and type annotations
18+
19+
3. **@.agent/CLI_REFERENCE.md** - CLI commands documentation
20+
- **When to load:** Working with `uipath init`, `uipath run`, or `uipath eval` commands
21+
- **Contains:** Command syntax, options, usage examples, and workflows
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
flowchart TB
2+
__start__(__start__)
3+
postprocess(postprocess)
4+
prepare(prepare)
5+
react_agent(react_agent)
6+
tool_executor(tool_executor)
7+
__end__(__end__)
8+
postprocess --> |ResponseEvent|__end__
9+
__start__ --> |QueryEvent|prepare
10+
prepare --> |LLMInputEvent|react_agent
11+
react_agent --> |ToolCallEvent|tool_executor
12+
react_agent --> |AgentOutputEvent|postprocess
13+
tool_executor --> |LLMInputEvent|react_agent
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"version": "2.0",
3+
"resources": []
4+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"$schema": "https://cloud.uipath.com/draft/2024-12/entry-point",
3+
"$id": "entry-points.json",
4+
"entryPoints": [
5+
{
6+
"filePath": "agent",
7+
"uniqueId": "d64050f7-add5-4197-91f2-7b9cf3187751",
8+
"type": "agent",
9+
"input": {
10+
"type": "object",
11+
"properties": {
12+
"query": {
13+
"title": "Query",
14+
"type": "string"
15+
}
16+
},
17+
"required": [
18+
"query"
19+
]
20+
},
21+
"output": {
22+
"type": "object",
23+
"properties": {
24+
"response": {
25+
"title": "Response",
26+
"type": "string"
27+
}
28+
},
29+
"required": [
30+
"response"
31+
]
32+
},
33+
"graph": {
34+
"nodes": [
35+
{
36+
"id": "__start__",
37+
"name": "__start__",
38+
"type": "__start__",
39+
"subgraph": null
40+
},
41+
{
42+
"id": "postprocess",
43+
"name": "postprocess",
44+
"type": "node",
45+
"subgraph": null
46+
},
47+
{
48+
"id": "prepare",
49+
"name": "prepare",
50+
"type": "node",
51+
"subgraph": null
52+
},
53+
{
54+
"id": "react_agent",
55+
"name": "react_agent",
56+
"type": "node",
57+
"subgraph": null
58+
},
59+
{
60+
"id": "tool_executor",
61+
"name": "tool_executor",
62+
"type": "node",
63+
"subgraph": null
64+
},
65+
{
66+
"id": "__end__",
67+
"name": "__end__",
68+
"type": "__end__",
69+
"subgraph": null
70+
}
71+
],
72+
"edges": [
73+
{
74+
"source": "postprocess",
75+
"target": "__end__",
76+
"label": "ResponseEvent"
77+
},
78+
{
79+
"source": "__start__",
80+
"target": "prepare",
81+
"label": "QueryEvent"
82+
},
83+
{
84+
"source": "prepare",
85+
"target": "react_agent",
86+
"label": "LLMInputEvent"
87+
},
88+
{
89+
"source": "react_agent",
90+
"target": "tool_executor",
91+
"label": "ToolCallEvent"
92+
},
93+
{
94+
"source": "react_agent",
95+
"target": "postprocess",
96+
"label": "AgentOutputEvent"
97+
},
98+
{
99+
"source": "tool_executor",
100+
"target": "react_agent",
101+
"label": "LLMInputEvent"
102+
}
103+
]
104+
}
105+
}
106+
]
107+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"version": "1.0",
3+
"id": "DefaultEvaluationSet",
4+
"name": "Default Evaluation Set",
5+
"evaluatorRefs": [
6+
"evaluator-llm-judge-output",
7+
"evaluator-tool-call-order",
8+
"evaluator-tool-call-arguments",
9+
"evaluator-tool-call-count"
10+
],
11+
"evaluations": [
12+
{
13+
"id": "ada5a2c1-976c-470b-964f-eb70a5e61eb4",
14+
"name": "Weather in Paris",
15+
"inputs": {
16+
"query": "Is it good weather for a walk in Paris?"
17+
},
18+
"evaluationCriterias": {
19+
"evaluator-llm-judge-output": {
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
25+
},
26+
"createdAt": "2026-04-09T10:00:00.000Z",
27+
"updatedAt": "2026-04-09T10:00:00.000Z"
28+
}
29+
],
30+
"fileName": "evaluation-set-default.json",
31+
"updatedAt": "2026-04-09T10:00:00.000Z",
32+
"selectedEntrypoint": "agent"
33+
}

0 commit comments

Comments
 (0)