-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Describe the bug
When using conversation_id in Runner.run_streamed method for an agent with function calling (custom function), I get the the following error:
{'error': {'message': 'Duplicate item found with id fc_68d25eda79d481959bd7e424738091a006b9ae17d036a0e7. Remove duplicate items from your input and try again.', 'type': 'invalid_request_error', 'param': 'input', 'code': None}}
Debug information
- Agents SDK version: 0.3.0
- Python version 3.12
Repro steps
@function_tool
async def query_database(wrapper: RunContextWrapper[AgentContext], query: str) -> str:
"""Query the database with the provided SQL query. Only SELECT queries are allowed."""
return await self.agent_tools.query_database(query, wrapper.context.websocket)
agent = Agent(
name="Database Assistant",
instructions="You are a helpful assistant that can query databases. Use the query_database function to execute SQL queries when users ask for data.",
model="gpt-4o",
model_settings=ModelSettings(temperature=0.2),
tools=[query_database]
)
run_stream = Runner.run_streamed(
agent,
[user_message],
)
Try any user prompt that results in custom function call - query_database. You will get the following error:
Error - {'error': {'message': 'Duplicate item found with id fc_68d25eda79d481959bd7e424738091a006b9ae17d036a0e7. Remove duplicate items from your input and try again.', 'type': 'invalid_request_error', 'param': 'input', 'code': None}}
Expected behavior
run_streamed should run without any errors and allow function calling (custom function) when using conversation_id