TASK EXECUTION API

Execute a verified task.

Send the work, its constraints, the success contract, and optional Task Economics. ModelPilot returns the selected execution plan and complete measured outcome economics.

curl -X POST https://api.modelpilot.ai/v1/tasks/execute \
 -H "Authorization: Bearer mp_live_..." \
 -H "Content-Type: application/json" \
 -d '{
  "task":{"instruction":"Return invoice fields as JSON"},
  "strategy":"plan_execute_verify",
  "requirements":{"qualitySla":0.95,"risk":"medium"},
  "economics":{"businessValue":12,"valueSource":"customer_input","currency":"USD","maxTaskBudget":0.10},
  "verification":{"type":"json_schema","requiredKeys":["total"]}
 }'

Task Economics

Declare expected value and budget on execution. After a task is verified, confirm realized value with POST /v1/tasks/:id/value using customer_input, system_of_record, or measured_time_saved. ROI is returned only when value and measured cost are currency-comparable.

Execution strategies

direct completes routine work in one step. cheap_first_escalate repairs only after verification failure. plan_execute_verify separates high-value planning from economical execution.

Outcome Arena

Create an evidence gate at POST /v1/arenas, compare verified baseline and ModelPilot executions at POST /v1/arenas/:id/compare, and retrieve CPVO, quality, latency, savings, and promotion gates from GET /v1/arenas/:id/report.

Execution Memory

GET /v1/memory returns tenant-private strategy evidence and safety events. Configure observe, shadow, or opt-in active policy at PUT /v1/memory/policy. Active recommendations require enough evaluated outcomes and never override explicit strategies or high-risk rules. Consecutive failures, quality regression, or CPVO regression automatically return an unhealthy Active policy to Shadow.

Human approval

High-risk work pauses with awaiting_approval before any provider call. Resubmit the exact reviewed TaskRequest to POST /v1/tasks/:id/approve, or reject it at POST /v1/tasks/:id/reject. Payload hash matching prevents post-review changes.

Compatibility gateway

Existing applications can continue using /v1/chat/completions. It remains an OpenAI-compatible adoption layer; the Task Execution API is the native ModelPilot product.