Skip to content

Commit 2f257fc

Browse files
Merge pull request #24 from UiPath/docs/add-sample-docs
docs: add docs for distributed agents sample
2 parents f4ebe71 + ad846a4 commit 2f257fc

File tree

10 files changed

+2912
-30
lines changed

10 files changed

+2912
-30
lines changed

docs/interrupt_models.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ UiPath platform and the Langchain coded agents.
99

1010
### 1. InvokeProcess
1111

12-
The `InvokeProcess` model is utilized to invoke a process within UiPath cloud platform. Upon completion of the invoked process, the current agent will automatically resume execution.
12+
The `InvokeProcess` model is utilized to invoke a process within the UiPath cloud platform.
13+
This process can be of various types, including API workflows, Agents or RPA automation.
14+
Upon completion of the invoked process, the current agent will automatically resume execution.
1315

1416
#### Attributes:
1517
- **name** (str): The name of the process to invoke.
@@ -20,6 +22,8 @@ The `InvokeProcess` model is utilized to invoke a process within UiPath cloud pl
2022
process_output = interrupt(InvokeProcess(name="MyProcess", input_arguments={"arg1": "value1"}))
2123
```
2224

25+
For a practical implementation of the `InvokeProcess` model, refer to the sample usage in the [planner.py](../../samples/multi-agent-planner-researcher-coder-distributed/src/multi-agent-distributed/planner.py#L184) file. This example demonstrates how to invoke a process with dynamic input arguments, showcasing the integration of the interrupt functionality within a multi-agent system or a system where an agent integrates with RPA processes and API workflows.
26+
2327
---
2428

2529
### 2. WaitJob
45.5 KB
Loading
82.9 KB
Loading
38.9 KB
Loading
84.8 KB
Loading
41.4 KB
Loading
80.1 KB
Loading

samples/multi-agent-planner-researcher-coder-distributed/README.md

Lines changed: 113 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Multi-Agent Task Execution System
22

3-
This repository contains a multi-agent system that breaks down complex tasks into discrete steps and routes them to specialized agents for execution. The system consists of three main components:
3+
This repository implements a multi-agent system that decomposes complex tasks into discrete steps, routing them to specialized agents for execution. The system comprises three main components:
44

5-
1. **Planner agent**: Orchestrates the workflow by planning task execution and routing subtasks to worker agents
6-
2. **Researcher Agent**: Finds information, formulas, and reference material without performing calculations
7-
3. **Coder Agent**: Performs calculations and evaluates formulas with specific values
5+
1. **Planner Agent**: Orchestrates the workflow by planning task execution and routing subtasks to worker agents.
6+
2. **Researcher Agent**: Gathers information, formulas, and reference materials without performing calculations.
7+
3. **Coder Agent**: Executes calculations and evaluates formulas with specific values.
88

9-
Each agent functions as an independent entrypoint and can be deployed as a separate process, while still being packaged together as part of an Orchestrator Agent Package.
9+
Each agent operates as an independent entry point and can be deployed as a separate process, while still being packaged together as part of an Orchestrator Agent Package.
1010

1111
## System Architecture
1212

13-
The system uses LangGraph to create a directed graph of agents that can communicate and pass state to each other.
13+
The system utilizes LangGraph to create a directed graph of agents that can communicate and share state.
1414

15-
### Planner Graph
15+
### Planner Agent Graph
1616
```mermaid
1717
---
1818
config:
@@ -34,7 +34,7 @@ graph TD;
3434
classDef last fill:#bfb6fc
3535
```
3636

37-
### Researcher Agent
37+
### Researcher Agent Graph
3838
```mermaid
3939
---
4040
config:
@@ -61,7 +61,7 @@ graph TD;
6161
classDef last fill:#bfb6fc
6262
```
6363

64-
### Coder Agent
64+
### Coder Agent Graph
6565
```mermaid
6666
---
6767
config:
@@ -91,20 +91,20 @@ graph TD;
9191
## Agent Responsibilities
9292

9393
- **Planner Agent**:
94-
- Takes user questions and creates execution plans
95-
- Routes tasks to appropriate worker agents
96-
- Manages the execution flow and state tracking
97-
- Returns final results to the user
94+
- Takes user questions and formulates execution plans.
95+
- Routes tasks to appropriate worker agents.
96+
- Manages execution flow and state tracking.
97+
- Returns final results to the user.
9898

9999
- **Researcher Agent**:
100-
- Retrieves information using a Tavily search tool
101-
- Provides factual content, definitions, and formulas
102-
- Never performs calculations (strictly enforced)
100+
- Retrieves information using a Tavily search tool.
101+
- Provides factual content, definitions, and formulas.
102+
- Does not perform calculations (strictly enforced).
103103

104104
- **Coder Agent**:
105-
- Performs calculations using Python code execution
106-
- Evaluates formulas with specific input values
107-
- Returns precise numerical results
105+
- Executes calculations using Python code.
106+
- Evaluates formulas with specific input values.
107+
- Returns precise numerical results.
108108

109109
## Usage
110110

@@ -118,7 +118,7 @@ uipath run planner '{"question": "First, please state the Pythagorean theorem. G
118118

119119
### Debugging Individual Agents
120120

