Artificial Intelligence

Using Agent Orchestration to Qualify Sales Leads

Qualifying leads and managing follow-ups takes serious time — but you can offload most of that work to a set of AI agents working together. In this guide, you'll learn how to build an orchestration agent in Xano that coordinates multiple single-task AI agents to enrich leads, score them against your Ideal Customer Profile (ICP), pair them with the right sales rep, and draft an outreach email. All from a single trigger.

Understanding Agent Orchestration

Agent orchestration means building several focused, single-task AI agents and then creating one "orchestrator" that calls each of them in sequence to complete a larger workflow. Instead of one bloated agent trying to do everything, each sub-agent has a clear job. The orchestration agent acts as the conductor, deciding when and how to use each tool.

In this example, your workflow breaks down into four jobs: getting lead data, searching the web for enrichment, fetching ICP data to assign a score, and — if that score clears a threshold of 3 — matching the lead with a rep and drafting an email.

Building the Web Search Agent

Your first sub-agent is a web search agent. You'll create it inside the Xano AI tab using Google's Gemini 2.5 Flash model with a low temperature (0.2) to keep responses deterministic. The system prompt instructs it to return a structured JSON object containing the lead's company size, title, and any recent relevant news.

The key setting here is search grounding — enabling this checkbox gives your agent access to live internet search. One important note: when grounding is enabled, the agent can't use other tools, so its best role is as a callable tool for your orchestration agent rather than a standalone agent.

You'll then wrap this agent as a tool in Xano's tools panel, defining its inputs (lead name, company name, and website) so the orchestrator knows exactly how to call it.

Connecting All the Tools to the Orchestration Agent

With the web search agent ready, you'll create the orchestration agent itself. Its system prompt outlines the full workflow: get lead data, search the web, compare against ICP data, assign a score, and conditionally match a rep. The only input it needs from you is a lead_id — everything else it figures out on its own.

You'll connect several tools to it:

  • Get Lead Data — retrieves the lead's name, company, and website from your database
  • Agent Web Search — calls your web search sub-agent for enrichment
  • Get ICP Data — pulls your ideal customer profile criteria
  • Assign Score — scores the enriched lead from 1 to 5
  • Agent Match Rep — calls your rep-matching sub-agent if the score exceeds 3

Testing Your Orchestration Workflow

To test everything, you'll create a simple function in Xano's library that calls the orchestration agent with a hard-coded lead_id. When you run it, you can watch the agent step through each tool call in order — exactly as your system prompt defined. Once complete, you'll see the lead scored and marked as processed in your database, with a rep assigned and a draft email ready to send.

The only thing left for your sales team to do? Click send.

Sign up for Xano

Join 100,000+ people already building with Xano.
Start today and scale to millions.