Skip to content

Repository files navigation

Sales Agent Example

Build an agent that sells products to prospects via email.

Requirements

Setup

Ngrok

  1. Sign up for a free Ngrok account at ngrok.com
  2. Get your Ngrok auth token
  3. Claim your free static domain

This will create a persistent domain (your-subdomain.ngrok-free.app) that you can use to receive AgentMail webhooks.

Config

Create a .env file with the following content:

AGENTMAIL_API_KEY=your-agentmail-api-key
OPENAI_API_KEY=your-openai-api-key
NGROK_AUTHTOKEN=your-ngrok-authtoken

INBOX_USERNAME=your-inbox-username
WEBHOOK_DOMAIN=your-webhook-domain

Export enivornment variables in the .env file

export $(grep -v '^#' .env | xargs)

AgentMail

Create an inbox

curl -X POST https://api.agentmail.to/v0/inboxes \
     -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
     -H "Content-Type: application/json" \
     -d "{
  \"username\": \"$INBOX_USERNAME\",
  \"display_name\": \"Email Agent\"
}"

Create a webhook

// Edited version due to previous error

curl -X POST https://api.agentmail.to/v0/webhooks \
     -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://'"$WEBHOOK_DOMAIN"'/webhooks",
    "inbox": "'"$INBOX_USERNAME"'@agentmail.to",
    "event_types": ["message.received"] 
  }'

Install

uv venv
source .venv/bin/activate
uv pip install .

Run

Start the server

python main.py

Now send an email to [email protected] with a product to sell and a prospect to sell to. You should provide the name and email address of the prospect.

The Sales Agent will autonomously email the prospect with a sales pitch, answer any of the prospect's questions, and report any intent signals back to you.

Note: You should restart the python script after every sales sequence as the agent stores context in local memory.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages