|
| 1 | +# Brain Agent |
| 2 | +The Brain Agent is the long-lived L2 actor process that: |
| 3 | +- long-polls Switchboard for inbound operator instructions |
| 4 | +- uses MAS to assemble per-turn context |
| 5 | +- uses the Brain SDK as its only access path into Core |
| 6 | +- executes Capabilities as model tools |
| 7 | +- records finalized responses back into MAS |
| 8 | + |
| 9 | +------------------------------------------------------------------------ |
| 10 | +## Turn Execution Model |
| 11 | +For each inbound operator instruction, the Agent uses two separate layers of |
| 12 | +context. |
| 13 | + |
| 14 | +### 1. Cross-turn memory from MAS |
| 15 | +The Agent sends the new inbound message to `memory/assemble_context`. |
| 16 | + |
| 17 | +MAS appends that inbound turn to the session and returns the authoritative |
| 18 | +session context block: |
| 19 | +- profile |
| 20 | +- focus |
| 21 | +- prior dialogue |
| 22 | +- any compaction summaries |
| 23 | +- reference snippets |
| 24 | + |
| 25 | +This is the durable cross-turn conversational state. |
| 26 | + |
| 27 | +### 2. Turn-local orchestration state |
| 28 | +The Agent formats the MAS context plus the new inbound message into the current |
| 29 | +turn prompt for inference. |
| 30 | + |
| 31 | +Within that single turn, the model may: |
| 32 | +- request one or more tool calls |
| 33 | +- receive tool results |
| 34 | +- request additional tool calls |
| 35 | +- eventually return a final response |
| 36 | + |
| 37 | +That back-and-forth is temporary. It exists only for the duration of the |
| 38 | +current turn and is not the same thing as the long-lived conversation history |
| 39 | +stored by MAS. |
| 40 | + |
| 41 | +In other words: |
| 42 | +- MAS owns durable cross-turn memory |
| 43 | +- the Agent runtime owns only the ephemeral intra-turn tool loop |
| 44 | + |
| 45 | +### Turn Finalization |
| 46 | +After the model returns a final answer, the Agent sends that outbound response |
| 47 | +to `memory/record_response` so the turn is persisted into MAS session history. |
| 48 | + |
| 49 | + |
| 50 | +------------------------------------------------------------------------ |
| 51 | +_End of Brain Agent README_ |
0 commit comments