Every method of client.agent in the C++ 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
Json release()It takes no arguments.
Returns
Json — the tool’s answer as a Json value.
What it answers
Answers what was let go.
Example
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
Json whoami()It takes no arguments.
Returns
Json — the tool’s answer as a 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
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
Json describe(const DescribeArgs &args)Parameters
| Name | Type | What it is | |
|---|---|---|---|
name | std::string | required | A tool's name. |
Returns
Json — the tool’s answer as a 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(AgentApi::DescribeArgs("chart_open"))feedback_report#
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
Job feedback_report(const FeedbackReportArgs &args)Parameters
| Name | Type | What it is | |
|---|---|---|---|
queue | std::string | required | |
text | std::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 — 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 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(AgentApi::FeedbackReportArgs("…", "…"))feedback_send#
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
Job feedback_send(const FeedbackSendArgs &args)Parameters
| Name | Type | What it is | |
|---|---|---|---|
queue | std::string | required | |
text | std::string | required | The report, in the agent's words; the person reads it before it is sent. |
Returns
Job — 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 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(AgentApi::FeedbackSendArgs("…", "…"))job_cancel#
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
Json job_cancel(const JobCancelArgs &args)Parameters
| Name | Type | What it is | |
|---|---|---|---|
job | std::string | required | The job's handle, as the tool that started it answered. |
Returns
Json — the tool’s answer as a Json value.
What it answers
Answers the job.
Example
client.agent.job_cancel(AgentApi::JobCancelArgs(job))job_get#
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
Json job_get(const JobGetArgs &args)Parameters
| Name | Type | What it is | |
|---|---|---|---|
job | std::string | required | The job's handle, as the tool that started it answered. |
Returns
Json — the tool’s answer as a 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(AgentApi::JobGetArgs(job))job_list#
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
Json job_list()It takes no arguments.
Returns
Json — the tool’s answer as a 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
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
Json journal_note(const JournalNoteArgs &args)Parameters
| Name | Type | What it is | |
|---|---|---|---|
bench | std::string | required | The workbench's uri. |
text | std::string | required |
Returns
Json — the tool’s answer as a Json value.
What it answers
What the tool's description says.
Example
client.agent.journal_note(AgentApi::JournalNoteArgs(bench, "…"))resource_list#
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
Json resource_list(const ResourceListArgs &args)Parameters
| Name | Type | What it is | |
|---|---|---|---|
prefix | std::string | optional |
Returns
Json — the tool’s answer as a 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(AgentApi::ResourceListArgs())resource_read#
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
Json resource_read(const ResourceReadArgs &args)Parameters
| Name | Type | What it is | |
|---|---|---|---|
uri | std::string | required | A resource's URI, as resources/read takes it, its query included. |
Returns
Json — the tool’s answer as a 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(AgentApi::ResourceReadArgs(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
Json search(const SearchArgs &args)Parameters
| Name | Type | What it is | |
|---|---|---|---|
text | std::string | required | Words looked for in a tool's name, title and description. |
Returns
Json — the tool’s answer as a 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):
{
"tools": []
}Example
client.agent.search(AgentApi::SearchArgs("moving average"))tool_describe#
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
Json tool_describe(const ToolDescribeArgs &args)Parameters
| Name | Type | What it is | |
|---|---|---|---|
name | std::string | required | The tool's name, as tools/list names it. |
Returns
Json — the tool’s answer as a 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(AgentApi::ToolDescribeArgs("order_market"))wait_for#
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
Json wait_for(const WaitForArgs &args)Parameters
| Name | Type | What it is | |
|---|---|---|---|
uri | std::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 | std::string | optional | The cursor the last page answered as next; omitted, only what is new. |
timeout_ms | int64_t | optional | How long to wait for something new, at most 60000 ms; 30000 when omitted. |
Returns
Json — the tool’s answer as a 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(AgentApi::WaitForArgs(uri))