From 2302b656f03586b160da80d94c260b0388c6eff0 Mon Sep 17 00:00:00 2001 From: mykonos-ibiza <222371740+mykonos-ibiza@users.noreply.github.com> Date: Fri, 1 Aug 2025 01:40:31 +0530 Subject: [PATCH] Add update method to Agent class for modifying agent properties - Implemented an `update` method in the `Agent` class to allow modification of agent properties such as name, system prompt, and associated tools. - Enhanced tool management by configuring `AgentPressTools` and `MCPTools` for the update process. - Updated the `create` method in `KortixAgent` to maintain consistency with the new method signature. --- sdk/kortix/agent.py | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/sdk/kortix/agent.py b/sdk/kortix/agent.py index 697e9d24..76467873 100644 --- a/sdk/kortix/agent.py +++ b/sdk/kortix/agent.py @@ -4,6 +4,7 @@ from .tools import AgentPressTools, MCPTools, KortixTools from .api.agents import ( AgentCreateRequest, AgentPress_ToolConfig, + AgentUpdateRequest, AgentsClient, CustomMCP, MCPConfig, @@ -15,6 +16,39 @@ class Agent: self._client = client self._agent_id = agent_id + async def update( + self, + name: str, + system_prompt: str, + mcp_tools: list[KortixTools] = [], + ): + agentpress_tools = {} + custom_mcps: list[CustomMCP] = [] + for tool in mcp_tools: + if isinstance(tool, AgentPressTools): + agentpress_tools[tool] = AgentPress_ToolConfig( + enabled=True, description=tool.get_description() + ) + elif isinstance(tool, MCPTools): + mcp = tool + custom_mcps.append( + CustomMCP( + name=mcp.name, + type=mcp.type, + config=MCPConfig(url=mcp.url), + enabled_tools=mcp.enabled_tools, + ) + ) + await self._client.update_agent( + self._agent_id, + AgentUpdateRequest( + name=name, + system_prompt=system_prompt, + custom_mcps=custom_mcps, + agentpress_tools=agentpress_tools, + ), + ) + async def run( self, prompt: str, @@ -37,7 +71,11 @@ class KortixAgent: self._client = client async def create( - self, name: str, system_prompt: str, model: str, mcp_tools: list[KortixTools] = [] + self, + name: str, + system_prompt: str, + model: str, + mcp_tools: list[KortixTools] = [], ) -> Agent: agentpress_tools = {} custom_mcps: list[CustomMCP] = []