{"service":"HALOWERK agentenwerk","endpoint":"/v1/state-machine-step","method":"POST","content_type":"application/json","inputSchema":{"type":"object","required":["machine","current_state","event"],"additionalProperties":false,"properties":{"machine":{"type":"object","required":["initial","states"],"additionalProperties":false,"description":"The automaton definition.","properties":{"initial":{"type":"string","minLength":1,"maxLength":64,"description":"Name of the initial state. Must be one of the defined states."},"states":{"type":"array","minItems":1,"maxItems":200,"description":"The states of the machine.","items":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"type":"string","minLength":1,"maxLength":64,"description":"State name, unique within the machine."},"final":{"type":"boolean","default":false,"description":"If true no event is accepted in this state."},"timeout_s":{"type":"number","minimum":0,"maximum":31536000,"description":"Deadline for this state in seconds."},"timeout_target":{"type":"string","minLength":1,"maxLength":64,"description":"State to move to when the deadline is exceeded. Without it a breach is only reported."},"timeout_actions":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":64},"description":"Actions triggered by the deadline transition."},"on":{"type":"array","maxItems":50,"description":"Event-driven transitions out of this state, evaluated in order.","items":{"type":"object","required":["event","target"],"additionalProperties":false,"properties":{"event":{"type":"string","minLength":1,"maxLength":64,"description":"Event name this transition reacts to."},"target":{"type":"string","minLength":1,"maxLength":64,"description":"State to move to."},"actions":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":64},"description":"Actions triggered by this transition."},"guard":{"type":"object","required":["field","op"],"additionalProperties":false,"description":"Condition that must hold for this transition to be taken.","properties":{"field":{"type":"string","minLength":1,"maxLength":200,"description":"Dotted path starting with context. or payload., e.g. context.attempts."},"op":{"type":"string","enum":["eq","ne","gt","gte","lt","lte","in","not_in","exists","not_exists"],"description":"Comparison operator."},"value":{"description":"Right-hand operand. Not used by exists and not_exists; an array for in and not_in."}}}}}}}}}}},"current_state":{"type":"string","minLength":1,"maxLength":64,"description":"The state the machine is in right now."},"event":{"type":"object","required":["name"],"additionalProperties":false,"description":"The event to apply.","properties":{"name":{"type":"string","minLength":1,"maxLength":64,"description":"Event name."},"payload":{"type":"object","description":"Event data, addressable in guards as payload.<field>."}}},"context":{"type":"object","description":"Machine context, addressable in guards as context.<field>. Never modified."},"elapsed_in_state_s":{"type":"number","minimum":0,"maximum":31536000,"default":0,"description":"Seconds already spent in current_state. Supplied by you, so the result does not depend on this server clock."},"timeout_precedence":{"type":"string","enum":["timeout","event"],"default":"timeout","description":"Which side wins when the deadline is breached and an event transition also matches."}}},"requestExample":{"machine":{"initial":"awaiting_quote","states":[{"name":"awaiting_quote","timeout_s":3600,"timeout_target":"expired","timeout_actions":["notify_requester"],"on":[{"event":"quote_received","target":"quote_accepted","actions":["book_slot"],"guard":{"field":"payload.amount_eur","op":"lte","value":500}},{"event":"quote_received","target":"needs_approval","actions":["request_approval"]},{"event":"cancel","target":"cancelled"}]},{"name":"quote_accepted","on":[{"event":"cancel","target":"cancelled"}]},{"name":"needs_approval","on":[{"event":"approved","target":"quote_accepted"}]},{"name":"cancelled","final":true},{"name":"expired","final":true}]},"current_state":"awaiting_quote","event":{"name":"quote_received","payload":{"amount_eur":420}},"context":{"attempts":1},"elapsed_in_state_s":120,"timeout_precedence":"timeout"},"operations":[{"method":"POST","inputSchema":{"type":"object","required":["machine","current_state","event"],"additionalProperties":false,"properties":{"machine":{"type":"object","required":["initial","states"],"additionalProperties":false,"description":"The automaton definition.","properties":{"initial":{"type":"string","minLength":1,"maxLength":64,"description":"Name of the initial state. Must be one of the defined states."},"states":{"type":"array","minItems":1,"maxItems":200,"description":"The states of the machine.","items":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"type":"string","minLength":1,"maxLength":64,"description":"State name, unique within the machine."},"final":{"type":"boolean","default":false,"description":"If true no event is accepted in this state."},"timeout_s":{"type":"number","minimum":0,"maximum":31536000,"description":"Deadline for this state in seconds."},"timeout_target":{"type":"string","minLength":1,"maxLength":64,"description":"State to move to when the deadline is exceeded. Without it a breach is only reported."},"timeout_actions":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":64},"description":"Actions triggered by the deadline transition."},"on":{"type":"array","maxItems":50,"description":"Event-driven transitions out of this state, evaluated in order.","items":{"type":"object","required":["event","target"],"additionalProperties":false,"properties":{"event":{"type":"string","minLength":1,"maxLength":64,"description":"Event name this transition reacts to."},"target":{"type":"string","minLength":1,"maxLength":64,"description":"State to move to."},"actions":{"type":"array","maxItems":20,"items":{"type":"string","minLength":1,"maxLength":64},"description":"Actions triggered by this transition."},"guard":{"type":"object","required":["field","op"],"additionalProperties":false,"description":"Condition that must hold for this transition to be taken.","properties":{"field":{"type":"string","minLength":1,"maxLength":200,"description":"Dotted path starting with context. or payload., e.g. context.attempts."},"op":{"type":"string","enum":["eq","ne","gt","gte","lt","lte","in","not_in","exists","not_exists"],"description":"Comparison operator."},"value":{"description":"Right-hand operand. Not used by exists and not_exists; an array for in and not_in."}}}}}}}}}}},"current_state":{"type":"string","minLength":1,"maxLength":64,"description":"The state the machine is in right now."},"event":{"type":"object","required":["name"],"additionalProperties":false,"description":"The event to apply.","properties":{"name":{"type":"string","minLength":1,"maxLength":64,"description":"Event name."},"payload":{"type":"object","description":"Event data, addressable in guards as payload.<field>."}}},"context":{"type":"object","description":"Machine context, addressable in guards as context.<field>. Never modified."},"elapsed_in_state_s":{"type":"number","minimum":0,"maximum":31536000,"default":0,"description":"Seconds already spent in current_state. Supplied by you, so the result does not depend on this server clock."},"timeout_precedence":{"type":"string","enum":["timeout","event"],"default":"timeout","description":"Which side wins when the deadline is breached and an event transition also matches."}}},"requestExample":{"machine":{"initial":"awaiting_quote","states":[{"name":"awaiting_quote","timeout_s":3600,"timeout_target":"expired","timeout_actions":["notify_requester"],"on":[{"event":"quote_received","target":"quote_accepted","actions":["book_slot"],"guard":{"field":"payload.amount_eur","op":"lte","value":500}},{"event":"quote_received","target":"needs_approval","actions":["request_approval"]},{"event":"cancel","target":"cancelled"}]},{"name":"quote_accepted","on":[{"event":"cancel","target":"cancelled"}]},{"name":"needs_approval","on":[{"event":"approved","target":"quote_accepted"}]},{"name":"cancelled","final":true},{"name":"expired","final":true}]},"current_state":"awaiting_quote","event":{"name":"quote_received","payload":{"amount_eur":420}},"context":{"attempts":1},"elapsed_in_state_s":120,"timeout_precedence":"timeout"}}],"example_request":{"machine":{"initial":"awaiting_quote","states":[{"name":"awaiting_quote","timeout_s":3600,"timeout_target":"expired","timeout_actions":["notify_requester"],"on":[{"event":"quote_received","target":"quote_accepted","actions":["book_slot"],"guard":{"field":"payload.amount_eur","op":"lte","value":500}},{"event":"quote_received","target":"needs_approval","actions":["request_approval"]},{"event":"cancel","target":"cancelled"}]},{"name":"quote_accepted","on":[{"event":"cancel","target":"cancelled"}]},{"name":"needs_approval","on":[{"event":"approved","target":"quote_accepted"}]},{"name":"cancelled","final":true},{"name":"expired","final":true}]},"current_state":"awaiting_quote","event":{"name":"quote_received","payload":{"amount_eur":420}},"context":{"attempts":1},"elapsed_in_state_s":120,"timeout_precedence":"timeout"},"serviceName":"state_machine_step","tags":["agent","state","workflow","automaton"],"outputSchema":{"type":"object"},"outputExample":{"next_state":"quote_accepted","state_changed":true,"transition":{"taken":true,"via":"event","from":"awaiting_quote","to":"quote_accepted","event":"quote_received","actions":["book_slot"]},"actions":["book_slot"],"unhandled_event":false,"deadline":{"timeout_s":3600,"elapsed_in_state_s":120,"exceeded":false,"remaining_s":3480,"timeout_target":"expired","moves_machine":false},"guard_evaluations":[{"event":"quote_received","target":"quote_accepted","guard":{"field":"payload.amount_eur","op":"lte"},"result":true,"field_resolved":true}],"is_final":false,"allowed_events":{"in_current_state":["quote_received","cancel"],"in_next_state":["cancel"]},"machine_check":{"states":5,"transitions":5,"initial":"awaiting_quote","final_states":["cancelled","expired"],"unreachable_states":[]},"settings_used":{"timeout_precedence":"timeout","elapsed_in_state_s":120},"limits":"Zustandslos: weder Automat noch Zustand noch Verlauf werden gehalten, und genau ein Schritt wird gerechnet. Der Kontext wird nie veraendert — Aktionen werden benannt, nicht ausgefuehrt. Fristen werden allein aus elapsed_in_state_s gerechnet, nicht aus der Serveruhr. Waechter sind erklaerte Vergleiche, keine Ausdruecke: ein Waechter, dessen Feld sich nicht aufloesen laesst, ergibt false und meldet das unter skipped_because."}}