{"uid":"cap_UMP1_sgEERamWOy189t6j","slug":"halowerk-state-machine-step-f22ad916","name":"Halowerk State Machine Step","description":"Takes a machine definition, the current state, one event and an optional context, and computes a single step. Transitions may carry a guard, which is a declared comparison — field, operator, value — and never an expression: the field is a dotted path into context or payload, so a machine handed in by a stranger cannot execute anything on this server.","url":"https://agent.halowerk.com/v1/state-machine-step?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"event":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":64,"minLength":1,"description":"Event name."},"payload":{"type":"object","description":"Event data, addressable in guards as payload.<field>."}},"description":"The event to apply.","additionalProperties":false},"context":{"type":"object","description":"Machine context, addressable in guards as context.<field>. Never modified."},"machine":{"type":"object","required":["initial","states"],"properties":{"states":{"type":"array","items":{"type":"object","required":["name"],"properties":{"on":{"type":"array","items":{"type":"object","required":["event","target"],"properties":{"event":{"type":"string","maxLength":64,"minLength":1,"description":"Event name this transition reacts to."},"guard":{"type":"object","required":["field","op"],"properties":{"op":{"enum":["eq","ne","gt","gte","lt","lte","in","not_in","exists","not_exists"],"type":"string","description":"Comparison operator."},"field":{"type":"string","maxLength":200,"minLength":1,"description":"Dotted path starting with context. or payload., e.g. context.attempts."},"value":{"description":"Right-hand operand. Not used by exists and not_exists; an array for in and not_in."}},"description":"Condition that must hold for this transition to be taken.","additionalProperties":false},"target":{"type":"string","maxLength":64,"minLength":1,"description":"State to move to."},"actions":{"type":"array","items":{"type":"string","maxLength":64,"minLength":1},"maxItems":20,"description":"Actions triggered by this transition."}},"additionalProperties":false},"maxItems":50,"description":"Event-driven transitions out of this state, evaluated in order."},"name":{"type":"string","maxLength":64,"minLength":1,"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","maximum":31536000,"minimum":0,"description":"Deadline for this state in seconds."},"timeout_target":{"type":"string","maxLength":64,"minLength":1,"description":"State to move to when the deadline is exceeded. Without it a breach is only reported."},"timeout_actions":{"type":"array","items":{"type":"string","maxLength":64,"minLength":1},"maxItems":20,"description":"Actions triggered by the deadline transition."}},"additionalProperties":false},"maxItems":200,"minItems":1,"description":"The states of the machine."},"initial":{"type":"string","maxLength":64,"minLength":1,"description":"Name of the initial state. Must be one of the defined states."}},"description":"The automaton definition.","additionalProperties":false},"current_state":{"type":"string","maxLength":64,"minLength":1,"description":"The state the machine is in right now."},"elapsed_in_state_s":{"type":"number","default":0,"maximum":31536000,"minimum":0,"description":"Seconds already spent in current_state. Supplied by you, so the result does not depend on this server clock."},"timeout_precedence":{"enum":["timeout","event"],"type":"string","default":"timeout","description":"Which side wins when the deadline is breached and an event transition also matches."}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_P4Q6aQyLKagX4vU7LPWJh","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes a single deterministic state-machine transition given a machine definition, current state, and an event, with optional guard conditions evaluated against context or payload fields.","exampleAgentPrompt":"Run one step of my state machine — the machine has states 'idle', 'processing', and 'done', currently in 'idle', and I'm sending the event 'start' with payload {userId: '42'} and a guard that checks payload.userId exists before moving to 'processing'.","exampleUseCases":[{"title":"Order fulfillment workflow step","prompt":"I have an order fulfillment state machine with states 'pending', 'paid', 'shipped', and 'delivered'. The order is currently in 'paid', and I just received a 'ship' event with payload {trackingId: 'TRK123'}. Advance it one step and tell me the next state and any actions triggered."},{"title":"Retry logic with guard condition","prompt":"My retry state machine is in the 'waiting' state and I need to apply a 'retry' event. There's a guard that only allows the transition to 'retrying' if context.attempts is less than 3 — the current context has attempts set to 2. Compute the next step."},{"title":"Agent task handoff gate","prompt":"I'm orchestrating an agent pipeline. The machine is in 'awaiting_approval' and the event is 'approved' with payload {score: 0.92}. The guard requires payload.score to be greater than or equal to 0.8 before moving to 'executing'. Run the state machine step and confirm whether we transition."}],"resultDescription":"Returns the next state name the machine transitions to, along with any action labels declared on the taken transition, or an indication that no transition was taken (e.g. guard failed or no matching event handler in the current state).","failureModes":["Guard condition not met — no transition taken, machine stays in current state","Event name does not match any transition in current state — no-op response","Current state is marked final — no events accepted, returns error or no-op","Invalid dotted path in guard field — field resolution fails","Machine definition missing required 'initial' or 'states' fields — validation error","State referenced in transition target does not exist in machine definition"],"whenToPreferThis":"Choose this endpoint when you need a stateless, sandboxed, single-step FSM evaluation that cannot execute arbitrary code — guard conditions are declarative comparisons (field, operator, value), never expressions, so it is safe to hand in externally-supplied machine definitions. Prefer it over full workflow engines when you want lightweight, per-step control with explicit action labels rather than side-effectful execution.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-11T06:47:01.492Z","isFirstParty":false,"canonicalSlug":"halowerk-state-machine-step-f22ad916"}