Quick Start Guide

Get started with Agent Orcha in minutes. Follow these steps to set up your first multi-agent system.

Core Concepts

Agents

Agents are AI-powered units that can use tools and respond to queries. Each agent is defined in a YAML file with its configuration.

Agent Schema

YAML
name: string                    # Unique identifier (required)
description: string             # Human-readable description (required)
version: string                 # Semantic version (default: "1.0.0")

llm: string | object            # Reference to LLM config in llm.json
  # Simple: llm: default
  # With override: llm: { name: default, temperature: 0.3 }

prompt:                         # Prompt configuration (required)
  system: string                # System message/instructions
  inputVariables: [string]      # Variables to interpolate

tools:                          # Tools available to agent (optional)
  - mcp:           # MCP server tools
  - vector:         # Vector store search
  - function:    # Custom functions
  - builtin:         # Built-in tools

output:                         # Output formatting (optional)
  format: text | json | structured

metadata:                       # Custom metadata (optional)
  category: string
  tags: [string]

Example Agent with Tools

YAML
name: math
description: An agent that can calculate Fibonacci numbers
version: "1.0.0"

llm:
  name: default
  temperature: 0.3

prompt:
  system: |
    You are a mathematical assistant specialized in Fibonacci numbers.

    When users ask about Fibonacci numbers:
    1. Parse the index from their query (0-based indexing)
    2. Use the fibonacci function to calculate the result
    3. Return the result in a clear, formatted way
  inputVariables:
    - query

tools:
  - function:fibonacci  # References fibonacci.function.js

output:
  format: text

metadata:
  category: mathematics
  tags:
    - math
    - fibonacci

Workflows

Workflows orchestrate multiple agents in a defined sequence with parallel execution, conditional logic, and state management.

Workflow Schema

YAML
name: string                    # Unique identifier (required)
description: string             # Human-readable description (required)
version: string                 # Semantic version (default: "1.0.0")

input:                          # Input schema (required)
  schema:
    :
      type: string | number | boolean | array | object
      required: boolean
      default: any
      description: string

steps:                          # Workflow steps (required)
  - id: string                  # Unique step identifier
    agent: string               # Agent name to execute
    input:                      # Input mapping using templates
      : "{{input.field}}"
      : "{{steps.stepId.output}}"
    condition: string           # Optional conditional execution
    retry:                      # Optional retry configuration
      maxAttempts: number
      delay: number
    output:
      key: string

config:                         # Workflow configuration (optional)
  timeout: number               # Total timeout ms (default: 300000)
  onError: stop | continue | retry

output:                         # Output mapping (required)
  : "{{steps.stepId.output}}"

metadata:                       # Custom metadata (optional)
  category: string
  tags: [string]

Template Syntax

Access data within workflows using double curly braces:

Template Description
{{input.fieldName}} Access workflow input field
{{steps.stepId.output}} Access step output
{{steps.stepId.output.nested.path}} Access nested output
{{steps.stepId.metadata.duration}} Access step metadata

Vector Stores

Vector stores enable semantic search and RAG (Retrieval Augmented Generation) capabilities for your agents.

Vector Store Schema

YAML
name: string                    # Unique identifier (required)
description: string             # Human-readable description (required)

source:                         # Data source (required)
  type: directory | file | url
  path: string                  # Path relative to project root
  pattern: string               # Glob pattern for directories
  recursive: boolean            # Recursive search (default: true)

loader:                         # Document loader (required)
  type: text | pdf | csv | json | markdown

splitter:                       # Text chunking (required)
  type: character | recursive | token | markdown
  chunkSize: number             # Characters per chunk (default: 1000)
  chunkOverlap: number          # Overlap between chunks (default: 200)

embedding: string               # Reference to embedding config (default: "default")

store:                          # Vector store backend (required)
  type: memory | chroma
  options:
    path: string                # Storage path (for chroma)
    collectionName: string      # Collection name
    url: string                 # Server URL (for chroma)

search:                         # Search configuration (optional)
  defaultK: number              # Results per search (default: 4)
  scoreThreshold: number        # Minimum similarity (0-1)

Functions

Functions are custom JavaScript tools that extend agent capabilities. They're simple to create and require no dependencies.

Function Schema

JavaScript
export default {
  name: 'function-name',
  description: 'What it does',

  parameters: {
    param1: {
      type: 'number',  // string | number | boolean | array | object | enum
      description: 'Parameter description',
      required: true,
      default: 0,
    },
  },

  execute: async ({ param1 }) => {
    // Your logic here
    return `Result: ${param1}`;
  },
};

export const metadata = {
  name: 'function-name',
  version: '1.0.0',
  author: 'Your Name',
  tags: ['category'],
};

Example Function

