Skip to content

Commit 7f71acb

Browse files
committed
feat: add logistics agent
1 parent 1632842 commit 7f71acb

29 files changed

+6578
-0
lines changed

samples/logistic-agent/.agent/CLI_REFERENCE.md

Lines changed: 560 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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 three 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 State(BaseModel):
18+
"""Define the agent's internal state that flows between nodes"""
19+
# Add your state fields here
20+
pass
21+
22+
class Output(BaseModel):
23+
"""Define output fields that the agent returns"""
24+
# Add your output fields here
25+
pass
26+
```
27+
28+
### Required LLM Initialization
29+
30+
Unless the user explicitly requests a different LLM provider, always use `UiPathChat`:
31+
32+
```python
33+
from uipath_langchain.chat import UiPathChat
34+
35+
llm = UiPathChat(model="gpt-4o-2024-08-06", temperature=0.7)
36+
```
37+
38+
**Alternative LLMs** (only use if explicitly requested):
39+
- `ChatOpenAI` from `langchain_openai`
40+
- `ChatAnthropic` from `langchain_anthropic`
41+
- Other LangChain-compatible LLMs
42+
43+
### Standard Agent Template
44+
45+
Every agent should follow this basic structure:
46+
47+
```python
48+
from langchain_core.messages import SystemMessage, HumanMessage
49+
from langgraph.graph import START, StateGraph, END
50+
from uipath_langchain.chat import UiPathChat
51+
from pydantic import BaseModel
52+
53+
# 1. Define Input, State, and Output models
54+
class Input(BaseModel):
55+
field: str
56+
57+
class State(BaseModel):
58+
field: str
59+
result: str = ""
60+
61+
class Output(BaseModel):
62+
result: str
63+
64+
# 2. Initialize UiPathChat LLM
65+
llm = UiPathChat(model="gpt-4o-2024-08-06", temperature=0.7)
66+
67+
# 3. Define agent nodes (async functions)
68+
async def process_node(state: State) -> State:
69+
response = await llm.ainvoke([HumanMessage(state.field)])
70+
return State(field=state.field, result=response.content)
71+
72+
async def output_node(state: State) -> Output:
73+
return Output(result=state.result)
74+
75+
# 4. Build the graph
76+
builder = StateGraph(State, input=Input, output=Output)
77+
builder.add_node("process", process_node)
78+
builder.add_node("output", output_node)
79+
builder.add_edge(START, "process")
80+
builder.add_edge("process", "output")
81+
builder.add_edge("output", END)
82+
83+
# 5. Compile the graph
84+
graph = builder.compile()
85+
```
86+
87+
**Key Rules**:
88+
1. Always use async/await for all node functions
89+
2. All nodes (except output) must accept and return `State`
90+
3. The final output node must return `Output`
91+
4. Use `StateGraph(State, input=Input, output=Output)` for initialization
92+
5. Always compile with `graph = builder.compile()`

samples/logistic-agent/.agent/SDK_REFERENCE.md

Lines changed: 619 additions & 0 deletions
Large diffs are not rendered by default.

samples/logistic-agent/AGENTS.md

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 LangGraph and 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, State, Output), LLM 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

samples/logistic-agent/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md

0 commit comments

Comments
 (0)