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

NameTypeRequiredDefaultDescription
codestringYesSource code to fix.
languagestringYesLanguage hint: "python", "javascript", "typescript", "go", "rust", etc.
testsstringNonullOptional test snippet to validate fixed code.
error_outputstringNonullKnown runtime/compiler error details from your environment.
max_iterationsintegerNo5Maximum fix attempts before returning partial or failed.
timeout_secondsintegerNo30Execution timeout for each attempt.
streambooleanNofalseIf 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"
}