ORVEXA

Agent Workflows

ORVEXA Workflows let you define multi-step AI pipelines using a declarative JSON format. Chain model calls, add conditional branches, and build complex agentic systems.

Chain Calls

Execute multiple model calls sequentially, where each step can reference the output of previous steps using template variables.

Conditional Branches

Route execution based on model output using condition steps, enabling dynamic decision-making within your workflow.

Workflow Definition Format

A workflow is a JSON object with a name and an ordered array of steps. Each step defines a model call or a routing condition.

name
A unique name identifying the workflow.
steps
An ordered array of step definitions executed sequentially.
steps[].id
A unique identifier for the step, used to reference its output in later steps.
steps[].model
The model ID to use for this step's completion call.
steps[].prompt
docs.workflows.fieldStepPrompt
steps[].output_key
The key under which this step's output is stored for reference in subsequent steps.
steps[].type
Optional. Set to "condition" for branching steps. Default is a model call step.

Chain Workflow Example

This two-step workflow first researches a topic using deepseek-chat, then summarizes the findings using deepseek-reasoner.

Chain workflow definitionjson
{
  "name": "research-and-summarize",
  "steps": [
    {
      "id": "research",
      "model": "deepseek-chat",
      "prompt": "Research the following topic and list key points: {{input}}",
      "output_key": "research_result"
    },
    {
      "id": "summarize",
      "model": "deepseek-reasoner",
      "prompt": "Summarize these research points into a concise paragraph:\n{{research_result}}",
      "output_key": "final_summary"
    }
  ]
}

Conditional Branch Example

This workflow classifies the user's intent and routes the request to the appropriate specialist model.

Branch workflow definitionjson
{
  "name": "intent-router",
  "steps": [
    {
      "id": "classify",
      "model": "deepseek-chat",
      "prompt": "Classify this message as 'technical', 'billing', or 'general': {{input}}",
      "output_key": "intent"
    },
    {
      "id": "route",
      "type": "condition",
      "branches": [
        {
          "when": "{{intent}} == 'technical'",
          "goto": "tech_support"
        },
        {
          "when": "{{intent}} == 'billing'",
          "goto": "billing_support"
        }
      ],
      "default": "general_support"
    },
    {
      "id": "tech_support",
      "model": "deepseek-reasoner",
      "prompt": "Provide technical support for: {{input}}"
    },
    {
      "id": "billing_support",
      "model": "deepseek-chat",
      "prompt": "Help with billing question: {{input}}"
    },
    {
      "id": "general_support",
      "model": "deepseek-chat",
      "prompt": "Help with general question: {{input}}"
    }
  ]
}

Executing a Workflow

Send a POST request to /v1/workflows/run with the workflow definition and input data.

POST
/v1/workflows/run
Execute workflowbash
curl https://api.orvexaproject.com/v1/workflows/run \
  -H "Authorization: Bearer nx-sk-dcfab6de7407c3c5f74fb627" \
  -H "Content-Type: application/json" \
  -d '{
    "workflow": {
      "name": "research-and-summarize",
      "steps": [
        {
          "id": "research",
          "model": "deepseek-chat",
          "prompt": "List 3 key facts about: {{input}}",
          "output_key": "research_result"
        },
        {
          "id": "summarize",
          "model": "deepseek-reasoner",
          "prompt": "Summarize:\n{{research_result}}"
        }
      ]
    },
    "input": "quantum computing"
  }'

Workflow Response

Responsejson
{
  "workflow_id": "wf-abc123",
  "status": "completed",
  "outputs": {
    "research_result": "1. Quantum computers use qubits... 2. They exploit superposition... 3. They excel at factoring...",
    "final_summary": "Quantum computing leverages qubits and superposition..."
  },
  "usage": {
    "total_tokens": 520,
    "total_cost": 0.0023
  }
}