Bentrix Docs
HomePricingDashboard

Rust: the agent itself

Every method of client.agent() in the Rust SDK.

release#

Let go of what this agent started · tool agent_release

scope: labplan: plussince 1.0.0

Pauses every strategy run this agent started that still runs, and disarms the automation of the workbenches they ran on — everything else stays as it is. Answers what was let go.

Declaration

client.agent()
pub fn release(&self) -> Result<Value

It takes no arguments.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers what was let go.

Example

client.agent().release()?

whoami#

Who this agent is · tool agent_whoami

scope: readplan: freesince 1.0.0

This agent's name as its client gave it, the scopes the person granted it on Settings › Agents, the catalogue's version, and whether it is answered while the window is minimized.

Declaration

client.agent()
pub fn whoami(&self) -> Result<Value

It takes no arguments.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):

{
  "agent": 1,
  "catalogue_version": "3.15.0",
  "client": "bentrix-python-sdk",
  "scopes": [
    "read",
    "lab",
    "paper"
  ],
  "served_while_minimized": true
}

Example

client.agent().whoami()?

describe#

Describe a tool · tool describe

scope: readplan: freesince 1.0.0

One tool as the catalogue declares it: its title, description, scope, tier, the version it arrived in, and its arguments' and answer's schemas.

Declaration

client.agent()
pub fn describe(&self, args: AgentDescribeArgs) -> Result<Value

Parameters

NameTypeWhat it is
nameimpl Into<String>requiredA tool's name.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):

