Every method of client.agent in the JavaScript SDK.
release#
Let go of what this agent started · tool agent_release
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
release(): Promise<any>It takes no arguments.
Returns
Promise<any> — the tool’s answer as a plain object.
What it answers
Answers what was let go.
Example
await client.agent.release()whoami#
Who this agent is · tool agent_whoami
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
whoami(): Promise<any>It takes no arguments.
Returns
Promise<any> — the tool’s answer as a plain object.
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
await client.agent.whoami()describe#
Describe a tool · tool describe
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
describe(args: { name: string }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
name | string | required | A tool's name. |
Returns
Promise<any> — the tool’s answer as a plain object.
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
await client.agent.describe({ name: "chart_open" })feedbackReport#
Send a report to Bentrix · tool feedback_report
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
feedbackReport(args: { queue: "need" | "bug"; text: string }): Job<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
queue | "need" | "bug" | required | |
text | string | required | The 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 — await job.wait() 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 plain object.
What it answers
Answers a job: completed when the intake took it, failed with why when it did not arrive.
Example
await client.agent.feedbackReport({ queue: "…", text: "…" })feedbackSend#
Ask the person to send a report to Bentrix · tool feedback_send
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
feedbackSend(args: { queue: "need" | "bug"; text: string }): Job<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
queue | "need" | "bug" | required | |
text | string | required | The report, in the agent's words; the person reads it before it is sent. |
Returns
Job — await job.wait() 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 plain object.
What it answers
Answers a job: completed when it is sent, failed when it was closed unsent or did not arrive.
Example
await client.agent.feedbackSend({ queue: "…", text: "…" })jobCancel#
Withdraw a job's question · tool job_cancel
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
jobCancel(args: { job: string }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
job | string | required | The job's handle, as the tool that started it answered. |
Returns
Promise<any> — the tool’s answer as a plain object.
What it answers
Answers the job.
Example
await client.agent.jobCancel({ job })jobGet#
Read a job · tool job_get
Answers a job this agent started: awaiting_person, completed with its result, failed with the reason, or cancelled.
Declaration
client.agent
jobGet(args: { job: string }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
job | string | required | The job's handle, as the tool that started it answered. |
Returns
Promise<any> — the tool’s answer as a plain object.
What it answers
Answers a job this agent started: awaiting_person, completed with its result, failed with the reason, or cancelled.
Example
await client.agent.jobGet({ job })jobList#
List this agent's jobs · tool job_list
Answers every job this agent started this sitting, each as job_get answers it.
Declaration
client.agent
jobList(): Promise<any>It takes no arguments.
Returns
Promise<any> — the tool’s answer as a plain object.
What it answers
Answers every job this agent started this sitting, each as job_get answers it.
Example
await client.agent.jobList()journalNote#
Write in a workbench's Journal · tool journal_note
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
journalNote(args: { bench: string; text: string }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
bench | string | required | The workbench's uri. |
text | string | required |
Returns
Promise<any> — the tool’s answer as a plain object.
What it answers
What the tool's description says.
Example
await client.agent.journalNote({ bench, text: "…" })resourceList#
List the resources · tool resource_list
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
resourceList(args: { prefix?: string }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
prefix | string | optional |
Returns
Promise<any> — the tool’s answer as a plain object.
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
await client.agent.resourceList()resourceRead#
Read a resource · tool resource_read
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
resourceRead(args: { uri: string }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
uri | string | required | A resource's URI, as resources/read takes it, its query included. |
Returns
Promise<any> — the tool’s answer as a plain object.
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
await client.agent.resourceRead({ uri })search#
Find tools · tool search
The tools whose name, title or description holds every word given, each with its title and the scope it needs.
Declaration
client.agent
search(args: { text: string }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
text | string | required | Words looked for in a tool's name, title and description. |
Returns
Promise<any> — the tool’s answer as a plain object.
What it answers
Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):
{
"tools": []
}Example
await client.agent.search({ text: "moving average" })toolDescribe#
Describe one tool · tool tool_describe
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
toolDescribe(args: { name: string }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
name | string | required | The tool's name, as tools/list names it. |
Returns
Promise<any> — the tool’s answer as a plain object.
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
await client.agent.toolDescribe({ name: "order_market" })waitFor#
Wait for a stream's next items · tool wait_for
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
waitFor(args: { uri: string; after?: string; timeout_ms?: number }): Promise<any>Parameters
| Name | Type | What it is | |
|---|---|---|---|
uri | string | required | A 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. |
after | string | optional | The cursor the last page answered as next; omitted, only what is new. |
timeout_ms | number | optional | How long to wait for something new, at most 60000 ms; 30000 when omitted. |
Returns
Promise<any> — the tool’s answer as a plain object.
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
await client.agent.waitFor({ uri })