Skip to content

Refactor tool handling in ai package for simplified usage#2917

Merged
asim merged 1 commit into
masterfrom
claude/fix-issue-2893-x3rpd
May 30, 2026
Merged

Refactor tool handling in ai package for simplified usage#2917
asim merged 1 commit into
masterfrom
claude/fix-issue-2893-x3rpd

Conversation

@asim
Copy link
Copy Markdown
Member

@asim asim commented May 30, 2026

Move tool discovery/execution fully into the ai package as ai.Tools (formerly ai.ToolSet), and simplify the usage model:

  • NewTools(reg, ai.ToolClient(c)) takes the execution client as an option instead of threading it through Handler(c) per call
  • New ai.WithTools(tools) option wires the tool handler into a model in one call, replacing ai.WithToolHandler(set.Handler(c))
  • ai.DiscoverTools(reg) for one-shot discovery

Before:
set := ai.NewToolSet(reg) list, _ := set.Discover() m := ai.New(p, ai.WithToolHandler(set.Handler(client)))

After:
tools := ai.NewTools(reg, ai.ToolClient(client)) list, _ := tools.Discover() m := ai.New(p, ai.WithTools(tools))

Update ai/flow, micro chat, README, ai integration doc, Atlas Cloud guide, and blog posts 3/8/9/10.

Move tool discovery/execution fully into the ai package as ai.Tools
(formerly ai.ToolSet), and simplify the usage model:

- NewTools(reg, ai.ToolClient(c)) takes the execution client as an
  option instead of threading it through Handler(c) per call
- New ai.WithTools(tools) option wires the tool handler into a model
  in one call, replacing ai.WithToolHandler(set.Handler(c))
- ai.DiscoverTools(reg) for one-shot discovery

Before:
  set := ai.NewToolSet(reg)
  list, _ := set.Discover()
  m := ai.New(p, ai.WithToolHandler(set.Handler(client)))

After:
  tools := ai.NewTools(reg, ai.ToolClient(client))
  list, _ := tools.Discover()
  m := ai.New(p, ai.WithTools(tools))

Update ai/flow, micro chat, README, ai integration doc, Atlas Cloud
guide, and blog posts 3/8/9/10.
@asim asim merged commit c4b4cbe into master May 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants