Building multi-agent systems allow you to route requests across multiple specialized agents, each designed to handle specific types of tasks.
Plano makes it easy to build and scale these systems by managing the orchestration layer—deciding which agent(s) should handle each request—while you focus on implementing individual agent logic.
This guide shows you how to configure and implement multi-agent orchestration in Plano using a real-world example: a **Travel Booking Assistant** that routes queries to specialized agents for weather, flights, and currency exchange.
Plano's orchestration layer analyzes incoming prompts and routes them to the most appropriate agent based on user intent and conversation context. The workflow is:
1.**User submits a prompt**: The request arrives at Plano's agent listener.
2.**Agent selection**: Plano analyzes the prompt to determine user intent and complexity, and routes the request to the most suitable agent configured in your system—such as a weather agent, flight agent, or currency agent.
3.**Agent handles request**: The selected agent processes the prompt using its specialized logic and tools.
4.**Seamless handoffs**: For multi-turn conversations, Plano repeats the intent analysis for each follow-up query, enabling smooth handoffs between agents as the conversation evolves.
Let's walk through a complete multi-agent system: a Travel Booking Assistant that helps users plan trips by providing weather forecasts, flight information, and currency exchange rates. This system uses three specialized agents:
***Weather Agent**: Provides real-time weather conditions and forecasts
***Flight Agent**: Searches for flights between airports
***Currency Agent**: Provides currency exchange rates and conversions
description: Get real-time weather conditions and multi-day forecasts for any city worldwide using Open-Meteo API (free, no API key needed). Provides current temperature, multi-day forecasts, weather conditions, sunrise/sunset times, and detailed weather information. Understands conversation context to resolve location references from previous messages.
description: Get live flight information between airports using FlightAware AeroAPI. Shows real-time flight status, scheduled/estimated/actual departure and arrival times, gate and terminal information, delays, aircraft type, and flight status. Automatically resolves city names to airport codes (IATA/ICAO). Understands conversation context to infer origin/destination from follow-up questions. Supports queries like "What flights go from London to Seattle?" or "Do they fly out from Seattle?" (using context from previous messages).
description: Get real-time currency exchange rates and perform currency conversions using Frankfurter API (free, no API key needed). Provides latest exchange rates, currency conversions with amount calculations, and supports any currency pair. Automatically extracts currency codes from country names and conversation context. Understands pronouns like "their currency" when referring to previously mentioned countries. Uses standard 3-letter ISO currency codes (e.g., USD, EUR, GBP, JPY, PKR).
Agents are HTTP services that receive routed requests from Plano. Each agent implements the OpenAI Chat Completions API format, making them compatible with standard LLM clients.
Agents use LLMs to extract structured information from natural language queries. This enables them to understand user intent and extract parameters needed for API calls.
LOCATION_EXTRACTION_PROMPT = """You are a location extraction assistant. Your ONLY job is to extract the geographic location (city, state, country, etc.) from user messages.
CRITICAL RULES:
1. Extract ONLY the location name - nothing else
2. Return just the location name in plain text (e.g., "London", "New York", "Paris, France")
3. If the user mentions multiple locations, extract the PRIMARY location they're asking about
4. Ignore error messages, HTML tags, and assistant responses
5. If no clear location is found, return exactly: "NOT_FOUND"
return location if location != "NOT_FOUND" else "New York"
The Flight Agent extracts more complex information—origin, destination, and dates:
..code-block:: python
:caption:Flight Agent - Flight Information Extraction
FLIGHT_EXTRACTION_PROMPT = """You are a flight information extraction assistant. Extract flight-related information from user messages and convert it to structured data.
CRITICAL RULES:
1. Extract origin city/airport and destination city/airport from the message AND conversation context
2. Extract any mentioned dates or time references
3. PAY ATTENTION TO CONVERSATION CONTEXT - THIS IS CRITICAL:
- If previous messages mention cities/countries, use that context to resolve pronouns and incomplete queries
- Example: Previous: "What's the weather in Istanbul?" → Current: "Do they fly out from Seattle?"
→ This likely means: origin=Istanbul, destination=Seattle
* Use async HTTP clients (like ``httpx.AsyncClient``) for non-blocking API calls
* Transform external API responses into consistent, structured formats
* Handle errors gracefully with fallback values
* Cache or validate data when appropriate (e.g., airport code validation)
Preparing Context and Generating Responses
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Agents combine extracted information, API data, and conversation history to generate responses:
..code-block:: python
:caption:Weather Agent - Context Preparation and Response Generation
SYSTEM_PROMPT = """You are a professional weather information assistant. Your role is to provide accurate, clear, and helpful weather information based on the structured weather data provided to you.
CRITICAL INSTRUCTIONS:
1. You will receive weather data as JSON in a system message
2. Present temperatures in both Celsius and Fahrenheit when available
3. Use natural, conversational language
4. Never invent or guess weather data - only use what's provided
if chunk.choices and chunk.choices[0].delta.content:
content = chunk.choices[0].delta.content
yield f"data: {chunk.model_dump_json()}\n\n"
yield "data: [DONE]\n\n"
**Key Points:**
* Use system messages to provide structured data to the LLM
* Include full conversation history for context-aware responses
* Stream responses for better user experience
* Route all LLM calls through Plano's gateway for consistent behavior and observability
Handling Conversation Context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
One of the most powerful features of multi-agent systems is handling follow-up questions that reference previous context. The Flight Agent demonstrates this:
* Include conversation history in extraction prompts
* Use pronouns and references from context (e.g., "they", "there", "that country")
* Limit context window to recent messages (e.g., last 10) for efficiency
* Handle cases where context is insufficient gracefully
How Requests Flow
-----------------
Here's how a complete request flows through the Travel Booking system:
1.**User sends a prompt**: "What's the weather in London?"
2.**Plano analyzes intent**: Plano-Orchestrator analyzes the prompt and determines it should route to ``weather_agent`` based on the agent's description.
3.**Plano forwards request**: Plano sends the request to the correct agent with ``/v1/chat/completions``, along with the full conversation history.
4.**Weather Agent processes**:
a. Extracts location "London" from the message
b. Calls Open-Meteo API to get weather data
c. Prepares context with weather data
d. Calls Plano's LLM gateway to generate response
e. Streams response back to Plano
5.**Plano forwards response**: Plano streams the agent's response back to the user.
6.**Follow-up question**: User asks "Do they fly out from Seattle?"
7.**Plano routes again**: Plano-Orchestrator analyzes the new prompt and routes to ``flight_agent``.
8.**Flight Agent processes**:
a. Extracts flight info using conversation context (infers "they" = London)
b. Resolves airport codes (London → LHR, Seattle → SEA)
c. Calls FlightAware API to get flights
d. Generates response with flight information
9.**Seamless handoff**: The user experiences a smooth transition between agents without needing to repeat context.
Best Practices
--------------
**Write Clear Agent Descriptions**
Agent descriptions are used by Plano-Orchestrator to make routing decisions. Be specific about what each agent handles:
..code-block:: yaml
# Good - specific and actionable
- id: flight_agent
description: Get live flight information between airports using FlightAware AeroAPI. Shows real-time flight status, scheduled/estimated/actual departure and arrival times, gate and terminal information, delays, aircraft type, and flight status. Automatically resolves city names to airport codes (IATA/ICAO). Understands conversation context to infer origin/destination from follow-up questions.
# Less ideal - too vague
- id: flight_agent
description: Handles flight queries
**Use Conversation Context Effectively**
Include conversation history in your extraction and response generation:
To observe traffic to and from agents, please read more about :ref:`observability <observability>` in Plano.
By carefully configuring and managing your Agent routing and hand off, you can significantly improve your application's responsiveness, performance, and overall user satisfaction.