Batch Processing
AgentFlow provides a batch processing pipeline for running LLM operations across large datasets. Classify, extract, summarize, or enrich hundreds of items — synchronously for small batches or asynchronously with downloadable results for large runs. Each operation has a dedicated endpoint with purpose-built request models, built-in system prompts, and structured output enforcement — so you don’t need to write prompt engineering boilerplate.Operations
Classification / Labeling
Categorize items against a defined label set. Supports both single-label (exactly one category) and multi-label (all applicable categories) modes."multi_label": true):
categories list. You can override with system_prompt and user_prompt_template for full control.
Summarization
Generate concise summaries with customizable instructions.response_format: {"type": "json_object"} for structured JSON summaries.
Extraction
Pull structured fields from unstructured text. Returns JSON by default.Enrichment
Add computed fields to existing data using a typed field schema. Each field defines its name, type, description, and optional constraints (valid values, examples).runtime_categories for dynamic valid-value overrides and include_context to inject item metadata into the prompt.
General-purpose completions
The/run endpoint accepts any combination of system prompt, user template, and response format — use it for custom operations that don’t fit the dedicated endpoints.
metadata dict with arbitrary fields accessible in the prompt template via {field_name}.
Asynchronous batches
For larger datasets (over 50 items), submit async jobs and poll for results.Submit a batch
Check progress
Download results
json, jsonl, csv. Results up to 10,000 items.
Cancel a batch
File upload
Upload files directly for batch processing — CSV, JSON, or plain text up to 100MB (up to 1M items):/api/batches.
API summary
Dedicated operation endpoints (sync, up to 50 items)
| Method | Path | Operation |
|---|---|---|
POST | /api/completions/label | Classification (single or multi-label) |
POST | /api/completions/summarize | Summarization with custom instructions |
POST | /api/completions/extract | Structured extraction to JSON |
POST | /api/completions/enrich | Schema-driven field enrichment |
POST | /api/completions/run | General-purpose (any prompt template) |
Async batch endpoints
| Method | Path | Description |
|---|---|---|
POST | /api/batches | Submit async batch job |
GET | /api/batches/{batch_id} | Get batch status and progress |
GET | /api/batches/{batch_id}/output | Download results (JSON/JSONL/CSV) |
POST | /api/batches/{batch_id}/cancel | Cancel a running batch |
POST | /api/files | Upload file for batch processing |

