Problem
Today the front end resends the entire message history to the runner on every turn (web/packages/agenta-playground/src/state/execution/agentRequest.ts, the history array). This is a pre-sessions workaround, and it has real costs: the payload grows with every turn, and any attachment bytes in the history are re-uploaded again and again.
The product direction is the opposite split of responsibility:
- The front end sends only the last message on each turn.
- The runner owns conversation context. When a session is warm, the harness already holds the context. When a session cannot be resumed warm (runner restart, sandbox eviction, crash), the runner should read the session's records and rebuild the conversation itself before running the new turn.
The substrate for this already exists. The runner persists every event to the API's records log independent of any browser (services/runner/src/sessions/persist.ts, POST /sessions/records/ingest), and records can be queried back (POST /sessions/records/query, RecordsRouter in api/oss/src/apis/fastapi/sessions/router.py). What is missing is the runner-side rebuild: on a cold start, query the records for the session and reconstruct the harness conversation from them, instead of relying on the front end to resend everything.
Todo
Related
Problem
Today the front end resends the entire message history to the runner on every turn (
web/packages/agenta-playground/src/state/execution/agentRequest.ts, thehistoryarray). This is a pre-sessions workaround, and it has real costs: the payload grows with every turn, and any attachment bytes in the history are re-uploaded again and again.The product direction is the opposite split of responsibility:
The substrate for this already exists. The runner persists every event to the API's records log independent of any browser (
services/runner/src/sessions/persist.ts,POST /sessions/records/ingest), and records can be queried back (POST /sessions/records/query,RecordsRouterinapi/oss/src/apis/fastapi/sessions/router.py). What is missing is the runner-side rebuild: on a cold start, query the records for the session and reconstruct the harness conversation from them, instead of relying on the front end to resend everything.Todo
/sessions/records/queryfor the session and rebuild the conversation context from records before running the new turn."[image]",services/runner/src/engines/sandbox_agent/transcript.ts). The agent multi-modality design (PR [docs] Plan agent multi-modality #5439) makes records carry small attachment references instead of bytes, which is what a faithful rebuild needs.Related