-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(copilot): subagents #2731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(copilot): subagents #2731
Conversation
… fixes, subflow resize clamping
…ribe, auth checks, new db indexes
The realtime service network policy was missing the custom egress rules section that allows configuration of additional egress rules via values.yaml. This caused the realtime pods to be unable to connect to external databases (e.g., PostgreSQL on port 5432) when using external database configurations. The app network policy already had this section, but the realtime network policy was missing it, creating an inconsistency and preventing the realtime service from accessing external databases configured via networkPolicy.egress values. This fix adds the same custom egress rules template section to the realtime network policy, matching the app network policy behavior and allowing users to configure database connectivity via values.yaml.
…rovements, additional kb tag types
…ts, LLM providers standardization
…, jira service management tools
…ext menu (#2672) * feat(logs-context-menu): consolidated logs utils and types, added logs record context menu (#2659) * feat(email): welcome email; improvement(emails): ui/ux (#2658) * feat(email): welcome email; improvement(emails): ui/ux * improvement(emails): links, accounts, preview * refactor(emails): file structure and wrapper components * added envvar for personal emails sent, added isHosted gate * fixed failing tests, added env mock * fix: removed comment --------- Co-authored-by: waleed <walif6@gmail.com> * fix(logging): hitl + trigger dev crash protection (#2664) * hitl gaps * deal with trigger worker crashes * cleanup import strcuture * feat(imap): added support for imap trigger (#2663) * feat(tools): added support for imap trigger * feat(imap): added parity, tested * ack PR comments * final cleanup * feat(i18n): update translations (#2665) Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> * fix(grain): updated grain trigger to auto-establish trigger (#2666) Co-authored-by: aadamgough <adam@sim.ai> * feat(admin): routes to manage deployments (#2667) * feat(admin): routes to manage deployments * fix naming fo deployed by * feat(time-picker): added timepicker emcn component, added to playground, added searchable prop for dropdown, added more timezones for schedule, updated license and notice date (#2668) * feat(time-picker): added timepicker emcn component, added to playground, added searchable prop for dropdown, added more timezones for schedule, updated license and notice date * removed unused params, cleaned up redundant utils * improvement(invite): aligned styling (#2669) * improvement(invite): aligned with rest of app * fix(invite): error handling * fix: addressed comments --------- Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com> Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com> Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com> Co-authored-by: Adam Gough <77861281+aadamgough@users.noreply.github.com> Co-authored-by: aadamgough <adam@sim.ai>
…in integration updates
…ion, autoconnect improvements, billing fixes
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
Implemented comprehensive subagent architecture for the Copilot feature, enabling nested agent execution with streaming content and tool calls displayed within parent tool calls.
Key Changes
- Subagent Streaming Infrastructure: Added complete SSE handling for subagent events (
subagent_start,subagent_end, and subagent-scoped content/tool_call/tool_result events) in the Copilot store - New Subagent Tools: Created 12 new auto-executing client tools (debug, plan, edit, test, research, auth, deploy, knowledge, custom_tool, tour, info, workflow) that spawn server-side subagents
- UI Components: Enhanced tool-call component with nested subagent content rendering including thinking blocks, tool calls, plan steps, and interactive option selectors with keyboard navigation
- Message Queue: Implemented Cursor-style message queuing that allows users to queue messages while another is streaming, with send now/remove controls
- Trigger Mode Support: Extended
get_block_configtool to support trigger mode configuration retrieval for blocks with trigger capabilities - Context Usage Removal: Removed deprecated context-usage feature and related components/API endpoints
- Manage Custom Tool Enhancement: Added
listoperation to manage_custom_tool and improved conditional interrupt handling
Architecture
The subagent system works through a parent-child relationship where specialized tools like debug or plan spawn server-side subagents that stream their reasoning and tool calls back to the client. These are displayed as nested, collapsible content within the parent tool call, providing transparency into the subagent's work.
Testing Focus
- Verify subagent streaming works correctly for all 12 new tools
- Test message queuing with multiple queued messages
- Validate nested tool call execution and state management
- Check trigger mode configuration retrieval for trigger-enabled blocks
- Test option selector keyboard navigation (arrow keys, enter) on the last message only
Confidence Score: 4/5
- Safe to merge with careful testing - comprehensive feature implementation with well-structured code
- Large PR with significant architectural changes (+2552/-664 lines). The subagent streaming logic is complex but well-structured with proper error handling and logging. Code follows project patterns and TypeScript conventions. Main concerns are the complexity of the streaming state management and the need for thorough testing of edge cases in nested subagent execution. No critical bugs found, but the scale and complexity warrant extensive QA.
- Pay close attention to
apps/sim/stores/panel/copilot/store.ts- complex streaming logic with subagent state management needs thorough testing
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/stores/panel/copilot/types.ts | 5/5 | Added subagent type definitions including SubAgentContentBlock, subagent properties on CopilotToolCall, and QueuedMessage interface for message queuing feature |
| apps/sim/stores/panel/copilot/store.ts | 4/5 | Implemented comprehensive subagent streaming logic with SSE handlers, added message queue functionality, removed context-usage feature, added new tool instantiators for subagent tools |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx | 4/5 | Added comprehensive subagent content rendering with PlanSteps, OptionsSelector, and SubAgentContent components for displaying nested tool calls and thinking blocks |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/queued-messages/queued-messages.tsx | 5/5 | New component implementing Cursor-style message queuing UI with expand/collapse, send now, and remove functionality |
| apps/sim/lib/copilot/tools/client/other/debug.ts | 5/5 | New subagent tool for debugging, auto-executes with server-side subagent handling nested content stream |
| apps/sim/lib/copilot/tools/server/blocks/get-block-config.ts | 4/5 | Implemented trigger mode support with trigger inputs/outputs extraction and validation, fixed option resolution to prefer id over label |
| apps/sim/lib/copilot/registry.ts | 5/5 | Extended schemas with trigger parameter for get_block_config and list operation for manage_custom_tool, added triggerMode to output schemas |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx | 5/5 | Added QueuedMessages component, removed context-usage functionality, enabled message submission during active streaming for queuing |
Sequence Diagram
sequenceDiagram
participant User
participant UI as Copilot UI
participant Store as CopilotStore
participant API as Server API
participant SubAgent as Subagent (debug/plan/edit/etc)
User->>UI: Sends message
UI->>Store: sendMessage()
Store->>API: POST /api/copilot/chat (stream)
Note over API,SubAgent: Main agent processes request
API-->>Store: SSE: content (main agent text)
Store-->>UI: Update message content
API-->>Store: SSE: tool_call (e.g., debug tool)
Store->>Store: Create tool call with pending state
Store->>Store: Execute client tool (debug.execute())
Store-->>UI: Show tool call in UI
Note over API,SubAgent: Server invokes subagent
API-->>Store: SSE: subagent_start {tool_call_id}
Store->>Store: Set subAgentParentToolCallId
Store->>Store: Mark parent tool as subAgentStreaming=true
loop Subagent streaming
API-->>Store: SSE: {subagent: "debug", type: "content"}
Store->>Store: Append to subAgentContent[toolCallId]
Store->>Store: Update subAgentBlocks with text block
Store-->>UI: Update nested content in tool call
API-->>Store: SSE: {subagent: "debug", type: "tool_call"}
Store->>Store: Add to subAgentToolCalls[toolCallId]
Store->>Store: Update subAgentBlocks with tool block
Store->>Store: Execute nested tool if no interrupt
Store-->>UI: Show nested tool in subagent section
API-->>Store: SSE: {subagent: "debug", type: "tool_result"}
Store->>Store: Update nested tool state to success/error
Store-->>UI: Update nested tool status
end
API-->>Store: SSE: subagent_end
Store->>Store: Set subAgentStreaming=false
Store->>Store: Clear subAgentParentToolCallId
Store-->>UI: Finalize subagent display
API-->>Store: SSE: tool_result {toolCallId, success}
Store->>Store: Update parent tool state to success
Store-->>UI: Show parent tool completed
API-->>Store: SSE: done
Store->>Store: Complete streaming
Store-->>UI: Enable input
…ow preview enhancements
476b99e to
41d767e
Compare
Summary
Adds subagents to the copilot.
Also adds components to see copilot plan, edit diffs in chat, and options.
Adds nicer thinking text
Makes diff view accept/reject optimistic
Fixes chat load on refresh
Type of Change
Testing
Manual with @emir-karabeg
Checklist