Bentrix Docs
HomePricingDashboard

Streams and long work

Following the market as it moves with wait_for or subscriptions/listen, and long work answered as a job or, for a client that asks, as a task.

Following a stream: wait_for

The simplest way, and the one every client can use, is the wait_for tool: give it a stream's address and the cursor you have, and it answers what came after it — waiting up to timeout_ms for something to come.

{"name": "wait_for", "arguments": {"uri": "bentrix://lab/1/bench/1/bars/EURUSD/H1/closed", "timeout_ms": 20000}}
{"items": [ …the bars that closed… ], "next": "1791151200000"}

Call it again with "after": "1791151200000" (the open time, in UTC milliseconds, of the last candle it gave) and you get only what is newer. A loop of wait_for calls is a program that reacts to each closed candle — the shape of a strategy of your own. The streams:

StreamWhat arrives
…/bars/{symbol}/{tf}/closedeach candle as it closes
…/bars/{symbol}/{tf}/livethe forming candle as it changes
…/ticks/{symbol}/liveeach tick
…/quotesthe workbench's quotes
…/dealseach deal on the account
…/journaleach line of the workbench's Journal
bentrix://alerts/logeach alert that fired
bentrix://agents/{agent}/logan agent's own acts

01subscriptions/listen

A client of the 2026-07-28 revision can instead open one long request, subscriptions/listen, naming the resources it follows; Bentrix keeps it open and sends a notification each time one changes, with a keep-alive every 15 seconds. A client of the 2025-11-25 revision uses resources/subscribe and the GET stream.

02Long work: jobs

A tool whose work outlives one call — a question put to the person, a strategy run, a batch, a walk-forward, the verification battery — answers at once with a handle: {"job": "…"} for a question, a run's, batch's or walk's uri for the rest. Read it with its own tool — job_get, run_get, batch_get, walk_get, battery_get — until it ends. A job that waits on the person says so (awaiting_person), and fails after ten minutes without an answer, having done nothing.

03Long work: tasks

A client that declares the official tasks extension (io.modelcontextprotocol/tasks in its per-request clientCapabilities) is answered with a task instead: tasks/get reads it — with the tool's result inline once it is completed — and tasks/cancel withdraws a question put to the person. Tasks live in the running Bentrix; after a restart their ids are unknown.

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed