Skip to content

Commit 92da6c1

Browse files
authored
docs: fix readmes for examples (#49)
2 parents 6b985a0 + 672e6c3 commit 92da6c1

File tree

4 files changed

+132
-83
lines changed

4 files changed

+132
-83
lines changed

examples/README.md

-46
This file was deleted.

examples/email_reviewer/README.md

+46-22
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,56 @@
1-
# Email Reviewer (LlamaIndex)
1+
# Email Reviewer
22

3-
A simple agent written in LlamaIndex (using a `Workflow`) in charge of reviewing and correcting an email
4-
5-
## Agent Input
6-
- `email`: (str) Email to review
7-
- `audience`: (str) one of `general`, `technical`, `business`, `academic`
8-
9-
## Agent Output
10-
- `correct`: (bool) If given email does not contain writing errors and it targets the audience correctly.
11-
- `corrected_email`: (opt, str) The corrected email
3+
The Email Reviewer Agent is a demonstration AI agent developed with Llama-index, designed to review email to address a specific target audience.
124

135
## Requirements
146

15-
- LlamaIndex: https://docs.llamaindex.ai/en/stable/getting_started/installation/
16-
17-
## Agent local deployment
18-
19-
1) Copy and adapt `.env`: `cp .env.example .env`
20-
1) Install llama-deploy: `pip install llama_deploy`
21-
1) Run apiserver:
22-
- `python -m llama_deploy.apiserver`
23-
OR
24-
- (docker): `docker run -p 4501:4501 -v .:/opt/quickstart -w /opt/quickstart llamaindex/llama-deploy:main`
25-
1) Create deployment config from template: `sed "s|\${PWD}|$(pwd)|g" "email_reviewer.tmpl.yaml" > "email_reviewer.yaml"`
26-
1) Deploy the workflow: `llamactl deploy email_reviewer.yaml`
7+
- LlamaIndex: https://docs.llamaindex.ai/en/stable/getting_started/installation/
8+
- **Azure OpenAI API Key**
9+
- **Python 3.9 or higher**
10+
- **Poetry**
11+
12+
## Running the Email Reviewer agent using LlamaDeploy
13+
14+
15+
* Copy and adapt `.env`:
16+
```
17+
cp .env.example .env
18+
```
19+
* Install LlamaDeploy:
20+
```
21+
pip install llama_deploy
22+
```
23+
* Run LlamaDeploy:
24+
```
25+
python -m llama_deploy.apiserver`
26+
```
27+
or
28+
```
29+
docker run -p 4501:4501 -v .:/opt/quickstart -w /opt/quickstart llamaindex/llama-deploy:main
30+
```
31+
* Create deployment config from template:
32+
```
33+
sed "s|\${PWD}|$(pwd)|g" "email_reviewer.tmpl.yaml" > "email_reviewer.yaml"
34+
```
35+
36+
* Deploy the workflow:
37+
```
38+
llamactl deploy email_reviewer.yaml
39+
```
40+
41+
## Running the Email Agent using Agent Workflow Server
42+
43+
* Copy and adapt `.env`: `cp .env.example .env`
44+
* Make sure that the workflow server manager cli (`wfsm`) is added to your path
45+
* Start the workflow server
46+
```
47+
cd deploy;
48+
wfsm deploy -m ./email_reviewer.json -e .mailcomposer.env
49+
```
2750
2851
## Test agent
2952
3053
You can use `usage_example.py` to use the Llama Client SDK to call the agent with given inputs (see source code):
3154
`python usage_example.py `
3255
56+

examples/mailcomposer/README.md

+20-12
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
1-
# Compose Email Agent
1+
# Email Composer Agent
22

3-
The Compose Email Agent is built using LangGraph to facilitate interactive email composition.
4-
It collects email details by continuously interacting with the user until tha latter confirm that the email is ready, then provides the finalized email text.
5-
6-
## Features
7-
8-
- Utilizes Azure OpenAI to guide email composition.
9-
- Demonstrates the use of LangGraph for managing conversational state and flow.
10-
- Provides a LangGraph server setup for interacting via ACP protocol APIs.
3+
The Email Composer Agent is a demonstration AI agent developed with LangGraph, designed to assist in the composition of emails.
4+
It gathers necessary email details through ongoing user engagement in a chat format until the user affirms that the email is complete. Subsequently, it delivers the finalized email text.
115

126
## Prerequisites
137

148
Before running the application, ensure you have the following:
159

16-
- **Azure OpenAI API Key**: Set up as an environment variable.
17-
- **Poetry**: A tool for dependency management and packaging in Python.
10+
- **Azure OpenAI API Key**
11+
- **Python 3.9 or higher**
12+
- **Poetry**
1813

14+
## Running the Email Agent directly
15+
* Install dependencies
16+
```
17+
poetry install
18+
```
1919
20+
* Run the agent
21+
```
22+
export AZURE_OPENAI_MODEL=gpt-4o-mini
23+
export AZURE_OPENAI_API_KEY=***YOUR_OPENAI_API_KEY***
24+
export AZURE_OPENAI_ENDPOINT=***YOUR_OPENAI_ENDPOINT***
25+
export OPENAI_API_VERSION=2024-07-01-preview
26+
poetry run python main.py
27+
```
2028
2129
## Running the Email Agent using Agent Workflow Server
2230
@@ -25,7 +33,7 @@ Before running the application, ensure you have the following:
2533
echo "
2634
AZURE_OPENAI_MODEL=gpt-4o-mini
2735
AZURE_OPENAI_API_KEY=***YOUR_OPENAI_API_KEY***
28-
AZURE_OPENAI_ENDPOINT=https://smith-project-agents.openai.azure.com
36+
AZURE_OPENAI_ENDPOINT=***YOUR_OPENAI_ENDPOINT***
2937
OPENAI_API_VERSION=2024-07-01-preview
3038
API_HOST=0.0.0.0
3139
" > deploy/.mailcomposer.env

examples/marketing-campaign/README.md

+66-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,68 @@
1-
poetry run acp generate-agent-models examples/marketing-campaign/deploy/sendgrid.json --output-dir examples/marketing-campaign/src/marketing_campaign --model-file-name sendgrid.py
1+
# Marketing Campaign Manager
2+
3+
The Marketing Campaign Manager is a demonstration AI agent developed with LangGraph, designed to assist in composing and sending emails for a marketing campaign.
4+
5+
It performs the following actions:
6+
* It gathers necessary campaign details from the user through a chat.
7+
* Compose an email leveraging the [Email Composer Agent](../mailcomposer/) as a remote ACP agent.
8+
* It leverages the [IO Mapper Agent](https://github.com/agntcy/iomapper-agnt) to adapt Email Composer Agent output to Email Reviewer Agent.
9+
* Reviews the email leveraging the [Email Reviewer Agent](../email_reviewer/) as a remote ACP agent.
10+
* Send the email to the configured recipient through Twilio sendgrid leveraging the [API Bridge Agent](https://github.com/agntcy/api-bridge-agnt)
11+
12+
## Prerequisites
13+
14+
Before running the application, ensure you have the following:
15+
16+
- **Azure OpenAI API Key**
17+
- **Python 3.9 or higher**
18+
- **Poetry**
19+
20+
## Running the Marketing Campaign Manager
21+
22+
### Preliminary step: Deploying API Bridge Agent
23+
24+
Run the API Bridge Agent configured with sendgrid. See [instructions](https://docs.agntcy.org/pages/syntactic_sdk/api_bridge_agent.html#an-example-with-sendgrid-api)
25+
26+
27+
### Running the agent directly
28+
* Deploy agentic dependencies first:
29+
* Run Email Composer Agent through the Agent Workflow Server. See [instructions](../mailcomposer/README.md#running-the-email-agent-using-agent-workflow-server).
30+
* Run Email Reviewer Agent through the Agent Workflow Server. See [instructions](../email_reviewer/README.md#running-the-email-agent-using-agent-workflow-server).
31+
* Install python dependencies
32+
```
33+
poetry install
34+
```
35+
* Run the agent
36+
```
37+
export AZURE_OPENAI_MODEL=gpt-4o-mini
38+
export AZURE_OPENAI_API_KEY=***YOUR_OPENAI_API_KEY***
39+
export AZURE_OPENAI_ENDPOINT=***YOUR_OPENAI_ENDPOINT***
40+
export OPENAI_API_VERSION=2024-07-01-preview
41+
export SENDGRID_API_KEY=***YOUR_SENDGRID_API_KEY***
42+
export MAILCOMPOSER_HOST=***URL TO EMAIL COMPOSER WORKFLOW SERVER e.g. http://0.0.0.0:10100***
43+
export EMAIL_REVIEWER_HOST=***URL TO EMAIL REVIEWER WORKFLOW SERVER e.g. http://0.0.0.0:10100***
44+
export MAILCOMPOSER_AGENT_ID==***EMAIL COMPOSER ID**
45+
export EMAIL_REVIEWER_AGENT_ID=***EMAIL REVIEWER ID**
46+
export SENDGRID_HOST=***URL TO API BRIDGE AGENT***
47+
48+
poetry run python src/marketing_campaign/__main__.py
49+
```
50+
51+
## Running the Email Agent using Agent Workflow Server
52+
53+
* Create an environment variable file with the variables described above
54+
```commandline
55+
echo "
56+
AZURE_OPENAI_MODEL=gpt-4o-mini
57+
...
58+
...
59+
" > deploy/.mcm.env
60+
```
61+
* Make sure that the workflow server manager cli (`wfsm`) is added to your path
62+
* Start the workflow server
63+
```
64+
cd deploy;
65+
wfsm deploy -m ./mailcomposer.json -e ./.mcm.env
66+
```
267
3-
poetry run acp generate-agent-models examples/mailcomposer/deploy/mailcomposer.json --output-dir examples/marketing-campaign/src/marketing_campaign --model-file-name mailcomposer.py
468
5-
poetry run acp generate-agent-models examples/email_reviewer/deploy/email_reviewer.json --output-dir examples/marketing-campaign/src/marketing_campaign --model-file-name email_reviewer.py

0 commit comments

Comments
 (0)