Skip to content

Commit 33d0f54

Browse files
fix: filter UnknownAgentTool in agent update to fix type error
UnknownAgentTool is included in AgentTool for forward compatibility when parsing responses, but cannot be passed to agents.update().
1 parent c74b056 commit 33d0f54

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/mistralai/extra/run/context.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
InputEntries,
3636
MessageInputEntry,
3737
ResponseFormat,
38+
UnknownAgentTool,
39+
UpdateAgentRequestTool,
3840
)
3941
from mistralai.client.types.basemodel import BaseModel, OptionalNullable, UNSET
4042

@@ -187,8 +189,11 @@ async def prepare_agent_request(self, beta_client: "Beta") -> AgentRequestKwargs
187189
)
188190
agent = await beta_client.agents.get_async(agent_id=self.agent_id)
189191
agent_tools = agent.tools or []
190-
updated_tools: list[AgentTool] = []
192+
updated_tools: list[UpdateAgentRequestTool] = []
191193
for tool in agent_tools:
194+
if isinstance(tool, UnknownAgentTool):
195+
# Skip unknown tools - can't include them in update request
196+
continue
192197
if not isinstance(tool, FunctionTool):
193198
updated_tools.append(tool)
194199
elif tool.function.name in self._callable_tools:

0 commit comments

Comments
 (0)