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.
git clone <repository-url>
cd sales-assistant-mcp-agent
uv installRequirements: Python 3.10+, OpenAI API key, SerpAPI key, HubSpot Private App token
- 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
- SerpAPI: Sign up at serpapi.com, get API key
- OpenAI: Get API key from platform.openai.com
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_tokenuv run sales_agent.py> 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 recentlyuv run sales_agent.py -q "Research Microsoft and check our contacts there"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 conversationExample: "Prepare a briefing for InnovateTech meeting"
- Internal Context: Searches HubSpot → finds last contact was 3 months ago about "cloud migration"
- External Research: Searches news → discovers "$50M Series B for AI infrastructure"
- 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."
- 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)
"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
uv run main.py # Quick test
uv run main.py --mode=full # Complete test suite