Batch Processing
AgentFlow supports synchronous completion operations and asynchronous batch jobs:| Path | Use for | API surface |
|---|---|---|
| Sync completions | Inline work that fits in one request | POST /api/v1/completions/run, /label, /extract, /summarize, /enrich |
| Async batches | Larger jobs, polling, output export, and cancellation | POST /api/v1/batches |
| File uploads | CSV, JSON, or JSONL uploads that create async jobs | POST /api/v1/files |
Operations
All operations acceptitems, model controls such as model, temperature, and max_tokens, and operation-specific fields.
Labeling
Labeling is the classification operation. Categories are treated as a strict enum: a single-label result must be exactly one category, and a multi-label result must only contain values from the same category set.Summarization
Extraction
Enrichment
General-Purpose Run
Use/completions/run when a dedicated operation does not fit.
Async Batches
Submit async jobs to/api/v1/batches for larger item arrays or background processing. The request accepts the same operation-specific fields as sync completions.
Retrieve a Job
Read Output
format can be json, jsonl, or csv. JSON output is paginated with the fields returned by the backend:
format=jsonl for newline-delimited JSON or format=csv for CSV text.
Cancel
File Upload
Upload CSV with headers, JSON arrays/objects, or JSONL files directly to create an async batch job.file plus these form fields:
| Field | Description |
|---|---|
operation | Optional semantic operation label |
system_prompt | Custom system prompt |
user_prompt_template | Prompt template that can reference item fields such as {content} |
template | Predefined template name |
response_format | JSON-encoded response format |
model | Model ID |
temperature | Sampling temperature |
max_tokens | Maximum output tokens |
Endpoint Summary
| Method | Path | Description |
|---|---|---|
POST | /api/v1/completions/run | General-purpose synchronous completion |
POST | /api/v1/completions/label | Synchronous classification/labeling |
POST | /api/v1/completions/summarize | Synchronous summarization |
POST | /api/v1/completions/extract | Synchronous structured extraction |
POST | /api/v1/completions/enrich | Synchronous schema-driven enrichment |
POST | /api/v1/batches | Submit an async batch job |
GET | /api/v1/batches/{batch_id} | Get job status and progress |
GET | /api/v1/batches/{batch_id}/output | Read paginated output as JSON, JSONL, or CSV |
POST | /api/v1/batches/{batch_id}/cancel | Cancel a queued or running job |
POST | /api/v1/files | Upload a file and create a batch job |

