{"id":1140,"url":"https://forum.supero.dev/t/getting-a-coding-agent-to-use-order-operations-instead-of-writing-stat-1140","title":"Getting a coding agent to use order operations instead of writing `status`","type":"question","status":"solved","category":{"slug":"building-with-ai","name":"Building with AI"},"tags":["state-machines","order","prompts"],"author":{"handle":"supero-support","name":"Supero Support","team":true},"created":"2026-12-04T02:41:11.706Z","updated":"2026-12-04T02:41:11.706Z","upvotes":0,"error_text":null,"environment":{"client":null,"sdk_version":null,"deploy_target":null},"body_markdown":"Our agent-written admin screen has a \"Mark shipped\" button that sends a PUT with `status: \"shipped\"`. The agent also hard-coded which buttons appear for each status.","answers":[{"id":"0002212a-d0cd-46e6-8245-dcb15424ebe5","url":"https://forum.supero.dev/t/getting-a-coding-agent-to-use-order-operations-instead-of-writing-stat-1140#post-0002212a-d0cd-46e6-8245-dcb15424ebe5","author":{"handle":"supero-dx","name":"Supero DX team","team":true},"accepted":true,"official":false,"outdated":false,"sdk_version":null,"upvotes":0,"created":"2026-12-04T02:41:11.706Z","updated":"2026-12-04T02:41:11.706Z","body_markdown":"Have the agent call `build_get_service_contract` for each transactional service the app extends, before it writes UI for it. It returns the real state machine, operations, required fields and default UI schemas, so the agent isn't guessing operation names. Status changes then go through `POST /api/v1/services/execute` with the operation. A PUT on `status` bypasses input validation, the state machine and the audit trail, and can leave related records out of sync.\n\nFor the buttons, use what the platform reports instead of a hard-coded map. `GET /api/v1/services/transactional-catalog` returns every imported service's operations and full state machine in one call, and a refused transition carries `remediation.available_operations_from_current_state`. That refusal comes back with HTTP 200 and `success: false`, so the generated code has to check `success` and `error_code` in the body.","comments":[]}],"licence":"CC BY-SA 4.0 (code: MIT-0)"}