Skip to content

refactor(go-agent): unify tool-backed component creation - #16865

Closed
Hz-186 wants to merge 2 commits into
infiniflow:mainfrom
Hz-186:feat/registe-component-factory
Closed

refactor(go-agent): unify tool-backed component creation#16865
Hz-186 wants to merge 2 commits into
infiniflow:mainfrom
Hz-186:feat/registe-component-factory

Conversation

@Hz-186

@Hz-186 Hz-186 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a shared factory for tool-backed components
  • Refactor SearXNG and GitHub to use declarative registration
  • Keep existing invocation and output behavior unchanged

Tested:
bash build.sh --test ./internal/agent/component/...

image

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 13, 2026
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The component package now provides shared tool-to-component factory wiring. GitHub and SearXNG adopt this wiring, tool builders accept additional node parameters, and fixture initialization updates legacy, BGPT, and GitHub registrations.

Changes

Tool component wiring

Layer / File(s) Summary
Shared tool factory and registration
internal/agent/component/tool2component.go
Defines shared tool invoker/spec types, builds tools, validates invokers, wraps components, and registers factories.
GitHub and SearXNG adapter migration
internal/agent/component/github.go, internal/agent/component/searxng.go, internal/agent/tool/registry.go, internal/agent/.../*_test.go
Migrates both components to shared wiring, registers tool specifications, and allows extra Python-node-style parameters while retaining supported-parameter validation.
Fixture registry alignment
internal/agent/component/fixture_stubs.go
Adds Iteration, IterationItem, and BGPT registrations and removes the fixture GitHub registration.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Init as Component init
  participant Registry as Component registry
  participant Factory as Tool component factory
  participant Tool as agenttool.BuildByName
  participant Component as GitHub or SearXNG component
  Init->>Registry: Register tool component specification
  Registry->>Factory: Create component factory
  Factory->>Tool: Build tool with params
  Tool-->>Factory: Return toolInvoker
  Factory->>Component: Wrap invoker
  Component-->>Factory: Return Component
Loading

Possibly related PRs

Suggested labels: go

Poem

A rabbit hops through tools anew,
With GitHub tags and SearXNG too.
Iterations join the registry line,
BGPT sparkles, components align.
Shared invokers softly run—
Wiring work is neatly done! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately summarizes the main change: unifying tool-backed component creation.
Description check ✅ Passed The description includes a clear Summary and testing note, which satisfies the template with enough context for review.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Hz-186 Hz-186 added 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration ☯️ refactor Pull request that refactor/refine code agent and removed size:L This PR changes 100-499 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Jul 13, 2026
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 14, 2026
@Hz-186
Hz-186 marked this pull request as draft July 14, 2026 02:29
@Hz-186
Hz-186 marked this pull request as ready for review July 14, 2026 02:30
@Hz-186 Hz-186 closed this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent ci Continue Integration ☯️ refactor Pull request that refactor/refine code size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant