Bentrix Docs
HomePricingDashboard

Java: the agent itself

Every method of client.agent in the Java 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
public Object release()

It takes no arguments.

Returns

Object — the tool’s answer as maps and lists.

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
public Object whoami()

It takes no arguments.

Returns

Object — the tool’s answer as maps and lists.

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
public Object describe(DescribeArgs args)

Parameters

NameTypeWhat it is
nameStringrequiredA tool's name.

Returns

Object — the tool’s answer as maps and lists.

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(new Bentrix.AgentApi.DescribeArgs("chart_open"))

feedbackReport#

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
public Job feedbackReport(FeedbackReportArgs args)

Parameters

NameTypeWhat it is
queueStringrequired
textStringrequiredThe 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

Job — job.waitFor(timeout, 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 maps and lists.

What it answers

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

Example

client.agent.feedbackReport(new Bentrix.AgentApi.FeedbackReportArgs("…", "…"))

feedbackSend#

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
public Job feedbackSend(FeedbackSendArgs args)

Parameters

NameTypeWhat it is
queueStringrequired
textStringrequiredThe report, in the agent's words; the person reads it before it is sent.

Returns

Job — job.waitFor(timeout, 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 maps and lists.

What it answers

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

Example

client.agent.feedbackSend(new Bentrix.AgentApi.FeedbackSendArgs("…", "…"))

jobCancel#

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
public Object jobCancel(JobCancelArgs args)

Parameters

NameTypeWhat it is
jobStringrequiredThe job's handle, as the tool that started it answered.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the job.

Example

client.agent.jobCancel(new Bentrix.AgentApi.JobCancelArgs(job))

jobGet#

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
public Object jobGet(JobGetArgs args)

Parameters

NameTypeWhat it is
jobStringrequiredThe job's handle, as the tool that started it answered.

Returns

Object — the tool’s answer as maps and lists.

What it answers

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

Example

client.agent.jobGet(new Bentrix.AgentApi.JobGetArgs(job))

jobList#

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
public Object jobList()

It takes no arguments.

Returns

Object — the tool’s answer as maps and lists.

What it answers

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

Example

client.agent.jobList()

journalNote#

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
public Object journalNote(JournalNoteArgs args)

Parameters

NameTypeWhat it is
benchStringrequiredThe workbench's uri.
textStringrequired

Returns

Object — the tool’s answer as maps and lists.

What it answers

What the tool's description says.

Example

client.agent.journalNote(new Bentrix.AgentApi.JournalNoteArgs(bench, "…"))

resourceList#

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
public Object resourceList(ResourceListArgs args)

Parameters

NameTypeWhat it is
prefixStringoptional

Returns

Object — the tool’s answer as maps and lists.

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.resourceList(new Bentrix.AgentApi.ResourceListArgs())

resourceRead#

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
public Object resourceRead(ResourceReadArgs args)

Parameters

NameTypeWhat it is
uriStringrequiredA resource's URI, as resources/read takes it, its query included.

Returns

Object — the tool’s answer as maps and lists.

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.resourceRead(new Bentrix.AgentApi.ResourceReadArgs(uri))

toolDescribe#

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
public Object toolDescribe(ToolDescribeArgs args)

Parameters

NameTypeWhat it is
nameStringrequiredThe tool's name, as tools/list names it.

Returns

Object — the tool’s answer as maps and lists.

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.toolDescribe(new Bentrix.AgentApi.ToolDescribeArgs("order_market"))

waitFor#

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
public Object waitFor(WaitForArgs args)

Parameters

NameTypeWhat it is
uriStringrequiredA 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.
afterStringoptionalThe cursor the last page answered as next; omitted, only what is new.
timeoutMslongoptionalHow long to wait for something new, at most 60000 ms; 30000 when omitted.

Returns

Object — the tool’s answer as maps and lists.

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.waitFor(new Bentrix.AgentApi.WaitForArgs(uri))

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