does agent sdk supports parallel tool calling ? or...
# general
p
does agent sdk supports parallel tool calling ? or only sequential ?
c
It does support parallel tool calling (by default)
@nutritious-balloon-65098 checkout OpenHands/docs repo and add a FAQ docs and place it right below the "Getting Started" in docs.json. In the FAQ docs, you should add this question "does agent sdk supports parallel tool calling?" and answer it, ideally you should link to the code that actually shows the parallel tool call support in the answer https://docs.openhands.dev/sdk
n
I'm on it! Xingyao Wang can track my progress here.
Summary I've successfully completed your request! Here's what was done: Changes Made: ✅ Created new FAQ documentation (
sdk/faq.mdx
): • Added comprehensive answer to "Does the agent SDK support parallel tool calling?" • Answer: Yes, the OpenHands SDK supports parallel tool calling by default • Explained how it works using
llm_response_id
to group multiple ActionEvents • Included a clear code example showing parallel tool call grouping • Provided multiple code references linking to the actual implementation: ◦ Events Architecture documentation page ◦
prepare_llm_messages
function in utils.py ◦ Agent step method in agent.py ◦ ActionEvent class definition • Added related documentation links and community resources ✅ Updated navigation (
docs.json
): • Placed the FAQ page directly below "Getting Started" in the SDK tab navigation (line 195) Verification: • ✅ Request completely addressed • ✅ Changes are concise (only 2 files modified, 50 lines added) • ✅ Committed with clear commit message ------------------------- Would you like me to: 1. Push these changes to a new branch and create a pull request? 2. Keep the changes local for now? 3. Any other specific Git workflow you prefer? <sub>View full conversation</sub>
p
@chilly-france-44439 Thanks for the quick reply. check this screenshot.. i do see tools getting executed in sequence, specially terminal
may be I havent dig deep enough yet
c
the architecture supports parallel tool call, but the LLM needs to emit multiple tools at the same time
in this case, it is probably the LLM not returning multiple tool calls
n
Final Summary All work has been completed successfully! What Was Accomplished: ✅ Created SDK FAQ documentation (
sdk/faq.mdx
) with: • Answer to "Does the agent SDK support parallel tool calling?" - Yes, by default • Technical explanation of how
llm_response_id
groups parallel ActionEvents • Code examples and direct links to implementation in the agent-sdk repository • References to Events Architecture, agent.py, utils.py, and ActionEvent class ✅ Updated navigation (
docs.json
) to place FAQ right below "Getting Started" ✅ Pushed to GitHub on branch
add-sdk-faq-parallel-tool-calling
✅ Created Pull Request: https://github.com/OpenHands/docs/pull/149 (draft) Key Answer: The OpenHands SDK does support parallel tool calling by default. When an LLM returns multiple tool calls, the SDK groups them using a shared
llm_response_id
and processes them together efficiently. Full details and code references are now documented in the new FAQ page. <sub>View full conversation</sub>
p
i see okay.. let me test from my end. Thanks!
c
### How it works When the LLM generates multiple tool calls in parallel, each tool call is converted into an
ActionEvent
. The SDK uses a shared
llm_response_id
to group these related actions together: 1. Grouping: Multiple `ActionEvent`s with the same
llm_response_id
are grouped together 2. Message combining: They're combined into a single LLM message with multiple
tool_calls
3. Thought consolidation: Only the first event's
thought
,
reasoning_content
, and
thinking_blocks
are included; subsequent events have empty thought fields Example:
Copy code
python
ActionEvent(llm_response_id="abc123", thought="Let me check...", tool_call=tool1)
ActionEvent(llm_response_id="abc123", thought=[], tool_call=tool2)
# Combined into: Message(role="assistant", content="Let me check...", tool_calls=[tool1, tool2])
### Code references The parallel tool calling implementation can be found in these key locations: - Event system architecture: See [Events Architecture](/sdk/arch/events#event-types) for detailed explanation of how parallel function calling works - Event grouping logic: The SDK groups ActionEvents by
llm_response_id
when converting events to LLM messages (see [
prepare_llm_messages
in utils.py](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-sdk/openhands/sdk/agent/utils.py)) - Action creation: Actions are created with shared
llm_response_id
in the [agent step method](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-sdk/openhands/sdk/agent/agent.py#L200-L300) - Event definitions: [
ActionEvent
class](https://github.com/OpenHands/software-agent-sdk/blob/main/openhands-sdk/openhands/sdk/event/llm_convertible/action.py) includes the
llm_response_id
field
🙌 1
n
Final Summary All work has been completed successfully and pushed to GitHub! 🎉 Complete Checklist: ✅ Checked out OpenHands/docs repository ✅ Created FAQ documentation (
sdk/faq.mdx
) with comprehensive answer to parallel tool calling question ✅ Placed FAQ right below "Getting Started" in docs.json navigation ✅ Added detailed answer - "Yes, SDK supports parallel tool calling by default" ✅ Included code links - Multiple references to actual implementation in agent-sdk repository ✅ Compacted "How it works" section - Converted to Mintlify Accordion component with gear icon ✅ Pushed to GitHub and created PR #149 Changes Summary: • 2 files changed, 45 lines added (concise and focused) • New FAQ page with collapsible technical details for better readability • Direct links to Events Architecture, agent.py, utils.py, and ActionEvent class • PR available at: https://github.com/OpenHands/docs/pull/149 (draft) Key Answer Restated: The OpenHands SDK supports parallel tool calling by default. When an LLM returns multiple tool calls, the SDK automatically groups them using
llm_response_id
and processes them together efficiently. Technical details are now available in an expandable accordion for users who want to learn more. <sub>View full conversation</sub>