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.
Getting a coding agent to use order operations instead of writing status
Common question, written up by the Supero team.
1 answer
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.
For 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.
Your answer
Know the answer? Sign in to post it. It takes an email address and a 6-digit code.
Sign in to answer