Repository navigation
fix(go-agent): add Google search wrapper component and tool registry - #16768
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughThe Google tool now uses SerpApi with updated inputs, defaults, and result parsing. A new Google component wrapper and registry path wire it into canvas and agent tool loading, with tests updated for the new contract. ChangesGoogle Tool SerpApi Migration and Component Wiring
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
internal/agent/component/universe_a_wrappers.go (1)
122-124: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value
GetInputFormallocates a newGoogleToolunnecessarily.
c.inneris already a*agenttool.GoogleToolandInputFormdoesn't depend on tool state. Usec.inner.InputForm()to avoid the extra allocation.♻️ Proposed fix
func (c *googleComponent) GetInputForm() map[string]any { - return agenttool.NewGoogleTool().InputForm() + return c.inner.InputForm() }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/agent/component/universe_a_wrappers.go` around lines 122 - 124, `googleComponent.GetInputForm` is creating a fresh `GoogleTool` instead of using the existing wrapped instance. Update `GetInputForm` to call `c.inner.InputForm()` directly on the `googleComponent` wrapper so it reuses the already-constructed `agenttool.GoogleTool` and avoids the extra allocation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/agent/component/universe_a_wrappers.go`:
- Around line 94-95: The doc comment on googleComponent still references Python
migration history and should be rewritten to describe the current runtime
behavior only. Update the comment above googleComponent to explain its role as a
wrapper around internal/agent/tool/GoogleTool and how it adapts Google tool
outputs for the active canvas flow, removing any mention of Python or migration
context.
In `@internal/agent/tool/google.go`:
- Around line 104-108: The `num` default is inconsistent across `Info`,
`InputForm`, and `buildGoogleURL`; align them to a single value, preferably 6 as
the code already uses. Update the `Info` description in `google.go`, the
`InputForm` default value for `num`, and the fallback in `buildGoogleURL` so all
three references match and the UI, documentation, and runtime behavior are
consistent.
- Around line 36-38: The doc comments on googleParams and
GoogleParam.get_input_form still reference Python migration history instead of
the Go runtime path. Update those comments in the google tool code to describe
the current Go-facing JSON/input behavior only, keeping the explanation aligned
with InvokableRun and the accepted aliases without mentioning Python or
migration origins.
- Around line 214-239: `mergeGoogleDefaults` is applying defaults to primary
fields before alias values are normalized, which can override explicit agent
input from `MaxResults`/`Query`. Update the merge flow in `mergeGoogleDefaults`
so alias fields are resolved first in `googleParams` (for example, prefer
`MaxResults` over `Num` and `Query` over `Q` when provided), then fill only
still-empty primary fields from defaults. Make sure `buildGoogleURL` continues
to read the normalized primary fields after this change so agent-supplied values
always take precedence.
---
Nitpick comments:
In `@internal/agent/component/universe_a_wrappers.go`:
- Around line 122-124: `googleComponent.GetInputForm` is creating a fresh
`GoogleTool` instead of using the existing wrapped instance. Update
`GetInputForm` to call `c.inner.InputForm()` directly on the `googleComponent`
wrapper so it reuses the already-constructed `agenttool.GoogleTool` and avoids
the extra allocation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b7939102-26e0-4864-b781-d326fb5f8831
📒 Files selected for processing (8)
internal/agent/component/fixture_stubs.gointernal/agent/component/google_component_test.gointernal/agent/component/tool_dispatch_test.gointernal/agent/component/universe_a_wrappers.gointernal/agent/component/verify_p1_test.gointernal/agent/tool/google.gointernal/agent/tool/google_test.gointernal/agent/tool/registry.go
Summary