How to Route to Multiple Agents

Validated on 26 Jun 2025 • Last edited on 8 Jul 2025

GradientAI Platform lets you build fully-managed AI agents with knowledge bases for retrieval-augmented generation, multi-agent routing, guardrails, and more, or use serverless inference to make direct requests to popular foundation models.

Agent routing is the ability to reference other agents from the instruction of an agent. Different agents may be trained or optimized for specific tasks or have different domain expertise to handle different types of requests. Agent routing lets you unify multiple agents.

For example, you can have a parent travel agent that comprises of four independent child agents that work in conjunction. The top level general foundation model handles the pleasantries and routes user requests to the more specific trip planner, site help agent, and booking agent models. Suppose these agents are called Trip Planner, Site Help, Flight Booking, and Hotel Booking, respectively. The foundation models of each agent can be of different kind, meaning that the chat bot can integrate with other kinds of generative models such as a diffusion model to generate pictures.

We charge for tokens used by parent agents to determine whether the user questions need to be routed to a child agent and agents that answer user questions, which can be a parent agent or a child agent to which the question gets routed.

Add an Agent Route Using Automation

To add an agent route using the DigitalOcean API, you need the unique identifiers of the parent agent and one or more child agents that the parent agent routes to. To get a list of agents with their unique identifiers, use the /v2/gen-ai/agents} endpoint.

You also need to provide a name of the agent route and rules that to determine how to direct different inputs to the appropriate child agent. To view agent routes for the parent agent, use the /v2/gen-ai/agents/{uuid}/child_agents endpoint.

How to Add an Agent Route Using the DigitalOcean API
  1. Create a personal access token and save it for use with the API.
  2. Send a POST request to https://api.digitalocean.com/v2/gen-ai/agents/{parent_agent_uuid}/child_agents/{child_agent_uuid}.

cURL

Using cURL:

curl -X POST \
  -H "Content-Type: application/json"  \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/gen-ai/agents/1b418231-b7d6-11ef-bf8f-4e013e2ddde4/child_agents/6a09d603-b68d-11ef-bf8f-4e013e2ddde4" \
  -d '{
    "parent_agent_uuid": "1b418231-b7d6-11ef-bf8f-4e013e2ddde4",
    "child_agent_uuid": "6a09d603-b68d-11ef-bf8f-4e013e2ddde4",
    "route_name": "route-token-stat",
    "if_case": "for any token related statistics, use this route"
  }'
 

Add an Agent Route Using the Control Panel

To add agent routes to an agent from the control panel, click Agent Platform from the left menu and then click on the agent you want to add the agent route to. In the Resources tab, scroll to the Agent Routes section and click Add Agent Route. In the Add Agent Route window, specify the following information:

  • Route name: Name of the agent route. For example, travel agent routes.

  • Route instructions: These instructions map your input types or attributes to the right agent which has the expertise for that input attribute. Create a set of rules that determine how different inputs are directed to the appropriate agent.

    Click to expand an example of route instructions.

    For the travel agent example, the following are some route instructions:

    • If input is to plan a trip, select the Trip Planner agent from the Route to drop-down list.
    • If input is a question about the travel website, select the Site Help agent from the Route to drop-down list.
    • If input is about booking a flight, select the Flight Booking agent from the Route to drop-down list.
    • If input is about booking a hotel, select the Hotel Booking agent from the Route to drop-down list.

Click Save to save the agent route. The agent route is displayed in the AGENT ROUTES table in the Resources tab.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.