Skip to content

Implementation of a Sales Assistant Agent using SerpApi Search, HubSpot Integrations and OpenAI models.

Notifications You must be signed in to change notification settings

serpapi/sales-assistant-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sales Assistant Agent

AI sales assistant that eliminates the "Context Gap" by combining HubSpot CRM data with real-time web search in one autonomous loop. Instead of manually checking CRM records and searching for company news, the agent does both automatically and synthesizes personalized, high-intent outreach.

Installation

git clone <repository-url>
cd sales-assistant-mcp-agent
uv install

Requirements: Python 3.10+, OpenAI API key, SerpAPI key, HubSpot Private App token

Prerequisites

1. HubSpot Private App

  • Go to HubSpot Developer Portal → Private Apps
  • Create app with scopes: crm.objects.contacts.read, crm.objects.companies.read, crm.objects.notes.read
  • Copy access token

2. API Keys

3. Environment Setup

cp .env.example .env
# Edit .env with your keys:
OPENAI_API_KEY=your_openai_key
SERPAPI_API_KEY=your_serpapi_key  
HUBSPOT_ACCESS_TOKEN=your_hubspot_token

Running the Agent

Interactive Mode

uv run sales_agent.py

Example Prompts

> Prepare a briefing for my meeting with InnovateTech
> Research acme.com and draft an outreach email
> Look up john@company.com and get their interaction history
> Find companies in the AI space that raised funding recently

Single Query

uv run sales_agent.py -q "Research Microsoft and check our contacts there"

Advanced Options

uv run sales_agent.py -m gpt-4o-mini  # Use smaller model
uv run sales_agent.py -d             # Debug mode
uv run sales_agent.py -o history.json # Save conversation

How It Works: Plan-Execute-Synthesize

Example: "Prepare a briefing for InnovateTech meeting"

  1. Internal Context: Searches HubSpot → finds last contact was 3 months ago about "cloud migration"
  2. External Research: Searches news → discovers "$50M Series B for AI infrastructure"
  3. Synthesis: Creates personalized talking points connecting past conversation to recent funding

Output: "Congrats on the Series B! When we discussed cloud migration in November, you mentioned scaling challenges. With this AI infrastructure funding, I'd love to show how our solution handles exactly the load you're planning for."

Supported Tools

  • Web Search: Google search for company research, news, market intelligence
  • News Search: Recent news with date filtering (last week/month)
  • HubSpot Company Search: Find companies by domain name
  • HubSpot Contact Lookup: Get contact details by email
  • Activity History: Retrieve interaction timeline (notes, calls, emails)

Troubleshooting

"Missing environment variables" → Check .env file format, no spaces around =

"Contact/Company not found" → Verify data exists in HubSpot, check Private App scopes

"API rate limits" → Agent auto-retries, reduce RESULT_LIMIT if needed

"OpenAI errors" → Verify API key and credits, use supported models (gpt-4o, gpt-4o-mini)

Debug issues: Run with -d flag for detailed logging

Testing

uv run main.py              # Quick test
uv run main.py --mode=full  # Complete test suite

About

Implementation of a Sales Assistant Agent using SerpApi Search, HubSpot Integrations and OpenAI models.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages