From 95952a21be6e660a05758c1678ef8f63a87cd288 Mon Sep 17 00:00:00 2001 From: Michael Clifford Date: Wed, 12 Feb 2025 15:53:49 -0500 Subject: [PATCH 1/2] Allow client_tools to be defined only once Signed-off-by: Michael Clifford --- src/llama_stack_client/lib/agents/agent.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/llama_stack_client/lib/agents/agent.py b/src/llama_stack_client/lib/agents/agent.py index 504ef5e8..4652b7bc 100644 --- a/src/llama_stack_client/lib/agents/agent.py +++ b/src/llama_stack_client/lib/agents/agent.py @@ -32,6 +32,7 @@ def __init__( ): self.client = client self.agent_config = agent_config + self.agent_config["client_tools"] = [client_tool.get_tool_definition() for client_tool in client_tools] self.agent_id = self._create_agent(agent_config) self.client_tools = {t.get_name(): t for t in client_tools} self.sessions = [] From d81d57bd7e0133ee0b1a7dc85890e072b91f22e5 Mon Sep 17 00:00:00 2001 From: Michael Clifford Date: Mon, 3 Mar 2025 10:57:41 -0500 Subject: [PATCH 2/2] add check for existing client_tools Signed-off-by: Michael Clifford --- src/llama_stack_client/lib/agents/agent.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/llama_stack_client/lib/agents/agent.py b/src/llama_stack_client/lib/agents/agent.py index 4652b7bc..26b25f79 100644 --- a/src/llama_stack_client/lib/agents/agent.py +++ b/src/llama_stack_client/lib/agents/agent.py @@ -32,7 +32,8 @@ def __init__( ): self.client = client self.agent_config = agent_config - self.agent_config["client_tools"] = [client_tool.get_tool_definition() for client_tool in client_tools] + if "client_tools" not in self.agent_config.keys(): + self.agent_config["client_tools"] = [client_tool.get_tool_definition() for client_tool in client_tools] self.agent_id = self._create_agent(agent_config) self.client_tools = {t.get_name(): t for t in client_tools} self.sessions = []