proto: subagent prompt/history as structured AgentStart fields#1
Open
christopherwxyz wants to merge 1 commit into
Open
proto: subagent prompt/history as structured AgentStart fields#1christopherwxyz wants to merge 1 commit into
christopherwxyz wants to merge 1 commit into
Conversation
The Gemini planner used to synthesize a multi-line string envelope as
the subagent's first user-role Message:
History Summary:
<stringified conversation history>
Prompt:
<the planner's `prompt` function-call argument verbatim>
Every subagent that wanted clean access to the planner's typed `prompt`
arg had to string-parse the envelope. Any change to the envelope
wording silently broke every subagent.
This commit replaces the envelope with two new fields on AgentStart:
string subagent_prompt = 4; // planner's `prompt` arg verbatim
string subagent_history = 5; // planner's `history` arg verbatim
The planner now populates these structured fields and leaves
AgentStart.Messages empty for planner-driven dispatch. Messages
remains the wire surface for direct (non-planner) callers (e.g.
grpcurl).
This is a BREAKING CHANGE for subagents that currently read
lastUserText(start.Messages) on planner-driven invocations — they
must switch to start.GetSubagentPrompt(). The reference
python_sandbox_agent example is updated in a sibling PR.
Test: TestHandleSubagentCall_PopulatesStructuredFieldsOnly asserts the
structured fields are populated AND AgentStart.Messages is empty (any
"History Summary:\n…\nPrompt:\n…" string showing up in Messages is
now a regression).
go test -race ./... clean.
f76963d to
aa0eff0
Compare
christopherwxyz
added a commit
that referenced
this pull request
May 25, 2026
…earch_agent) These two examples were Slack-specific / Vertex-specific application code that has been extracted into the uno-infra monorepo where they belong (deployed alongside their K8s manifests). Keeping them in the AX fork's examples/ created merge conflicts on every upstream pull from google/ax. With them gone, the fork's divergence from upstream is bounded to: - the three PR branches (#1 #2 #3) of generic AX improvements - feat/agent-sandbox-backend's tracking branch examples/python_sandbox_agent/ stays — it's a generic reference implementation of the agent-sandbox backend pattern, useful upstream.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the planner's synthesized envelope string with two typed
AgentStartproto fields.Motivation
The Gemini planner currently synthesizes a multi-line string envelope
as
Messages[0]:Every subagent that wants clean access to the typed
promptarg hasto string-parse this envelope. Any change to the envelope wording
silently breaks every subagent.
Change
subagent_prompt(field 4) andsubagent_history(field 5) onAgentStart. Planner populates them from the typed GeminiFunctionCall.Argsdirectly.planner-driven dispatch,
AgentStart.Messagesis empty.Messagesremains the wire surface for direct (non-planner)callers (e.g.
grpcurl-driven testing of a subagent).Breaking change
Subagents that currently read
lastUserText(start.Messages)onplanner-driven invocations must migrate to:
The reference
python_sandbox_agentexample in PR #3 is updated tothis pattern in a sibling commit.
Test coverage
TestHandleSubagentCall_PopulatesStructuredFieldsOnly— asserts:SubagentPrompt+SubagentHistorypopulated from typed argsMessagesis empty (regression guard against re-introducing theenvelope)
go test -race ./...clean.Related