121-
You can debug individual agents by directly invoking them:
121+
You can debug individual agents by invoking them directly:
122122

123123
#### Researcher Agent
124124
Run the researcher agent with:
@@ -136,15 +136,100 @@ uipath run coder '{"messages":[{"content":"Let me help you state the Pythagorean
136136

137137
## Sample Workflow
138138

139-
1. User submits a question about the Pythagorean theorem
139+
1. User submits a question about the Pythagorean theorem.
140140
2. Planner creates an execution plan with two steps:
141-
- Step 1: Researcher agent retrieves the Pythagorean theorem formula
142-
- Step 2: Coder agent applies the formula to calculate the result for a=2, b=3
143-
3. Planner executes Step 1 by invoking the researcher agent
144-
4. Researcher agent returns the formula a² + b² = c²
145-
5. Planner executes Step 2 by invoking the coder agent
146-
6. Coder agent calculates c = √(2² + 3²) = √(4 + 9) = √13 ≈ 3.606
147-
7. Planner combines the responses and returns the final answer to the user
141+
- Step 1: Researcher agent retrieves the Pythagorean theorem formula.
142+
- Step 2: Coder agent applies the formula to calculate the result for a=2, b=3.
143+
3. Planner executes Step 1 by invoking the researcher agent.
144+
4. Researcher agent returns the formula a² + b² = c².
145+
5. Planner executes Step 2 by invoking the coder agent.
146+
6. Coder agent calculates c = √(2² + 3²) = √(4 + 9) = √13 ≈ 3.606.
147+
7. Planner combines the responses and returns the final answer to the user.
148+
149+
## Steps to Execute Project on UiPath Cloud Platform
150+
151+
1. **Clone the Repository**
152+
```bash
153+
git clone https://github.com/UiPath/uipath-langchain-python.git
154+
```
155+
156+
2. **Navigate to the Sample Directory**
157+
- **Windows:**
158+
```bash
159+
cd .\uipath-langchain-python\samples\multi-agent-planner-researcher-coder-distributed
160+
```
161+
162+
- **Unix-like Systems (Linux, macOS):**
163+
```bash
164+
cd ./uipath-langchain-python/samples/multi-agent-planner-researcher-coder-distributed
165+
```
166+
167+
3. **Create and Activate a Virtual Python Environment**
168+
```bash
169+
pip install uv
170+
uv venv -p 3.11 .venv
171+
.venv\Scripts\activate # Windows
172+
source .venv/bin/activate # Unix-like Systems
173+
uv sync
174+
```
175+
176+
4. **Authenticate with UiPath Cloud Platform**
177+
```bash
178+
uipath auth
179+
```
180+
> **Note:** After successful authentication in the browser, select the tenant for publishing the agent package.
181+
```
182+
Received log data
183+
Received authentication information
184+
Available tenants:
185+
0: cosmin
186+
1: DefaultTenant
187+
2: Demo
188+
3: lucian
189+
4: Solutions
190+
5: SolutionsTest
191+
6: Test
192+
7: TestRoles
193+
Select tenant: 2
194+
```
195+
196+
5. **Package and Publish Agents**
197+
```bash
198+
uipath pack
199+
uipath publish
200+
```
201+
> **Note:** You will need to select the feed for publishing:
202+
```
203+
Select feed type:
204+
0: Tenant package feed
205+
1: Personal workspace
206+
Select feed: 0
207+
```
208+
209+
6. **Create Agent Processes in Orchestrator**
210+
- **Planner Agent**
211+
![planner-agent-package-overview](../../docs/sample_images/planner-agent-package-overview.png)
212+
![planner-agent-process-configuration](../../docs/sample_images/planner-agent-process-configuration.png)
213+
214+
- **Researcher Agent**
215+
![researcher-agent-package-overview](../../docs/sample_images/researcher-agent-package-overview.png)
216+
![researcher-agent-process-configuration](../../docs/sample_images/researcher-agent-process-configuration.png)
217+
218+
- **Coder Agent**
219+
![coder-agent-package-overview](../../docs/sample_images/coder-agent-package-overview.png)
220+
![coder-agent-process-configuration](../../docs/sample_images/coder-agent-process-configuration.png)
221+
222+
> **Note:** Ensure that the display names for the coder and researcher agent processes are *coder-agent* and *researcher-agent*.
223+
224+
7. **Run the Planner Agent with Any Input Question**
225+
> **Tip:** For a five-step action plan, consider using the following input:
226+
```
227+
Could you find a Python solution for the N-Queens puzzle for N=8? Please analyze why this solution works,
228+
considering the key programming concepts it employs.
229+
Then, revise the solution to handle a dynamic value of N, where N is any positive integer.
230+
After that, research the time and space complexity of this new solution.
231+
Lastly, demonstrate this revised Python solution with N=10.
232+
```
148233

149234
## Implementation Details
150235

samples/multi-agent-planner-researcher-coder-distributed/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "multi-agents-distributed"
33
version = "0.0.1"
44
description = "Supervisor agent that coordinates between a researcher and a coder"
55
authors = [
6-
{ name = "Radu Mocanu" }
6+
{ name = "Radu Mocanu", email = "radu.mocanu@uipath.com" }
77
]
88
requires-python = ">=3.10"
99
dependencies = [

0 commit comments

Comments
 (0)