JavaScript
export default {
  name: 'fibonacci',
  description: 'Returns the nth Fibonacci number (0-based indexing)',

  parameters: {
    n: {
      type: 'number',
      description: 'The index (0-based, max 100)',
    },
  },

  execute: async ({ n }) => {
    if (n < 0 || !Number.isInteger(n)) {
      throw new Error('Index must be a non-negative integer');
    }
    if (n > 100) {
      throw new Error('Index too large (max 100)');
    }

    if (n === 0) return 'Fibonacci(0) = 0';
    if (n === 1) return 'Fibonacci(1) = 1';

    let prev = 0, curr = 1;
    for (let i = 2; i <= n; i++) {
      [prev, curr] = [curr, prev + curr];
    }

    return `Fibonacci(${n}) = ${curr}`;
  },
};

MCP Servers

Model Context Protocol (MCP) servers provide external tools to agents. Configure them in mcp.json.

MCP Configuration

JSON
{
  "version": "1.0.0",
  "servers": {
    "fetch": {
      "transport": "streamable-http",
      "url": "https://remote.mcpservers.org/fetch/mcp",
      "description": "Web fetch capabilities",
      "timeout": 30000,
      "enabled": true
    }
  },
  "globalOptions": {
    "throwOnLoadError": false,
    "prefixToolNameWithServerName": true,
    "defaultToolTimeout": 30000
  }
}

API Reference

Complete REST API documentation for interacting with agents, workflows, and vector stores.

Health Check

HTTP
GET /health

Response:
{
  "status": "ok",
  "timestamp": "2026-01-21T12:00:00.000Z"
}

Agents API

Method Endpoint Description
GET /api/agents List all agents
GET /api/agents/:name Get agent details
POST /api/agents/:name/invoke Run agent
POST /api/agents/:name/stream Stream agent response (SSE)

Invoke Agent

Bash
curl -X POST http://localhost:3000/api/agents/researcher/invoke \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "topic": "your topic",
      "context": "additional context"
    }
  }'

Response

JSON
{
  "output": "Agent response text",
  "metadata": {
    "tokensUsed": 150,
    "toolCalls": ["fetch", "vector_search"],
    "duration": 1234
  }
}

Workflows API

Method Endpoint Description
GET /api/workflows List all workflows
GET /api/workflows/:name Get workflow details
POST /api/workflows/:name/run Execute workflow

Run Workflow

Bash
curl -X POST http://localhost:3000/api/workflows/research-paper/run \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "topic": "research topic",
      "style": "professional"
    }
  }'

Vector Stores API

Method Endpoint Description
GET /api/vectors List all vector stores
GET /api/vectors/:name Get vector store config
POST /api/vectors/:name/search Search vector store
POST /api/vectors/:name/refresh Reload documents
POST /api/vectors/:name/add Add documents

Search Vector Store

Bash

CLI Reference

Command-line interface for Agent Orcha operations.

Command Description Options
npx agent-orcha init [dir] Initialize a new project with example configs dir - Target directory (default: current)
npx agent-orcha start Start the agent orchestrator server Environment variables: PORT, HOST
npx agent-orcha help Show help information -

Examples

Real-world examples to help you get started with common use cases.

Example 1: Math Agent with Custom Function

This example shows an agent using a custom Fibonacci calculator function.

YAML - agents/math.agent.yaml
name: math
description: An agent that can calculate Fibonacci numbers
version: "1.0.0"

llm:
  name: default
  temperature: 0.3

prompt:
  system: |
    You are a mathematical assistant.
    Use the fibonacci function to calculate results.
  inputVariables:
    - query

tools:
  - function:fibonacci

output:
  format: text

Example 2: Multi-Step Workflow

Orchestrating multiple agents to complete a complex task.

YAML - workflows/example.workflow.yaml
name: example-workflow
description: A workflow demonstrating multi-agent orchestration
version: "1.0.0"

input:
  schema:
    topic:
      type: string
      required: true
      description: The topic to process

steps:
  - id: get-time
    agent: time
    input:
      timezone: "America/New_York"
    output:
      key: current_time

  - id: search-knowledge
    agent: knowledge
    input:
      query: "{{input.topic}}"
    output:
      key: knowledge_result

  - id: perform-calculation
    agent: math
    input:
      query: "Calculate the 10th Fibonacci number"
    output:
      key: calculation_result

  - id: summarize
    agent: example
    input:
      query: |
        Summarize: {{steps.get-time.output}}
        Topic: {{input.topic}}
        Knowledge: {{steps.search-knowledge.output}}
        Math: {{steps.perform-calculation.output}}
    output:
      key: final_summary

config:
  timeout: 300000
  onError: stop

output:
  timestamp: "{{steps.get-time.output}}"
  knowledge: "{{steps.search-knowledge.output}}"
  calculation: "{{steps.perform-calculation.output}}"
  summary: "{{steps.summarize.output}}"

Example 3: Vector Store for RAG

Setting up semantic search with a vector store.

YAML - vectors/knowledge.vector.yaml
name: knowledge
description: Knowledge base for semantic search

source:
  type: directory
  path: vectors/sample-data
  pattern: "*.txt"

loader:
  type: text

splitter:
  type: character
  chunkSize: 1000
  chunkOverlap: 200

embedding: default

store:
  type: memory

search:
  defaultK: 4
  scoreThreshold: 0.2