ask ... of
ask … of
Query the current state of a running reactive machine. This is the third ask variant, designed for reading live state from long-running machines that maintain mutable state via subscribes and state blocks. Under the hood, ask ... of uses GenServer.call semantics: it sends a synchronous request to the running machine process and returns the current value of its responds with fields.
When to use
Use ask ... of when you need to:
- Read the current state of a reactive (event-driven) machine
- Check counters, flags, or accumulated values from a long-running process
- Coordinate between machines by observing shared state
- Build dashboards or monitors that aggregate state from multiple machines
Use ask ... using for LLM reasoning. Use ask ... from to call an effect machine that executes and returns a result. ask ... of does not execute the target; it reads its current state.
Three variants
| Variant | Syntax | Purpose |
|---|---|---|
ask ... using | ask classify, using: "anthropic:claude-sonnet-4-6" | Send a task to an LLM provider |
ask ... from | ask data, from: "@mashin/actions/http/get" | Request data from an effect machine |
ask ... of | ask status, of: "order_monitor" | Query a running machine’s state |
This page covers ask ... of. See the linked pages for the other variants.
Syntax
ask <name>, of: "<running_machine>"The of: target is the name (or path) of a reactive machine that is currently running. The step returns the machine’s current responds with fields as the step output.
Configuration
| Config | Required | Description |
|---|---|---|
of | Yes | Name or path of the running reactive machine to query |
There is no returns block for ask ... of. The output schema is determined by the target machine’s responds with declaration. If the target machine declares responds with failed_count as number, then steps.<name>.failed_count is available after this step.
Prerequisites
The target machine must be:
- A reactive machine with a
subscribesblock (which makes it a long-running GenServer process) - Currently running in the same cell. If the target is not running, the step returns an error.
- Declaring a
responds withsection that defines the queryable state fields.
Examples
Reading a counter from a monitor
machine alert_checker accepts threshold as number, default: 10
responds with needs_alert as boolean current_count as number
implements ask status, of: "order_monitor"
compute check { needs_alert: steps.status.failed_count > input.threshold, current_count: steps.status.failed_count }This queries order_monitor, a reactive machine that tracks failed orders:
machine order_monitor responds with failed_count as number last_failure as text
implements state failed_count: number, default: 0 last_failure: text
subscribes on "order.failed" run handle_failure
flows flow handle_failure compute increment { failed_count: state.failed_count + 1, last_failure: event.order_id }Multi-machine health dashboard
machine health_check responds with api_healthy as boolean queue_depth as number error_rate as number
implements ask api_status, of: "api_monitor" ask queue_status, of: "queue_monitor" ask error_status, of: "error_tracker"
compute aggregate { api_healthy: steps.api_status.healthy, queue_depth: steps.queue_status.pending_count, error_rate: steps.error_status.error_rate }Conditional action based on live state
machine throttle_checker accepts action as text, is required
responds with allowed as boolean reason as text
implements ask rate, of: "rate_limiter"
decide should_proceed when steps.rate.request_count < steps.rate.max_requests {allowed: true, reason: "Within rate limit"} otherwise {allowed: false, reason: "Rate limit exceeded: " + steps.rate.request_count + "/" + steps.rate.max_requests}Governance
ask ... of is a governed step. The governance interpreter checks that the calling machine has the call_machine capability before the query executes. The query itself is read-only (it does not mutate the target machine’s state), but it is still mediated because it crosses a machine boundary.
The governance check follows the same permission model as ask ... from:
- The machine must have
call_machine(ormachine.call) in itsallowed tolist - The query and its result are recorded in the behavioral ledger
- Token and cost budgets are not affected (no LLM call occurs)
Translations
| Language | Keyword |
|---|---|
| English | ask |
| Spanish | pregunta |
| French | demande |
| German | fragt |
| Japanese | 聞く |
| Chinese | 问 |
| Korean | 묻다 |
See also
- ask … using - Send a task to an LLM provider
- ask … from - Request data from an effect machine
- implements - Section where steps live
- ensures - Permission declarations for
call_machine