Back to Blog
API & Developer Guides

How to Build an AI Agent That Finds Leads (OpenClaw Integration)

Published February 15, 2026

AI-Powered Lead Generation

AI agents are changing how we interact with APIs. Instead of writing scripts for each search, you can give an AI agent a natural language instruction like "find 50 dentist emails in Texas" and let it orchestrate the API calls automatically. The Easy Email Finder API is available as an OpenClaw skill, making it easy to integrate into any AI agent workflow.

What Is OpenClaw?

OpenClaw is a platform for building AI agent skills. Skills are modular capabilities that AI agents can invoke. The Easy Email Finder skill is published on ClawHub and can be added to any agent that supports the OpenClaw protocol. This means your AI agent can search for businesses, enrich them with emails, and manage credits through natural language commands.

Setting Up the Easy Email Finder Skill

First, install the Easy Email Finder skill from ClawHub. Then configure it with your API key from the Developer Dashboard.

# Install the skill via ClawHub CLI
clawhub install easy-email-finder

# Configure with your API key
clawhub config easy-email-finder --api-key eef_live_your_api_key_here

Using the Skill in an Agent

Once installed, the skill exposes several actions to your AI agent:

  • search_businesses: Find businesses by keyword and location
  • enrich_website: Find the email for a specific website
  • enrich_batch: Find emails for multiple websites at once
  • search_and_enrich: Combined search and email discovery
  • check_balance: View remaining credits

Building a Custom Agent with Python

Here is a minimal agent that uses the Easy Email Finder API directly with an LLM to handle natural language lead generation requests:

import json
import requests
from openai import OpenAI

EEF_KEY = "eef_live_your_api_key_here"
EEF_BASE = "https://easyemailfinder.com/api/v1"
EEF_HEADERS = {
    "Authorization": f"Bearer {EEF_KEY}",
    "Content-Type": "application/json"
}

client = OpenAI()

# Define the tools the agent can use
tools = [
    {
        "type": "function",
        "function": {
            "name": "search_and_enrich",
            "description": "Search for businesses and find their emails",
            "parameters": {
                "type": "object",
                "properties": {
                    "query": {"type": "string", "description": "Business type"},
                    "location": {"type": "string", "description": "City and state"},
                    "mode": {"type": "string", "enum": ["local", "digital"]}
                },
                "required": ["query", "location"]
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "check_balance",
            "description": "Check remaining API credits",
            "parameters": {"type": "object", "properties": {}}
        }
    }
]

def execute_tool(name: str, args: dict):
    if name == "search_and_enrich":
        resp = requests.post(f"{EEF_BASE}/search-and-enrich",
            headers=EEF_HEADERS, json=args)
        return resp.json()
    elif name == "check_balance":
        resp = requests.get(f"{EEF_BASE}/balance", headers=EEF_HEADERS)
        return resp.json()
    return {"error": "Unknown tool"}

def run_agent(user_message: str):
    messages = [
        {"role": "system", "content": "You are a lead generation assistant. "
         "Use the search_and_enrich tool to find business emails. "
         "Always report how many leads were found and credits used."},
        {"role": "user", "content": user_message}
    ]

    while True:
        response = client.chat.completions.create(
            model="gpt-4o",
            messages=messages,
            tools=tools
        )

        message = response.choices[0].message

        if message.tool_calls:
            messages.append(message)
            for call in message.tool_calls:
                args = json.loads(call.function.arguments)
                result = execute_tool(call.function.name, args)
                messages.append({
                    "role": "tool",
                    "tool_call_id": call.id,
                    "content": json.dumps(result)
                })
        else:
            return message.content

# Natural language lead generation
print(run_agent("Find dentist emails in Austin, TX"))
print(run_agent("How many credits do I have left?"))
print(run_agent("Search for web design agencies in New York using digital mode"))

How the Agent Works

The agent receives a natural language request, determines which API tool to call and with what parameters, executes the tool, and then summarizes the results in natural language. The LLM handles parsing intent and formatting output, while the Easy Email Finder API handles the actual lead discovery.

Multi-Step Agent Workflows

Agents can chain multiple tool calls. For example, a request like "Find 100 plumber emails across 5 Texas cities" would trigger the agent to:

  • Check the credit balance to ensure sufficient credits
  • Search and enrich in Austin, Dallas, Houston, San Antonio, and Fort Worth
  • Combine and deduplicate results
  • Report the total leads found and credits consumed

Advantages of the Agent Approach

Accessibility: Non-technical team members can use natural language instead of writing API calls. A sales rep can simply say "find me 20 restaurant leads in Chicago" without understanding REST APIs.

Flexibility: The agent can interpret ambiguous requests and make reasonable decisions about which mode to use, how many results to fetch, and how to format the output.

Composability: Combine the Easy Email Finder skill with other tools like CRM integration, email sending, or data analysis for complex workflows.

Next Steps

AI agents are becoming the primary interface for API-driven workflows. Start by building a simple agent with the code above, then extend it with additional tools for your specific workflow. For the underlying API details, see our getting started guide. For batch processing patterns, check our batch enrichment guide. Full API docs are at easyemailfinder.com/developer/docs.

Ready to find business emails?

Try Easy Email Finder free — get 5 credits to start.

Start Finding Emails

Related Posts