Skip to content

Commit a6f71ea

Browse files
cr
1 parent cf9c21c commit a6f71ea

File tree

15 files changed

+1373
-430
lines changed

15 files changed

+1373
-430
lines changed

samples/document-understanding-agent/.agent/CLI_REFERENCE.md

Lines changed: 560 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+
```

samples/document-understanding-agent/.agent/SDK_REFERENCE.md

Lines changed: 565 additions & 0 deletions
Large diffs are not rendered by default.
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
File renamed without changes.
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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "https://cloud.uipath.com/draft/2024-12/entry-point",
3+
"$id": "entry-points.json",
4+
"entryPoints": []
5+
}

samples/documents/main.py renamed to samples/document-understanding-agent/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from dataclasses import dataclass
2-
from samples import ixp, du_modern, pretrained
2+
from src import ixp, du_modern, pretrained
33

44

55
@dataclass
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[project]
2-
name = "documents"
2+
name = "document-understanding-agent"
33
version = "0.1.0"
44
authors = [{ name = "John Doe" }]
55
description = "Add your description here"
66
readme = "README.md"
7-
requires-python = ">=3.10"
7+
requires-python = ">=3.11"
88
dependencies = [
9-
"uipath>=2.1.173",
9+
"uipath>=2.2.14, <2.3.0",
1010
]

0 commit comments

Comments
 (0)