Skip to content

Standardize planner output as typed content blocks for PlanReActPlanner and BuiltInPlanner - #6666

Open
guptaishaan wants to merge 1 commit into
google:mainfrom
guptaishaan:fix/issue-3378-3276
Open

Standardize planner output as typed content blocks for PlanReActPlanner and BuiltInPlanner#6666
guptaishaan wants to merge 1 commit into
google:mainfrom
guptaishaan:fix/issue-3378-3276

Conversation

@guptaishaan

Copy link
Copy Markdown
Contributor

Both PlanReActPlanner and BuiltInPlanner expose reasoning through
types.Part objects with thought=True, but callers had no standard way
to turn those parts into a provider-neutral format comparable to LangChain's
standard content blocks.

This PR adds a to_content_blocks() method on BasePlanner that converts
a list of types.Part objects into a list of typed dicts: thought parts
become {'type': 'reasoning', 'reasoning': '...'} and plain text parts
become {'type': 'text', 'text': '...'}. The method works for both
planners because reasoning is already identified uniformly by the
thought flag on each part.

Additionally, PlanReActPlanner._mark_as_thought() now strips the leading
proprietary tags (/*PLANNING*/, /*REASONING*/, /*ACTION*/,
/*REPLANNING*/) from text before storing it, so callers that consume the
raw parts — or the new to_content_blocks() output — no longer need to
parse those tags themselves.

Two new unit tests cover tag-stripping and the to_content_blocks() contract.

Fixes #3378

…er and BuiltInPlanner

Both `PlanReActPlanner` and `BuiltInPlanner` expose reasoning through

Signed-off-by: Ishaan <ishaangupta0408@gmail.com>
@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standarlize content block for PlanReActPlanner and BuiltInPlanner

3 participants