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.
Chain Workflow Example
This two-step workflow first researches a topic using deepseek-chat, then summarizes the findings using deepseek-reasoner.
{
"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.
{
"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.
/v1/workflows/runcurl 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
{
"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
}
}