Documentation
¶
Overview ¶
Command third-party-brain is the smallest brain a third party can write against the SDK and the executor contract alone (ADR-0029): it takes a turn, decides what to do, asks the user's approval, runs the tool wherever the session's hands are, and reports events.
There is no model in it. The "model loop" is one line: a prompt of the form
bash: <command>
is a request to run that command; anything else is answered with text. A real brain replaces decide() with its model and keeps the rest.
What the SDK does for the brain:
- turn.start, turn.input, turn.cancel and session.close, event ids and sequences, acknowledgements and resend after a reconnect;
- the tool route (AgentTurn.Tools): when the session's hands are on another machine the platform hands the turn its tools endpoint, and every call goes there through the platform's gateway, which re-checks policy and approval, runs it at most once and runs it on the hands. The brain never learns where the hands are, and none of its calls can run on this machine by mistake. Tools() is nil when the hands are this machine: this example has no local tools and says so.
Declaring platform_credentials brain_tools (below) is what lets the platform give this machine a session whose hands are elsewhere.
BMA_MACHINE_TOKEN=<machine token> go run ./examples/third-party-brain \ -base-url https://executor.example -machine-id mch_...