POST
/v1/agent/fix
Flagship endpoint
This is Nascentist's most powerful endpoint. It doesn't just predict a fix — it executes your code, reads real runtime output, and iterates until it works.
How it works
Submit code
→
Execute in sandbox
→
Read actual output
↓
Return result
←
Re-run new code
←
Generate fix
Status values
"fixed": all checks pass and code runs cleanly."partial": output improved but did not fully satisfy checks."failed": maximum iterations reached without viable fix.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| code | string | Yes | — | Source code to fix. |
| language | string | Yes | — | Language hint: "python", "javascript", "typescript", "go", "rust", etc. |
| tests | string | No | null | Optional test snippet to validate fixed code. |
| error_output | string | No | null | Known runtime/compiler error details from your environment. |
| max_iterations | integer | No | 5 | Maximum fix attempts before returning partial or failed. |
| timeout_seconds | integer | No | 30 | Execution timeout for each attempt. |
| stream | boolean | No | false | If true, emits iterative progress over SSE. |
Request Examples
8 lines
curl -X POST https://api.nascentist.ai/v1/agent/fix \
-H "Authorization: Bearer nsc_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"language": "python",
"code": "def divide(a,b):\n return a/b\n\nprint(divide(1,0))",
"max_iterations": 5
}'Response Example
19 lines
{
"id": "fix_01ARH7p6Yb2",
"object": "agent_fix",
"model": "nascentist-1",
"status": "fixed",
"iterations_used": 3,
"fixed_code": "def divide(a, b):\n if b == 0:\n return None\n return a / b\n\nprint(divide(1, 0))",
"execution_summary": {
"initial_error": "ZeroDivisionError: division by zero",
"final_output": "None"
},
"usage": {
"prompt_tokens": 534,
"completion_tokens": 812,
"total_tokens": 1346
},
"latency_ms": 3842,
"created_at": "2026-03-01T04:18:00Z"
}