Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • allow multiple instances of workflow block or kb tools as agent tools
  • updated turborepo

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Dec 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Dec 20, 2025 3:13am

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 20, 2025

Greptile Summary

This PR enables using multiple instances of workflow executor and knowledge base tools in agent blocks. Previously, the UI prevented selecting the same tool twice, but this was overly restrictive since each instance can target a different workflow or knowledge base.

The implementation creates unique tool IDs by appending resource IDs (workflowId/knowledgeBaseId) when transforming tools for the LLM, then strips these suffixes during execution to look up the base tool configuration. This allows the LLM to distinguish between instances while the execution layer uses the shared tool definition.

Key changes:

  • Modified isToolAlreadySelected to allow multiple workflow/knowledge block instances
  • Added resource ID suffix to tool IDs in transformBlockTool
  • Added normalizeToolId function to strip suffixes before tool lookup
  • Fixed popover search state reset issue
  • Updated turbo to 2.7.0

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is well-designed with a clean separation of concerns. The tool ID transformation and normalization logic is straightforward and handles the multi-instance requirement correctly. All changes are additive and backward compatible - existing single-instance tools continue to work unchanged. The popover fix addresses a previous review comment. No security concerns or breaking changes identified.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx allowed multiple workflow and knowledge block instances by bypassing duplicate check for these block types
apps/sim/providers/utils.ts appended resource ID to tool ID for workflow_executor and knowledge tools to create unique identifiers
apps/sim/tools/index.ts added normalizeToolId function to strip resource ID suffix and lookup base tool config
apps/sim/components/emcn/components/popover/popover.tsx reset search query on mount to fix stale state issue

Sequence Diagram

sequenceDiagram
    participant UI as Tool Input UI
    participant Transform as transformBlockTool
    participant Agent as Agent Handler
    participant LLM as LLM Provider
    participant Execute as executeTool
    participant Normalize as normalizeToolId
    participant Tool as Tool Config

    UI->>UI: User adds workflow/KB tool instance
    Note over UI: isToolAlreadySelected returns false<br/>for workflow & knowledge blocks
    UI->>Transform: tool with workflowId/knowledgeBaseId
    Transform->>Transform: Create unique ID<br/>(e.g., workflow_executor_uuid)
    Transform-->>Agent: {id: "workflow_executor_uuid", params, ...}
    Agent->>LLM: Send tools with unique IDs
    LLM->>LLM: Agent decides to call tool
    LLM-->>Agent: tool_call: "workflow_executor_uuid"
    Agent->>Execute: executeTool("workflow_executor_uuid", params)
    Execute->>Normalize: normalizeToolId("workflow_executor_uuid")
    Normalize-->>Execute: "workflow_executor"
    Execute->>Tool: getTool("workflow_executor")
    Tool-->>Execute: Tool config
    Execute->>Execute: Execute tool with params
    Execute-->>Agent: Tool result
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

@greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 20, 2025

Greptile's behavior is changing!

From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

@waleedlatif1 waleedlatif1 merged commit 7dc4851 into staging Dec 20, 2025
11 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/tool-inp branch December 20, 2025 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants