Bentrix Docs
HomePricingDashboard

Go: the agent itself

Every method of client.Agent in the Go 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
func (a *AgentAPI) Release(ctx context.Context) (any, error)

It takes no arguments.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers what was let go.

Example

client.Agent.Release(ctx)

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
func (a *AgentAPI) Whoami(ctx context.Context) (any, error)

It takes no arguments.

Returns

(any, error) — the tool’s answer as maps and slices (any).

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(ctx)

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
func (a *AgentAPI) Describe(ctx context.Context, args AgentDescribeArgs) (any, error)

Parameters

NameTypeWhat it is
NamestringrequiredA tool's name.

Returns

(any, error) — the tool’s answer as maps and slices (any).

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(ctx, mcp.AgentDescribeArgs{Name: "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
func (a *AgentAPI) FeedbackReport(ctx context.Context, args AgentFeedbackReportArgs) (*Job, error)

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, error) — job.Wait(ctx, time.Second/2) 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 slices (any).

What it answers

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

Example

client.Agent.FeedbackReport(ctx, mcp.AgentFeedbackReportArgs{Queue: "…", Text: "…"})

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
func (a *AgentAPI) FeedbackSend(ctx context.Context, args AgentFeedbackSendArgs) (*Job, error)

Parameters

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

Returns

(*Job, error) — job.Wait(ctx, time.Second/2) 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 slices (any).

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(ctx, mcp.AgentFeedbackSendArgs{Queue: "…", Text: "…"})

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
func (a *AgentAPI) JobCancel(ctx context.Context, args AgentJobCancelArgs) (any, error)

Parameters

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

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the job.

Example

client.Agent.JobCancel(ctx, mcp.AgentJobCancelArgs{Job: 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
func (a *AgentAPI) JobGet(ctx context.Context, args AgentJobGetArgs) (any, error)

Parameters

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

Returns

(any, error) — the tool’s answer as maps and slices (any).

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(ctx, mcp.AgentJobGetArgs{Job: 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
func (a *AgentAPI) JobList(ctx context.Context) (any, error)

It takes no arguments.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

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

Example

client.Agent.JobList(ctx)

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
func (a *AgentAPI) JournalNote(ctx context.Context, args AgentJournalNoteArgs) (any, error)

Parameters

NameTypeWhat it is
BenchstringrequiredThe workbench's uri.
Textstringrequired

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

What the tool's description says.

Example

client.Agent.JournalNote(ctx, mcp.AgentJournalNoteArgs{Bench: bench, Text: "…"})

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
func (a *AgentAPI) ResourceList(ctx context.Context, args AgentResourceListArgs) (any, error)

Parameters

NameTypeWhat it is
Prefix*stringoptional

Returns

(any, error) — the tool’s answer as maps and slices (any).

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(ctx, mcp.AgentResourceListArgs{})

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
func (a *AgentAPI) ResourceRead(ctx context.Context, args AgentResourceReadArgs) (any, error)

Parameters

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

Returns

(any, error) — the tool’s answer as maps and slices (any).

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(ctx, mcp.AgentResourceReadArgs{Uri: 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
func (a *AgentAPI) ToolDescribe(ctx context.Context, args AgentToolDescribeArgs) (any, error)

Parameters

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

Returns

(any, error) — the tool’s answer as maps and slices (any).

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(ctx, mcp.AgentToolDescribeArgs{Name: "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
func (a *AgentAPI) WaitFor(ctx context.Context, args AgentWaitForArgs) (any, error)

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.
After*stringoptionalThe cursor the last page answered as next; omitted, only what is new.
TimeoutMs*int64optionalHow long to wait for something new, at most 60000 ms; 30000 when omitted.

Returns

(any, error) — the tool’s answer as maps and slices (any).

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(ctx, mcp.AgentWaitForArgs{Uri: uri})

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