Skip to content

Parallel Tool Calling: Q/Bug? #791

Closed
@conpaine109

Description

@conpaine109

Question: I can't seem to figure out how to get agents to call tools in parallel instead of sequentially. Tried setting parallel_tool_calling param = True in model_settings but no luck (functions are in strict mode). What am I missing I'm not finding any clear doc. for this.

Debug:
openai-agents==0.0.16
Python v. == 3.12.2

Activity

rm-openai

rm-openai commented on May 30, 2025

@rm-openai
Collaborator

Do you have an example? Just to clarify, parallel_tool_calling means the model can produce N>1 tool calls in a single response

grillorafael

grillorafael commented on May 30, 2025

@grillorafael

I think what we were looking for was:

1st Responses API to yield multiple tool call, multiple tools being called, then another responses api for result generation.

Right now we see:

Responses
Tool
Responses
Tool
Responses

rm-openai

rm-openai commented on Jun 1, 2025

@rm-openai
Collaborator

Yeah what you described is indeed what parallel tool calling should do. Do you have any sample code you can share?

Rehan-Ul-Haq

Rehan-Ul-Haq commented on Jun 1, 2025

@Rehan-Ul-Haq
Contributor

Question: I can't seem to figure out how to get agents to call tools in parallel instead of sequentially. Tried setting parallel_tool_calling param = True in model_settings but no luck (functions are in strict mode). What am I missing I'm not finding any clear doc. for this.

Debug: openai-agents==0.0.16 Python v. == 3.12.2

Have you tried to change provider? Do check with openai models.
Also read #763

grillorafael

grillorafael commented on Jun 2, 2025

@grillorafael

Question: I can't seem to figure out how to get agents to call tools in parallel instead of sequentially. Tried setting parallel_tool_calling param = True in model_settings but no luck (functions are in strict mode). What am I missing I'm not finding any clear doc. for this.
Debug: openai-agents==0.0.16 Python v. == 3.12.2

Have you tried to change provider? Do check with openai models. Also read #763

We are using gpt-4.1

rm-openai

rm-openai commented on Jun 2, 2025

@rm-openai
Collaborator

Happy to help once you are able to share more details on the prompt, tools list, input etc.

grillorafael

grillorafael commented on Jun 2, 2025

@grillorafael
from datetime import datetime
from agents import Agent, Runner, function_tool, ModelSettings, trace, RunContextWrapper, WebSearchTool


@function_tool(description_override="Get current date and time.")
async def get_current_time(ctx: RunContextWrapper) -> str:
    return datetime.now().strftime("%Y-%m-%d %H:%M:%S")


@function_tool(description_override="Get the current weather")
async def get_current_weather(ctx: RunContextWrapper) -> int:
    return "It's sunny and warm."


agent = Agent(
    name="Assistant",
    model="gpt-4.1",
    instructions="You are a helpful assistant",
    tools=[get_current_time, get_current_weather, WebSearchTool(search_context_size="medium")],
    model_settings=ModelSettings(
        parallel_tool_calls=True, temperature=0.0, tool_choice="auto"
    ),
)


with trace(
    workflow_name="openai-agent-example",
):
    result = Runner.run_sync(agent, "WGive me the current time and current weather")
    print(result.final_output)

I tested with and without WebSearchTool.

With, it is not doing parallel execution and without it is.

Image

Image

rm-openai

rm-openai commented on Jun 2, 2025

@rm-openai
Collaborator

Ah yes. Parallel tool calling is disabled when you enable hosted tools. We're hoping to enable it in the future!

grillorafael

grillorafael commented on Jun 2, 2025

@grillorafael

I see! For code interpreter it seem to work fine though

rm-openai

rm-openai commented on Jun 3, 2025

@rm-openai
Collaborator

I think that might be an oversight on our part

grillorafael

grillorafael commented on Jun 3, 2025

@grillorafael

You can leave it like this 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-more-infoWaiting for a reply/more info from the authorquestionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @grillorafael@Rehan-Ul-Haq@rm-openai@conpaine109

        Issue actions

          Parallel Tool Calling: Q/Bug? · Issue #791 · openai/openai-agents-python