Overview
Completion workflows execute direct LLM completions with custom parameters on your dataset. The system automatically:- Processes each dataset entry through your configured model
- Tracks costs, tokens, and latency
- Runs evaluators on outputs
- Creates detailed trace hierarchies
How It Works
- System reads dataset entries (input messages)
- Calls LLM with your configuration
- Stores output and metrics
- Runs configured evaluators
- Creates trace with full span hierarchy
Key Benefits
- Zero Code: No custom processing needed
- Automatic Execution: Runs in the background when you create the experiment
- Cost Tracking: Real-time cost calculation
- Chaining Support: Can chain multiple completion workflows
- Full Observability: Detailed execution traces
Configuration
Workflow Config
Type:"completion"
Config Fields:
| Field | Type | Required | Description | Default |
|---|---|---|---|---|
model | string | Yes | Model identifier (e.g., “gpt-4o-mini”) | - |
temperature | number | No | Sampling temperature (0-2) | 1.0 |
max_tokens | integer | No | Maximum completion tokens | 150 |
top_p | number | No | Nucleus sampling (0-1) | 1.0 |
frequency_penalty | number | No | Frequency penalty (-2 to 2) | 0 |
presence_penalty | number | No | Presence penalty (-2 to 2) | 0 |
stop | string or array | No | Stop sequences | null |
response_format | object | No | Response format (e.g., {"type": "json_object"}) | null |
tools | array | No | Function calling tools | null |
tool_choice | string or object | No | Tool choice strategy | null |
reasoning_effort | string | No | Reasoning effort for o1 models | null |
API Endpoints
1. Create Completion Experiment
POST/api/v2/experiments/
Creates experiment and starts execution in the background. Check status in the platform UI.
Request:
- Execution starts immediately in the background
status: "pending"means queued for processing- Null config fields are optional (not sent to LLM)
2. List Execution Results
GET/api/v2/experiments/{experiment_id}/logs/list/
Retrieves completed traces with outputs.
Query Parameters:
page: Page number (default: 1)page_size: Results per page (default: 100)
pending: Queued for executionrunning: Currently executingsuccess: Completed successfullyfailed: Workflow execution failederror: Unexpected error
3. Get Detailed Span Tree
GET/api/v2/experiments/{experiment_id}/logs/{trace_id}/?detail=1
Get full trace with span hierarchy.
Response (200):
Chaining Workflows
Multiple completion workflows execute in sequence (head-to-tail):Example: Summarize → Expand
Request:- Focused → Creative: Low temp → High temp
- Summarize → Expand: Short → Detailed
- Filter → Process: Data cleaning pipelines
- Draft → Refine: Multiple revision passes
Input Format
From Dataset
Dataset entries must contain messages in OpenAI format: Dataset Entry:input field must be a messages array for completion workflows.
From Previous Workflow
When chaining, output of Workflow N becomes input of Workflow N+1:Cost Tracking
Automatic Calculation
Costs are calculated from the pricing database based on:- Model name
- Prompt tokens
- Completion tokens
- Your organization’s pricing tier
Aggregation
Trace-level costs aggregate all workflow steps:Error Handling
Workflow Execution Errors
Failed Workflow:- Invalid model name
- Missing required config (e.g.,
model) - Invalid messages format
- Rate limiting
- API key issues
Validation Errors
Missing Model:Complete Example
1. Create Experiment
2. Wait for Execution
3. View Results
4. Analyze Trace
Best Practices
1. Choose Appropriate Parameters
For consistent outputs:2. Monitor Costs
3. Handle Rate Limits
Use smaller batch sizes and concurrency:4. Chain Strategically
Good:- Draft → Refine
- Summarize → Expand
- Classify → Process
- Too many steps (3+ workflows)
- Identical configurations
- Redundant processing
Troubleshooting
No Logs Created
Symptom: Empty results after waiting Causes:- Experiment still processing in background
- Dataset is empty
- Invalid model name
- Wait longer
- Check experiment status in the platform UI
- Verify dataset has entries
- Wait longer (60+ seconds for large datasets)
- Verify model name is valid
Cost Shows Zero
Symptom:total_cost: 0.0 in traces
Cause: Bug was fixed in Phase 15 (Dec 1, 2025)
Solution: Upgrade to latest version
Spans Missing Children
Symptom: Flat span tree (no nested spans) Cause: Span hierarchy bug (fixed) Solution: Check with latest versionSee Also
- API Reference - Complete endpoint documentation
- Workflows Overview - Compare workflow types
- Prompt Workflow - Use prompt templates
- Complete Example Notebook