""" LMCProtocol Autonomous SDR Agent Recipe using CrewAI & LangChain. Executes sub-second spatial search and flaw detection in ~210 tokens. """ import os import requests from crewai import Agent, Task, Crew from langchain.tools import tool LMCP_API_KEY = os.getenv("LMCP_API_KEY", "lmcp_live_YOUR_KEY") @tool("LMCProtocol Spatial Search") def lmcp_search(query: str, location: str, missing_pixel: bool = True) -> str: """Queries local business telemetry, detects pixel & GA4 flaws, and generates 210-token diagnostic hooks.""" url = "https://lmcprotocol.com/v1/search" headers = { "Authorization": f"Bearer {LMCP_API_KEY}", "Content-Type": "application/json" } payload = { "query": query, "location": location, "limit": 5, "filters": { "missing_pixel": missing_pixel } } response = requests.post(url, json=payload, headers=headers, timeout=10) return response.text # Define Autonomous Outbound SDR Agent sdr_agent = Agent( role="Local Business Lead Generation Specialist", goal="Identify high-intent local businesses with technical marketing flaws and draft personalized icebreakers.", backstory="You are an expert B2B SDR who pitches Facebook ad services and web modernization to local contractors.", tools=[lmcp_search], verbose=True ) outreach_task = Task( description="Find 3 solar installers in Phoenix, AZ that lack Meta Pixels and generate cold email pitches using their verified flaw telemetry.", expected_output="A list of companies with decision-maker emails, detected flaw codes, and custom email intros.", agent=sdr_agent ) crew = Crew( agents=[sdr_agent], tasks=[outreach_task] ) if __name__ == "__main__": result = crew.kickoff() print("\n=== CrewAI Outreach Results ===") print(result)