curl -X POST https://api.60db.ai/agents/simulations/RUN_ID/fix \
-H "Authorization: Bearer your-api-key"
{
"base_hash": "<string>",
"changes": [
{}
],
"problems": [
{}
],
"settings_problems": [
{}
]
}Agent Reliability
Fix Agent from a Simulation
Improved instructions written from what failed in a finished simulation run
POST
/
agents
/
simulations
/
{runId}
/
fix
curl -X POST https://api.60db.ai/agents/simulations/RUN_ID/fix \
-H "Authorization: Bearer your-api-key"
{
"base_hash": "<string>",
"changes": [
{}
],
"problems": [
{}
],
"settings_problems": [
{}
]
}AI Simulation needs an active Pro or Business plan. On another plan, every simulation endpoint returns
403 POLICY_DENY.Request
Headers
Path
The
run_id of a finished run from Start a simulationResponse
200 OK.{
"agent": { "id": "8f8d15b7-ea7e-42ef-b3a6-dd78d9dde271", "name": "Loan bot" },
"base_hash": "3b1f…",
"before": "You are Loan bot. Greet the caller and confirm their PAN.",
"after": "You are Loan bot. Greet the caller, read the PAN back digit by digit, and confirm it.",
"changes": [{ "summary": "Read the PAN back digit by digit.", "problem_ids": ["contains"] }],
"problems": [{ "category": "contains", "count": 3, "reason": "The agent did not say \"PAN verified\" when the story needed it." }],
"settings_problems": [{ "category": "tool_called", "tool": "webhook_shop__check_product", "count": 1, "reason": "The stories expect the tool webhook_shop__check_product, which is attached to this agent, but its instructions say not to use tools." }]
}
ADDITIONAL RULES section at the end of the instructions; a rule the instructions already have is not added again.
Failures new instructions cannot fix: a tool the stories expect that the agent lacks, or one its instructions rule out. Present only when there are any
Apply and undo
POST /agents/simulations/{runId}/fix/apply saves after to the agent. Body: { "base_hash": "<from the suggestion>", "script": "<after>" }. The answer has the hash of the saved text:
{ "agent": { "id": "8f8d15b7-…", "name": "Loan bot" }, "base_hash": "9c4a…" }
POST /agents/simulations/{runId}/fix/undo puts the earlier text back. Body: { "base_hash": "<from apply>", "script": "<before>" }.
Both need the agent:write permission.
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | NOTHING_TO_FIX | The run’s failures are only speed or service problems |
| 400 | SETTINGS_PROBLEM | The only failures left are settings problems (see settings_problems) |
| 409 | FIX_ALREADY_APPLIED | A fix from this run is already applied. Re-run the stories (agent: "current") to check it, or undo it first |
| 400 | VALIDATION_ERROR | Apply or undo: base_hash or script is missing or not valid |
| 403 | POLICY_DENY | Your role cannot do this, the workspace is not on an active Pro or Business plan, or the API key lacks the agents scope |
| 404 | RUN_NOT_FOUND | No run with this ID in your workspace |
| 404 | AGENT_NOT_FOUND | The agent the run tested no longer exists |
| 409 | RUN_ACTIVE | The run is still running or paused |
| 409 | AGENT_CHANGED | Apply or undo: the agent changed since the preview. Ask for a new suggestion. |
| 422 | FIX_INVALID | Apply: the new instructions fail a check above |
| 429 | More than 3 suggestions in a minute | |
| 503 | AGENT_FIX_UNAVAILABLE | The model is not available. Try again. |
Example
curl -X POST https://api.60db.ai/agents/simulations/RUN_ID/fix \
-H "Authorization: Bearer your-api-key"