API Reference
Workflows API

Workflows API

Workflows chain multiple LLM stages together, with an optional merge step that combines outputs into a single response. Use these endpoints to create and manage multi-model workflows.

Workflow Object

{
  "id": "wf_01HXYZ",
  "name": "Research and summarize",
  "description": "Generate a detailed analysis, then summarize for executives.",
  "stages": [
    {
      "name": "Deep analysis",
      "llm_id": "gpt-4o",
      "prompt": "Provide a detailed analysis of the following topic: {{input}}"
    },
    {
      "name": "Executive summary",
      "llm_id": "claude-3-5-sonnet",
      "prompt": "Summarize the following analysis in 3 bullet points: {{previous}}"
    }
  ],
  "execution_mode": "sequential",
  "merge_llm_id": null,
  "merge_prompt": null,
  "created_at": "2025-01-15T10:30:00Z",
  "updated_at": "2025-01-15T10:30:00Z"
}

Endpoints

MethodPathDescription
GET/workflowsList all workflows
POST/workflowsCreate a new workflow
PUT/workflows/{id}Update an existing workflow

Info: Workflows do not have a DELETE endpoint. To remove a workflow, contact your account admin or use the dashboard.


List Workflows

GET /api/v1/workflows

Returns all workflows for your organization.

Response

[
  {
    "id": "wf_01HXYZ",
    "name": "Research and summarize",
    "description": "Generate a detailed analysis, then summarize for executives.",
    "stages": [...],
    "execution_mode": "sequential",
    "merge_llm_id": null,
    "merge_prompt": null,
    "created_at": "2025-01-15T10:30:00Z",
    "updated_at": "2025-01-15T10:30:00Z"
  }
]

cURL

curl https://api.xilos.ai/api/v1/workflows \
  -H "Authorization: Bearer YOUR_X..._KEY"

Create Workflow

POST /api/v1/workflows

Request Body

FieldTypeRequiredDescription
namestringYesHuman-readable name for the workflow.
descriptionstringNoDescription of what the workflow does.
stagesarrayYesOrdered array of stage objects.
execution_modestringNosequential or parallel. Default: sequential.
merge_llm_idstringNoModel ID used to merge parallel stage outputs. Required for parallel mode.
merge_promptstringNoPrompt template for the merge step. Use {{stages}} to reference stage outputs.

Stage Object

FieldTypeDescription
namestringStage name.
llm_idstringModel ID for this stage.
promptstringPrompt template. Use {{input}} for the original input, {{previous}} for the prior stage output (sequential mode).

cURL

curl -X POST https://api.xilos.ai/api/v1/workflows \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_X..._KEY" \
  -d '{
    "name": "Research and summarize",
    "description": "Generate a detailed analysis, then summarize for executives.",
    "stages": [
      {
        "name": "Deep analysis",
        "llm_id": "gpt-4o",
        "prompt": "Provide a detailed analysis of the following topic: {{input}}"
      },
      {
        "name": "Executive summary",
        "llm_id": "claude-3-5-sonnet",
        "prompt": "Summarize the following analysis in 3 bullet points: {{previous}}"
      }
    ],
    "execution_mode": "sequential"
  }'

Response

Returns the created Workflow Object.


Update Workflow

PUT /api/v1/workflows/{id}

Updates an existing workflow. All fields are optional — only provided fields are updated.

Request Body

Same fields as Create Workflow. All fields are optional.

cURL

curl -X PUT https://api.xilos.ai/api/v1/workflows/wf_01HXYZ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_X..._KEY" \
  -d '{
    "execution_mode": "parallel",
    "merge_llm_id": "gpt-4o",
    "merge_prompt": "Combine the following analyses into a single report: {{stages}}"
  }'

Response

Returns the updated workflow object.

Designing Workflows

Define Your Stages

Identify the distinct steps your workflow needs. Each stage runs on a single model with its own prompt.

Choose Execution Mode

Use sequential when each stage depends on the previous output. Use parallel when stages are independent and you want to merge results.

Configure Merge (Parallel Only)

For parallel workflows, set merge_llm_id and merge_prompt to combine stage outputs into a single response.

Test and Iterate

Run sample queries through the workflow and review outputs in the dashboard. Adjust prompts and model selections as needed.