Merged
Conversation
- Change Step.toolCall to Step.toolCalls (array) - Change Step.toolResult to Step.toolResults (array) - Rename callTool event to callTools - Rename resolveToolResult event to resolveToolResults - Update event payloads for arrays
- Update state machine for parallel tool calls - Execute MCP tools in parallel with Promise.all - Handle special tools (think, attemptCompletion, PDF, image) with priority - Update all resolve logic for multiple results
- Update use-step-store.ts to handle callTools and resolveToolResults events - Update CLI event listener for multiple tool calls - Update api-client test data
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
6 tasks
Extend ToolResultPart.contents type to support FileInlinePart (PDF) in addition to TextPart and ImageInlinePart.
- Execute think, readPdfFile, readImageFile in parallel with other MCP tools - Only attemptCompletion remains special (completion means done) - Process file results (PDF/image) during tool execution - Include PDF content in toolMessage instead of userMessage - Add partialToolResults to state machine transitions Closes #64
- Update calling-tool tests to expect resolveToolResults for think/readPdfFile/readImageFile - Update resolving-pdf-file tests for new message format - Fix mixed-tools E2E test expectations for pendingToolCalls count
Verify that think tool executes in parallel with other MCP tools and both results are returned together in resolveToolResults.
Test parallel execution of think, readPdfFile, readImageFile with regular MCP tools using small test fixtures (test.pdf, test.gif).
- Set step.toolResults from checkpoint.partialToolResults in finishAllToolCalls transition - Add fileInlinePart to content filter in resolving-tool-result, preparing-for-step, and generating-run-result
- Add tests for preparing-for-step (pendingToolCalls, partialToolResults) - Add tests for calling-interactive-tool (error cases, partialToolResults) - Add tests for calling-tool (interactive skill, mixed tool types) - Add tests for resolving-image-file/pdf-file (error cases, invalid JSON)
| step.partialToolResults = toolResults | ||
| step.pendingToolCalls = remainingToolCalls | ||
| return callDelegate(setting, checkpoint, { | ||
| newMessage: checkpoint.messages[checkpoint.messages.length - 1] as never, |
There was a problem hiding this comment.
Bug: Stale message passed to delegate/interactive events after resume
When callingToolLogic emits callDelegate or callInteractiveTool events, it passes checkpoint.messages[checkpoint.messages.length - 1] as newMessage. After a resumeToolCalls transition (when continuing after a previous delegate/interactive stop), the checkpoint messages haven't been updated in that transition, so this retrieves a stale message from before the run was stopped rather than the relevant tool call message. While the state machine currently ignores this field when transitioning from CallingTool state (making it functionally harmless), event listeners receiving these events will see incorrect newMessage data.
Additional Locations (1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement parallel tool call support in the Perstack runtime. The runtime now processes all tool calls from a single LLM response in parallel using
Promise.all, instead of processing only the first one.Changes
@perstack/core
Step.toolCall→Step.toolCalls(array)Step.toolResult→Step.toolResults(array)callToolevent →callToolseventresolveToolResultevent →resolveToolResultsevent@perstack/runtime
generatingToolCallLogicto process multiple tool callscallingToolLogicto execute MCP tools in parallel withPromise.allresolvingToolResultLogicto aggregate multiple tool results@perstack/tui & CLI
Documentation
Testing
Closes #61
Closes #63