Skip to content

Error: Only one of tool_calls or content should be present when using DeepResearchTool #109

Open
@FZR95

Description

@FZR95

Description

I encounter the error Error: Only one of tool_calls or content should be present when using DeepResearchTool, while the same configuration works fine without it.

Expected Behavior

The tool should process requests without throwing this validation error, just as it does when DeepResearchTool is disabled.

Current Behavior

The system fails with the error, suggesting an invalid combination of tool_calls and content fields in the API request/response.

  Traceback (most recent call last):
  File "./run_test.py", line 395, in <module>
    _session_id = stage_0(stages, 0, args, prompts_dir, results_dir, question)
  File "./run_test.py", line 56, in stage_0
    _session_id = single_enquiry(stage_name, args, results_dir, task_description)
  File "./run_test.py", line 41, in single_enquiry
    result = asyncio.run(agent.run(task_description, False))
  File "*/miniconda3/envs/iiagent/lib/python3.13/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "*/miniconda3/envs/iiagent/lib/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "*/miniconda3/envs/iiagent/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "./model/iiagent.py", line 191, in run
    result = await loop.run_in_executor(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
    )
    ^
  File "*/miniconda3/envs/iiagent/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "./model/iiagent.py", line 193, in <lambda>
    lambda: self.agent.run_agent(user_input, resume),
            ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "./ii-agent/src/ii_agent/agents/anthropic_fc.py", line 342, in run_agent
    return self.run(tool_input, self.history)
           ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "./ii-agent/src/ii_agent/tools/base.py", line 68, in run
    result = self.run_impl(tool_input, message_history)
  File "./ii-agent/src/ii_agent/agents/anthropic_fc.py", line 224, in run_impl
    model_response, _ = self.client.generate(
                        ~~~~~~~~~~~~~~~~~~~~^
        messages=self.history.get_messages_for_llm(),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        system_prompt=self.system_prompt,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "./ii-agent/src/ii_agent/llm/openai.py", line 248, in generate
    raise ValueError("Only one of tool_calls or content should be present")
ValueError: Only one of tool_calls or content should be present

Reproduction Steps

tools = [
    MessageTool(),
    DeepResearchTool(),
    SequentialThinkingTool(),
    PdfTextExtractTool(workspace_manager=workspace_manager),
    WebSearchTool(),
    StrReplaceEditorTool(
        workspace_manager=workspace_manager, message_queue=self.message_queue
    ),
    CompactifyMemoryTool(context_manager=context_manager),
]
agent = AnthropicFC(
    system_prompt=SYSTEM_PROMPT,
    client=client,
    workspace_manager=workspace_manager,
    tools=tools,
    message_queue=self.message_queue,
    logger_for_agent_logs=logger,
    context_manager=context_manager,
    max_output_tokens_per_turn=MAX_OUTPUT_TOKENS_PER_TURN,
    max_turns=MAX_TURNS,
    session_id=session_id,  # Pass the session_id from database manager
    interactive_mode=False,
)
...
loop = asyncio.get_running_loop()
self.message_task = self.agent.start_message_processing()
await self.message_queue.put(
    RealtimeEvent(type=EventType.USER_MESSAGE, content={"text": user_input})
)
try:
    # Run synchronous method in executor
    result = await loop.run_in_executor(
        None,  # Uses default ThreadPoolExecutor
        lambda: self.agent.run_agent(user_input, resume),
    )
except Exception as e:
    print(f"Error: {str(e)}")
finally:
    # Cleanup tasks
    self.message_task.cancel()

Environment

  • OS: macOS 15.5
  • Python Version: 3.13
  • Manual Installation from latest main

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions