Skip to content

Commit 467793d

Browse files
authored
Merge pull request #150 from UiPath/feature/email-agent
feat(email_agent): added a new Email Organizer Agent
2 parents e578bce + a035e20 commit 467793d

File tree

13 files changed

+4045
-0
lines changed

13 files changed

+4045
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
# from url: https://alpha.uipath.com/Ada/byoa/connections_/connections/<connection_key>
3+
OUTLOOK_CONNECTION_KEY=connection_key
4+
FOLDER_PATH_PLACEHOLDER=your_folder_escalation_app_path
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python Debugger: Current File",
9+
"type": "debugpy",
10+
"request": "launch",
11+
"program": "./src/email-organizer/main.py",
12+
"console": "integratedTerminal",
13+
"cwd": "${workspaceFolder}"
14+
}
15+
]
16+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Email Organizer Agent
2+
3+
Automate the organization of your Outlook inbox using AI-powered rule suggestions and UiPath integration.
4+
5+
## Features
6+
7+
- Fetches emails and folders from Outlook using Microsoft Graph API
8+
- Suggests new and improved rules for organizing emails
9+
- Human-in-the-loop approval for rule suggestions
10+
- Automatically creates folders and rules in Outlook
11+
- Extensible and configurable via `pyproject.toml` and environment variables
12+
13+
## Getting Started
14+
15+
### 1. Clone the Repository
16+
17+
```sh
18+
git clone https://github.com/your-org/uipath-langchain-python.git
19+
cd uipath-langchain-python/samples/email-organizer-agent
20+
```
21+
22+
### 2. Set Up Python Environment
23+
24+
```sh
25+
python -m venv .venv
26+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
27+
pip install -r requirements.txt
28+
```
29+
30+
Or use `pyproject.toml` with pip:
31+
```sh
32+
pip install .
33+
```
34+
35+
### 3. Configure Environment
36+
37+
- Copy `.env.template` to `.env` and fill in your secrets (API keys, tokens, etc.)
38+
- Update `pyproject.toml` as needed
39+
For `OUTLOOK_CONNECTION_KEY=connection_key`, follow this guide: [UiPath Integration Service Connections](https://docs.uipath.com/integration-service/automation-cloud/latest/user-guide/connections)
40+
41+
### 4. Run the Agent
42+
43+
```sh
44+
uipath run agent --file ./input.json
45+
```
46+
### 5. Resume
47+
48+
To approve the rules and commit them use:
49+
```sh
50+
uipath run agent true --resume
51+
```
52+
53+
### Deployment Guide
54+
55+
To run the email-organizer-agent on the UiPath Cloud Platform, follow this guide:
56+
[Ticket Classification Sample Deployment](https://github.com/UiPath/uipath-langchain-python/tree/main/samples/ticket-classification)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
config:
3+
flowchart:
4+
curve: linear
5+
---
6+
graph TD;
7+
__start__([<p>__start__</p>]):::first
8+
get_token(get_token)
9+
fetch_emails(fetch_emails)
10+
fetch_folders(fetch_folders)
11+
fetch_rules(fetch_rules)
12+
llm_analysis(llm_analysis)
13+
wait_for_approval(wait_for_approval)
14+
create_rules(create_rules)
15+
__end__([<p>__end__</p>]):::last
16+
__start__ --> get_token;
17+
fetch_emails --> fetch_folders;
18+
fetch_folders --> fetch_rules;
19+
fetch_rules --> llm_analysis;
20+
get_token --> fetch_emails;
21+
llm_analysis --> wait_for_approval;
22+
wait_for_approval -. &nbsp;END&nbsp; .-> __end__;
23+
wait_for_approval -.-> create_rules;
24+
create_rules --> __end__;
25+
classDef default fill:#f2f0ff,line-height:1.2
26+
classDef first fill-opacity:0
27+
classDef last fill:#bfb6fc
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"max_emails": 50,
3+
"max_rules": 5
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"dependencies": [
3+
"."
4+
],
5+
"graphs": {
6+
"agent": "./src/email_organizer/main.py:graph"
7+
},
8+
"env": ".env"
9+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
[project]
2+
name = "email-organizer-agent"
3+
version = "0.0.12"
4+
description = "Email Organizer Agent: Outlook rule creator"
5+
authors = [{ name = "John Doe", email = "john.doe@myemail.com" }]
6+
7+
requires-python = ">=3.10"
8+
dependencies = [
9+
"langgraph>=0.2.55",
10+
"langchain-anthropic>=0.3.8",
11+
"uipath>=2.0.79",
12+
"langchain-community>=0.3.21",
13+
"uipath-langchain>=0.0.123",
14+
]
15+
16+
[project.optional-dependencies]
17+
dev = ["mypy>=1.11.1", "ruff>=0.6.1"]
18+
19+
[build-system]
20+
requires = ["setuptools>=73.0.0", "wheel"]
21+
build-backend = "setuptools.build_meta"
22+
23+
[tool.setuptools.packages.find]
24+
where = ["src"]
25+
26+
[tool.setuptools.package-dir]
27+
"" = "src"
28+
29+
[tool.setuptools.package-data]
30+
"*" = ["py.typed"]
31+
32+
[tool.ruff]
33+
lint.select = [
34+
"E", # pycodestyle
35+
"F", # pyflakes
36+
"I", # isort
37+
"D", # pydocstyle
38+
"D401", # First line should be in imperative mood
39+
"T201",
40+
"UP",
41+
]
42+
lint.ignore = [
43+
"UP006",
44+
"UP007",
45+
"UP035",
46+
"D417",
47+
"E501",
48+
]
49+
50+
[tool.ruff.lint.per-file-ignores]
51+
"tests/*" = ["D", "UP"]
52+
53+
[[tool.uv.index]]
54+
name = "testpypi"
55+
url = "https://test.pypi.org/simple/"
56+
publish-url = "https://test.pypi.org/legacy/"
57+
explicit = true
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Email organizer agent package."""
2+
3+
from email_organizer.outlook_client import OutlookClient
4+
from email_organizer.main import graph, build_graph, GraphInput, GraphOutput
5+
6+
__all__ = ["OutlookClient", "graph", "build_graph", "GraphInput", "GraphOutput"]

0 commit comments

Comments
 (0)