{
  "scope": "lab",
  "since": "1.0.0",
  "tier": "plus",
  "tool": {
    "_meta": {
      "bentrix/scope": "lab",
      "bentrix/since": "1.0.0",
      "bentrix/tier": "plus"
    },
    "annotations": {
      "destructiveHint": false,
      "openWorldHint": false
    },
    "description": "Opens a chart window of one of the workbench's markets, as Market Watch's Chart window does: a market already charted comes to the front unless new_window asks for a second window. Answers the chart.",
    "inputSchema": {
      "additionalProperties": false,
      "properties": {
        "bench": {
          "description": "The workbench's uri.",
          "type": "string"
        },
        "new_window": {
          "default": false,
          "description": "A second window of a market already charted, as the bar's new-window button opens.",
          "type": "boolean"
        },
        "symbol": {
          "description": "One of the workbench's markets.",
          "type": "string"
        },
        "timeframe": {
          "default": null,
          "description": "The interval, as the menu writes it (M1 when absent).",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "bench",
        "symbol"
      ],
      "title": "ChartOpenArgs",
      "type": "object"
    },
    "name": "chart_open",
    "title": "Open a chart"
  }
}

Example

client.agent().describe(mcp::AgentDescribeArgs::new("chart_open"))?

feedback_report#

Send a report to Bentrix · tool feedback_report

scope: labplan: freesince 1.22.0long work: answers a job

Sends a bug the agent found, or a need it has, to Bentrix's intake itself, exactly as the report window's Send does - the same queue (bug or need), the same install id, build, platform and moment, no account - with a first line naming the agent; the person is not asked first, and the agent's log keeps the text sent. At most 5 an hour from one agent. Answers a job: completed when the intake took it, failed with why when it did not arrive.

Declaration

client.agent()
pub fn feedback_report(&self, args: AgentFeedbackReportArgs) -> Result<Job

Parameters

NameTypeWhat it is
queueimpl Into<String>required
textimpl Into<String>requiredThe report, in the agent's own words: what it did, what it saw, what it expected. Sent as it is, under a first line naming the agent; no person reads it before it leaves.

Returns

Result<Job, Error> — job.wait(None, poll) answers the result: this is long work, or work the person allows first, so the call answers at once with a job and its result comes when it ends, as a serde_json::Value.

What it answers

Answers a job: completed when the intake took it, failed with why when it did not arrive.

Example

client.agent().feedback_report(mcp::AgentFeedbackReportArgs::new("…", "…"))?

feedback_send#

Ask the person to send a report to Bentrix · tool feedback_send

scope: labplan: freesince 1.0.0long work: answers a job

Opens Bentrix's report window filled with this text, in the need or bug queue; the person sends it or closes it. Answers a job: completed when it is sent, failed when it was closed unsent or did not arrive.

Declaration

client.agent()
pub fn feedback_send(&self, args: AgentFeedbackSendArgs) -> Result<Job

Parameters

NameTypeWhat it is
queueimpl Into<String>required
textimpl Into<String>requiredThe report, in the agent's words; the person reads it before it is sent.

Returns

Result<Job, Error> — job.wait(None, poll) answers the result: this is long work, or work the person allows first, so the call answers at once with a job and its result comes when it ends, as a serde_json::Value.

What it answers

Answers a job: completed when it is sent, failed when it was closed unsent or did not arrive.

Example

client.agent().feedback_send(mcp::AgentFeedbackSendArgs::new("…", "…"))?

job_cancel#

Withdraw a job's question · tool job_cancel

scope: labplan: freesince 1.0.0

Withdraws a question this agent asked that the person has not answered: a card is taken away; a sheet or window the person has open stays theirs. Answers the job.

Declaration

client.agent()
pub fn job_cancel(&self, args: AgentJobCancelArgs) -> Result<Value

Parameters

NameTypeWhat it is
jobimpl Into<String>requiredThe job's handle, as the tool that started it answered.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the job.

Example

client.agent().job_cancel(mcp::AgentJobCancelArgs::new(job.clone()))?

job_get#

Read a job · tool job_get

scope: readplan: freesince 1.0.0

Answers a job this agent started: awaiting_person, completed with its result, failed with the reason, or cancelled.

Declaration

client.agent()
pub fn job_get(&self, args: AgentJobGetArgs) -> Result<Value

Parameters

NameTypeWhat it is
jobimpl Into<String>requiredThe job's handle, as the tool that started it answered.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers a job this agent started: awaiting_person, completed with its result, failed with the reason, or cancelled.

Example

client.agent().job_get(mcp::AgentJobGetArgs::new(job.clone()))?

job_list#

List this agent's jobs · tool job_list

scope: readplan: freesince 1.0.0

Answers every job this agent started this sitting, each as job_get answers it.

Declaration

client.agent()
pub fn job_list(&self) -> Result<Value

It takes no arguments.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers every job this agent started this sitting, each as job_get answers it.

Example

client.agent().job_list()?

journal_note#

Write in a workbench's Journal · tool journal_note

scope: labplan: plussince 1.0.0

Writes one line in a workbench's Journal and Bentrix's log, after this agent's own name, as a run's lines are written.

Declaration

client.agent()
pub fn journal_note(&self, args: AgentJournalNoteArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>requiredThe workbench's uri.
textimpl Into<String>required

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

What the tool's description says.

Example

client.agent().journal_note(mcp::AgentJournalNoteArgs::new(bench.clone(), "…"))?

resource_list#

List the resources · tool resource_list

scope: readplan: freesince 1.0.0

Answers every resource and stream template this application serves, with its name, title, whether it is a stream and whether it pages, as resources/templates/list gives them; prefix keeps the templates that start with it.

Declaration

client.agent()
pub fn resource_list(&self, args: AgentResourceListArgs) -> Result<Value

Parameters

NameTypeWhat it is
prefiximpl Into<String>optional

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers every resource and stream template this application serves, with its name, title, whether it is a stream and whether it pages, as resources/templates/list gives them; prefix keeps the templates that start with it.

Example

client.agent().resource_list(mcp::AgentResourceListArgs::new())?

resource_read#

Read a resource · tool resource_read

scope: readplan: freesince 1.0.0

Answers the same content resources/read gives for a uri, for a client that does not surface resources: the workspace, a workbench, its book, its bars, ticks, quotes, deals and Journal, the screen, the logs, a run. Resource_list names them.

Declaration

client.agent()
pub fn resource_read(&self, args: AgentResourceReadArgs) -> Result<Value

Parameters

NameTypeWhat it is
uriimpl Into<String>requiredA resource's URI, as resources/read takes it, its query included.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the same content resources/read gives for a uri, for a client that does not surface resources: the workspace, a workbench, its book, its bars, ticks, quotes, deals and Journal, the screen, the logs, a run.

Example

client.agent().resource_read(mcp::AgentResourceReadArgs::new(uri.clone()))?

tool_describe#

Describe one tool · tool tool_describe

scope: readplan: freesince 1.22.0

Answers one tool's whole declaration as tools/list gives it - its description, inputSchema, outputSchema, annotations and _meta - for a client that listed the tools brief (_meta bentrix/brief on tools/list). A tool this agent's scopes do not reach is answered as one that does not exist.

Declaration

client.agent()
pub fn tool_describe(&self, args: AgentToolDescribeArgs) -> Result<Value

Parameters

NameTypeWhat it is
nameimpl Into<String>requiredThe tool's name, as tools/list names it.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):

{
  "_meta": {
    "bentrix/scope": "lab",
    "bentrix/since": "1.0.0",
    "bentrix/tier": "plus",
    "bentrix/trades": true
  },
  "annotations": {
    "destructiveHint": true,
    "openWorldHint": false
  },
  "description": "Sends a market order on a laboratory or paper workbench through the trade panel's own door; it fills on the workbench's next tick. Refused in the venue's own words where a press would be (a closed market, the stops level, the trade mode). Answers the book and the venue's last answer. On a real accou…",
  "inputSchema": {
    "$defs": {
      "SideArg": {
        "enum": [
          "buy",
          "sell"
        ],
        "type": "string"
      }
    },
    "additionalProperties": false,
    "properties": {
      "bench": {
        "type": "string"
      },
      "side": {
        "$ref": "#/$defs/SideArg"
      },
      "sl": {
        "default": null,
        "description": "The stop, a price; absent for none.",
        "format": "double",
        "type": [
          "number",
          "null"
        ]
      },
      "symbol": {
        "type": "string"
      },
      "tp": {
        "default": null,
        "description": "The target, a price; absent for none.",
        "format": "double",
        "type": [
          "number",
          "null"
        ]
      },
      "volume": {
        "format": "double",
        "type": "number"
      }
    },
    "required": [
      "bench",
      "symbol",
      "side",
      "volume"
    ],
    "title": "OrderMarketArgs",
    "type": "object"
  },
  "name": "order_market",
  "title": "Send a market order"
}

Example

client.agent().tool_describe(mcp::AgentToolDescribeArgs::new("order_market"))?

wait_for#

Wait for a stream's next items · tool wait_for

scope: readplan: freesince 1.0.0

Answers a stream's items since after, waiting up to timeout_ms (at most 60000) for one when there is none yet: the same page subscriptions deliver, for a client that holds no stream. Next is the cursor to pass as after.

Declaration

client.agent()
pub fn wait_for(&self, args: AgentWaitForArgs) -> Result<Value

Parameters

NameTypeWhat it is
uriimpl Into<String>requiredA stream's URI, without its cursor: bentrix://lab/1/bench/2/quotes, bentrix://alerts/log. A stream that takes parameters keeps them in its query (…/closed/window?frames=M15,H1); after is never one of them.
afterimpl Into<String>optionalThe cursor the last page answered as next; omitted, only what is new.
timeout_msi64optionalHow long to wait for something new, at most 60000 ms; 30000 when omitted.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):

{
  "items": [
    {
      "ask": 0.96841,
      "at_ms": 1791892941488,
      "bid": 0.96831,
      "digits": 5,
      "symbol": "SYN-DOCS"
    },
    {
      "ask": 5.76316,
      "at_ms": 1791892944127,
      "bid": 5.76306,
      "digits": 5,
      "symbol": "SYN-DOCS2"
    }
  ],
  "next": "1791892944127"
}

Example

client.agent().wait_for(mcp::AgentWaitForArgs::new(uri.clone()))?

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