Router Agent CLI

CLI commands for router agent in PraisonAI TypeScript

The praisonai-ts CLI provides the router command for request routing analysis.

Diagram

User

CLI

Route

Quick Start

  1. Simple Usage
    bash
    # Analyze input and suggest routing
    praisonai-ts router analyze "Help me debug this code"
    
    # Get JSON output
    praisonai-ts router analyze "What is 2+2?" --json

    Example Output:

    json
    {
      "success": true,
      "data": {
        "input": "Help me debug this code",
        "selectedRoute": "code",
        "confidence": 0.95,
        "matchedRoutes": ["code", "question", "general"]
      }
    }

Route Categories

The router analyzes input and suggests appropriate routing:

RouteTriggers
codecode, debug, function, programming
mathcalculate, math, equation
researchresearch, find, search
creativewrite, create, generate
questionwhat, how, why, explain
greetinghello, hi, hey
generalDefault fallback

SDK Usage

For programmatic routing:

typescript
import { RouterAgent, Agent } from 'praisonai';

const codeAgent = new Agent({ name: 'CodeExpert', instructions: '...' });
const mathAgent = new Agent({ name: 'MathExpert', instructions: '...' });

const router = new RouterAgent({
  routes: [
    { agent: codeAgent, condition: (input) => /code|debug/i.test(input) },
    { agent: mathAgent, condition: (input) => /math|calculate/i.test(input) }
  ]
});

const result = await router.route('Help me debug this');

For more details, see the Router Agent SDK documentation.


Related