Skip to main content
This tutorial guides you through creating a router that evaluates a request, applies a decision, and selects an endpoint through an algorithm action.

What You’ll Build

A router workflow that:
  1. Captures request context with a Signal.
  2. Normalizes routing context with a Projection.
  3. Applies a Decision rule.
  4. Selects an endpoint with an Algorithm.
  5. Exposes the router through v1/chat/completions.

Prerequisites

  • Access to Bud AI Foundry.
  • At least one project.
  • One or more deployed endpoints that can serve chat completion requests.
  • An API key for testing the router after it is saved.

Step 1: Create the Router Draft

  1. Navigate to Routers.
  2. Click + Router.
  3. Configure:
    • Name: support-routing-router
    • Description: Routes support prompts to the best available endpoint
  4. Click Next.
  5. Select the target project.
  6. Click Create Draft.

Step 2: Open the Router Detail Page

From the success screen, click View Router. The page loads:
  • Router metadata and status.
  • Current dag_config.
  • Action metadata from /routers/actions.
  • Data sources for clusters, models, projects, providers, credentials, and endpoints.

Step 3: Add a Signal

  1. Add a Signal action from the actions catalog.
  2. Name it Classify Request.
  3. Configure required parameters for the selected signal action.
  4. Leave it connected from the Trigger.
Signals represent inputs evaluated from the request. They are referenced by decisions instead of connecting to downstream nodes.

Step 4: Add a Projection

  1. Add a Projection action.
  2. Name it Build Routing Context.
  3. Configure the projection fields or template required by the action.
  4. Connect Trigger → Projection.
Use projections to shape request data into fields that are easier for decisions to consume.

Step 5: Add a Decision

  1. Add a Decision action.
  2. Name it Choose Route.
  3. Connect Trigger → Decision.
  4. Configure the decision rule to reference your signal or projection output.
Decisions evaluate in the routing layer. Do not chain Decision → Decision; use rule priority or branches inside the decision configuration instead.

Step 6: Add an Algorithm

  1. Add an Algorithm action.
  2. Name it Select Endpoint.
  3. Connect Decision → Algorithm.
  4. Configure endpoint selection parameters, such as endpoint lists, weights, or fallback order, depending on the action schema.

Step 7: Save the Router

Click Save. If validation fails, review the notification details and update the highlighted action parameters. When save succeeds, Bud marks the router as active.

Step 8: Test the Router

Open Use Router from the router card and copy a snippet. Use the router name as the model field:
{
  "model": "support-routing-router",
  "messages": [
    {
      "role": "user",
      "content": "Help me troubleshoot slow responses."
    }
  ]
}

Production Checklist

  • Use a descriptive router name because clients pass it as model.
  • Confirm every action has required parameters.
  • Verify Decision → Algorithm or Decision → Plugin connections.
  • Keep endpoint lists current as deployments change.
  • Test with representative prompts before sharing snippets with application teams.