Executive AI Assistant (EAIA) is an AI agent that attempts to do the job of an Executive Assistant (EA).
For a hosted version of EAIA, see documentation here.
Table of contents
- Fork and then clone this repo. Note: make sure to fork it first, as in order to deploy this you will need your own repo.
- Create a Python virtualenv and activate it (e.g.
pyenv virtualenv 3.11.1 eaia
,pyenv activate eaia
) - Run
pip install -e .
to install dependencies and the package
- Export OpenAI API key (
export OPENAI_API_KEY=...
) - Export Anthropic API key (
export ANTHROPIC_API_KEY=...
) - Enable Google
- Enable the API
- Enable Gmail API if not already by clicking the blue button
Enable the API
- Enable Gmail API if not already by clicking the blue button
- Authorize credentials for a desktop application
- Download the client secret. After that, run these commands:
mkdir eaia/.secrets
- This will create a folder for secretsmv ${PATH-TO-CLIENT-SECRET.JSON} eaia/.secrets/secrets.json
- This will move the client secret you just created to that secrets folderpython scripts/setup_gmail.py
- This will generate another file ateaia/.secrets/token.json
for accessing Google services.
- Enable the API
- Export LangSmith API key (
export LANGSMITH_API_KEY
)
The configuration for EAIA can be found in eaia/main/config.yaml
. Every key in there is required. These are the configuration options:
email
: Email to monitor and send emails as. This should match the credentials you loaded above.full_name
: Full name of username
: First name of userbackground
: Basic info on who the user istimezone
: Default timezone the user is inschedule_preferences
: Any preferences for how calendar meetings are scheduled. E.g. length, name of meetings, etcbackground_preferences
: Any background information that may be needed when responding to emails. E.g. coworkers to loop in, etc.response_preferences
: Any preferences for what information to include in emails. E.g. whether to send calendly links, etc.rewrite_preferences
: Any preferences for the tone of your emailstriage_no
: Guidelines for when emails should be ignoredtriage_notify
: Guidelines for when user should be notified of emails (but EAIA should not attempt to draft a response)triage_email
: Guidelines for when EAIA should try to draft a response to an email
You can run EAIA locally. This is useful for testing it out, but when wanting to use it for real you will need to have it always running (to run the cron job to check for emails). See this section for instructions on how to run in production (on LangGraph Cloud)
- Install development server
pip install -U "langgraph-cli[inmem]"
- Run development server
langgraph dev
Let's now kick off an ingest job to ingest some emails and run them through our local EAIA.
Leave the langgraph dev
command running, and open a new terminal. From there, get back into this directory and virtual environment. To kick off an ingest job, run:
python scripts/run_ingest.py --minutes-since 120 --rerun 1 --early 0
This will ingest all emails in the last 120 minutes (--minutes-since
). It will NOT break early if it sees an email it already saw (--early 0
) and it will
rerun ones it has seen before (--rerun 1
). It will run against the local instance we have running.
After we have run it locally, we can interract with any results.
- Go to Agent Inbox
- Connect this to your locally running EAIA agent:
- Click into
Settings
- Input your LangSmith API key.
- Click
Add Inbox
- Set
Assistant/Graph ID
tomain
- Set
Deployment URL
tohttp://127.0.0.1:2024
- Give it a name like
Local EAIA
- Press
Submit
- Set
- Click into
You can now interract with EAIA in the Agent Inbox.
These instructions will go over how to run EAIA in LangGraph Cloud. You will need a LangSmith Plus account to be able to access LangGraph Cloud
If desired, you can always run EAIA in a self-hosted manner using LangGraph Platform Lite or Enterprise.
- Make sure you have a LangSmith Plus account
- Navigate to the deployments page in LangSmith
- Click
New Deployment
- Connect it to your GitHub repo containing this code.
- Give it a name like
Executive-AI-Assistant
- Add the following environment variables
OPENAI_API_KEY
ANTHROPIC_API_KEY
GMAIL_SECRET
- This is the value ineaia/.secrets/secrets.json
GMAIL_TOKEN
- This is the value ineaia/.secrets/token.json
- Click
Submit
and watch your EAIA deploy
Let's now kick off a manual ingest job to ingest some emails and run them through our LangGraph Cloud EAIA.
First, get your LANGGRAPH_CLOUD_URL
To kick off an ingest job, run:
python scripts/run_ingest.py --minutes-since 120 --rerun 1 --early 0 --prod ${LANGGRAPH-CLOUD-URL}
This will ingest all emails in the last 120 minutes (--minutes-since
). It will NOT break early if it sees an email it already saw (--early 0
) and it will
rerun ones it has seen before (--rerun 1
). It will run against the prod instance we have running (--prod ${LANGGRAPH-CLOUD-URL}
)
After we have deployed it, we can interract with any results.
- Go to Agent Inbox
- Connect this to your locally running EAIA agent:
- Click into
Settings
- Click
Add Inbox
- Set
Assistant/Graph ID
tomain
- Set
Deployment URL
to your deployment URL - Give it a name like
Prod EAIA
- Press
Submit
- Set
- Click into
You probably don't want to manually run ingest all the time. Using LangGraph Platform, you can easily set up a cron job that runs on some schedule to check for new emails. You can set this up with:
python scripts/setup_cron.py --url ${LANGGRAPH-CLOUD-URL}
If you want to control more of EAIA besides what the configuration allows, you can modify parts of the code base.
Reflection Logic
To control the prompts used for reflection (e.g. to populate memory) you can edit eaia/reflection_graphs.py
Triage Logic
To control the logic used for triaging emails you can edit eaia/main/triage.py
Calendar Logic
To control the logic used for looking at available times on the calendar you can edit eaia/main/find_meeting_time.py
Tone & Style Logic
To control the logic used for the tone and style of emails you can edit eaia/main/rewrite.py
Email Draft Logic
To control the logic used for drafting emails you can edit eaia/main/draft_response.py