# Workflow Routing Agent

> A routing agent that classifies incoming requests and sends them to the right workflow with a confidence and reason, escalating ambiguous or high-risk ones to humans.

- **Category:** Task Orchestration
- **Difficulty:** Advanced
- **Setup time:** 45 min
- **Stacks:** Claude, LangGraph, OpenAI
- **Version:** 2.0.0 (updated 2026-06-21)
- **Source:** https://agent-kits.com/kit/workflow-router

## Overview

Classifies incoming requests and routes them to the right workflow, agent, queue, or team.

Attaches a confidence and a reason to each routing decision.

Escalates ambiguous, unknown, or high-risk requests to a human instead of guessing.

Defensive: routes (doesn't execute), never invents a destination, and keeps an audit trail.

## When to use it

- You have multiple workflows/agents/queues and need requests dispatched to the right one.
- You want confidence-based routing with ambiguous cases escalated.
- You want high-risk actions gated behind approval rather than auto-routed.
- You want an auditable front door to an automated system.

## When not to use it

- You want one agent to do the work end to end rather than dispatch it.
- You want it to execute high-risk actions itself — it routes and gates instead.
- You have no defined destinations to route to.
- You can't provide a human path for ambiguous or unknown requests.

## Architecture

- **Request intake** — Receives the incoming request to classify and route.
- **Intent classifier** — Determines what the request is asking for as the basis for routing.
- **Route matcher** — Matches the intent to a known, configured destination with a confidence.
- **Confidence gate** — Routes automatically only when confident; low-confidence or ambiguous requests are clarified or escalated.
- **Risk gate** — Detects high-risk or irreversible actions and routes them to a privileged handler with human approval.
- **Dispatcher** — Dispatches to the chosen destination without executing the work itself.
- **Audit log** — Logs every routing decision with intent, destination, confidence, and reason for traceability.

## Files in this bundle

- `system-prompt.md` — the agent's system prompt
- `tools.json` — tool/function definitions the agent expects
- `workflow.md` — step-by-step run loop
- `.env.example` — environment variables to fill in
- `kit.json` — full structured metadata
- `starters/` — minimal starter snippets
- `LICENSE` — Apache-2.0 (code, configuration, and schema)
- `LICENSE-CONTENT` — CC BY 4.0 (specification text and documentation)
- `NOTICE` — attribution and trademark notice
- `run.py` — **runnable demo**: real agent loop with mock tools (`pip install anthropic`, set `ANTHROPIC_API_KEY`, `python run.py`)
- `agentaz.json` / `agentaz.schema.json` — AgentAz™ governance spec + schema

## Implementation notes

- Keep the router a dispatcher, not an executor; the moment it performs actions itself, a misclassification becomes a real-world side effect instead of a misroute.
- Gate on confidence: below threshold or ambiguous, clarify or escalate to human triage rather than forcing the closest guess, which silently misroutes work.
- Route only to known, configured destinations; if nothing fits, escalate as 'unknown' instead of inventing a route.
- Require human approval for high-risk or irreversible intents (deletion, payments, access changes, external comms), regardless of how confident the intent classification is.
- Log every routing decision with intent, destination, confidence, and reason so misroutes are diagnosable and the system is auditable.
- Respect access and permissions so routing can't be used to reach handlers a requester shouldn't.
- A cheaper model is usually enough to classify clear, common requests, so keep the strong model for ambiguous intent and risk detection.

## Variations

- **Basic — Intent router:** Classifies requests and routes them to known destinations with a confidence and reason. Dispatch only.
- **Advanced — Gated routing:** Adds confidence gating, ambiguous/unknown escalation, high-risk approval gating, and full routing audit logs.
- **Enterprise — Orchestration front door:** Adds multi-handler registries, dynamic routing rules, permission-aware dispatch, approval workflows, and analytics across the request stream.

## FAQ

**Does it do the work or just route it?**

It routes. Its job is to classify a request and dispatch it to the right workflow, agent, queue, or team — not to perform the task. Keeping it a dispatcher means a misclassification is a misroute, not a real-world side effect.

**What happens with an ambiguous request?**

It won't force a guess. If confidence is low or the request is unclear, it asks for clarification or escalates to a human triage queue, because a confident wrong route wastes a team's time and delays the user.

**Can it route to a destination that doesn't exist?**

No. It routes only to known, configured destinations. If nothing fits, it escalates the request as 'unknown' rather than inventing or assuming a route.

**How does it handle dangerous actions?**

High-risk or irreversible intents — deletions, payments, access changes, external messages — are routed to a privileged handler with required human approval, never auto-executed or fast-pathed, even when the intent is clear.

**Is routing auditable?**

Yes. Every decision is logged with the intent, destination, confidence, and reason, so misroutes are diagnosable and the system is fully traceable.

**Can it respect who's allowed to do what?**

Yes. It's permission-aware, so routing can't be used to reach a handler or action a requester isn't allowed to access.


---

© 2026 AgentKits · www.agent-kits.com

**Open source.** Code, configuration, and the AgentAz™ schema are licensed under
**Apache-2.0**; specification text and documentation under **CC BY 4.0** (with
attribution to AgentKits, link to https://www.agent-kits.com). See LICENSE, LICENSE-CONTENT,
and NOTICE in this bundle. "AgentAz" and "AgentKits" are trademarks of AgentKits.

**Flagship reference blueprint.** View the source, AgentAz™ spec, and frozen v1.0 schema
in the public registry: https://github.com/agent-kits/agentaz
Original: https://agent-kits.com/kit/workflow-router
