# Sales Automation Agent System

An AI-powered sales automation system that generates personalized cold emails for ComplAI's SOC 2 compliance tool using multi-agent workflows.

## System Logic

The application follows a 4-stage pipeline:

1. **Customer Filtering**: A picker agent evaluates each contact's relevance based on their role and company position
2. **Email Generation**: Three specialized sales agents independently compose personalized emails with different styles (professional, engaging, concise)
3. **Email Selection**: A picker agent selects the most effective email from the three options
4. **Formatting & Delivery**: An HTML formatter agent converts the email to branded HTML and sends it via SendGrid

## Implementation Comparison

### OpenAI Agents SDK (`sales_automation.py`)

```python
# Agent creation
agent = Agent(
    name="Customer Picker",
    instructions="System prompt here...",
    model="gpt-4o-mini"
)

# Execution
result = await Runner.run(agent, message)
output = result.final_output

# Tools
@function_tool
def send_email(body: str):
    # Implementation
```

### Amazon Strands Agents (`sales_automation_strands.py`)

```python
# Model configuration
model = OpenAIModel(
    client_args={"api_key": os.environ.get('OPENAI_API_KEY')},
    model_id='gpt-5-mini'
)

# Agent creation
agent = Agent(
    name="Customer Picker",
    system_prompt="System prompt here...",
    model=model,
    callback_handler=None
)

# Execution
result = await agent.invoke_async(message)
output = str(result)

# Tools
@tool
def send_email(body: str):
    # Implementation
```

## Key Differences

| Feature | OpenAI Agents | Strands Agents |
|---------|---------------|----------------|
| **Model Setup** | Built-in model selection | Explicit model configuration with multiple providers |
| **Agent Creation** | `instructions` parameter | `system_prompt` parameter |
| **Execution** | `Runner.run()` with result object | `agent.invoke_async()` with direct output |
| **Tool Decorator** | `@function_tool` | `@tool` |
| **Multi-Model Support** | OpenAI only | OpenAI, Anthropic, Ollama, Bedrock (Default provider), etc |
| **Output Handling** | `result.final_output` | `str(result)` |

[Reference and Documentation](https://strandsagents.com/latest/)

## Setup

1. Install dependencies:
```bash
pip install pandas python-dotenv sendgrid
# For OpenAI version:
pip install agents
# For Strands version:
pip install strands-agents
# optional install not needed for this example
pip install strands-agents-tools 
```

2. Configure environment variables:
```bash
OPENAI_API_KEY=your_key
ANTHROPIC_API_KEY=your_key  # For Strands version
SENDGRID_API_KEY=your_key
```

3. Update sender email in both files

## Usage

```bash
# OpenAI version
python sales_automation.py

# Strands version  
python sales_automation_strands.py
```

## Testing

```bash
pytest test_sales_automation.py
```

The Strands implementation demonstrates multi-provider model support, using OpenAI for decision-making, Anthropic for creative email composition, and Ollama for formatting tasks.

The example aimaginary brochure was created with gpt-5-mini and fake contact lists were generated by Llama 3.1. 