Skip to content

Commit 99adcdf

Browse files
intel352claude
andcommitted
fix: pass all tool refs in a single WithTools call
Genkit rejects multiple WithTools options ("cannot set tools more than once"). This broke all team/fleet execution that uses tools (blackboard, messaging). Changed from per-tool WithTools(ref) calls to a single WithTools(refs...) call for both Chat and Stream paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7200065 commit 99adcdf

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

genkit/adapter.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@ func (p *genkitProvider) Chat(ctx context.Context, messages []provider.Message,
8383

8484
if len(tools) > 0 {
8585
opts = append(opts, ai.WithReturnToolRequests(true))
86-
for _, ref := range p.resolveToolRefs(tools) {
87-
opts = append(opts, ai.WithTools(ref))
88-
}
86+
refs := p.resolveToolRefs(tools)
87+
opts = append(opts, ai.WithTools(refs...))
8988
}
9089

9190
resp, err := gk.Generate(ctx, p.g, opts...)
@@ -111,9 +110,8 @@ func (p *genkitProvider) Stream(ctx context.Context, messages []provider.Message
111110

112111
if len(tools) > 0 {
113112
opts = append(opts, ai.WithReturnToolRequests(true))
114-
for _, ref := range p.resolveToolRefs(tools) {
115-
opts = append(opts, ai.WithTools(ref))
116-
}
113+
refs := p.resolveToolRefs(tools)
114+
opts = append(opts, ai.WithTools(refs...))
117115
}
118116

119117
go func() {

0 commit comments

Comments
 (0)