diff --git a/adk/chatmodel.go b/adk/chatmodel.go index 21c18eed..5691a816 100644 --- a/adk/chatmodel.go +++ b/adk/chatmodel.go @@ -53,6 +53,7 @@ type chatModelAgentRunOptions struct { // run chatModelOptions []model.Option toolOptions []tool.Option + toolList []tool.BaseTool agentToolOptions map[ /*tool name*/ string][]AgentRunOption // todo: map or list? // resume @@ -73,6 +74,13 @@ func WithToolOptions(opts []tool.Option) AgentRunOption { }) } +// WithToolListOptions sets the runtime tool list for the chat model agent. +func WithToolListOptions(tools []tool.BaseTool) AgentRunOption { + return WrapImplSpecificOptFn(func(t *chatModelAgentRunOptions) { + t.toolList = tools + }) +} + // WithAgentToolRunOptions specifies per-tool run options for the agent. func WithAgentToolRunOptions(opts map[string] /*tool name*/ []AgentRunOption) AgentRunOption { return WrapImplSpecificOptFn(func(t *chatModelAgentRunOptions) { @@ -985,6 +993,9 @@ func getComposeOptions(opts []AgentRunOption) []compose.Option { if len(to) > 0 { co = append(co, compose.WithToolsNodeOption(compose.WithToolOption(to...))) } + if len(o.toolList) > 0{ + co = append(co,compose.WithToolsNodeOption(compose.WithToolList(o.toolList...))) + } if o.historyModifier != nil { co = append(co, compose.WithStateModifier(func(ctx context.Context, path compose.NodePath, state any) error { s, ok := state.(*State)