improvement(copilot): add best practices for core blocks#1427
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Sg312
reviewed
Sep 23, 2025
Contributor
There was a problem hiding this comment.
Greptile Overview
Summary
This PR enhances the Sim platform's copilot capabilities by adding contextual best practices to all block configurations. The implementation adds a new optional bestPractices field to the BlockConfig interface and populates it across 15+ core workflow blocks including Agent, API, Function, Memory, and various triggers.
Key Changes:
- Type System: Added optional
bestPractices?: stringfield toBlockConfiginterface intypes.ts - Block Configurations: Each block now includes tailored guidance covering common usage patterns, gotchas, and recommendations
- Metadata Tool: Updated
get-blocks-metadata-tool.tsto extract and expose best practices through the copilot's metadata API - Special Blocks: Added best practices for loop and parallel control flow blocks in the metadata tool
Best Practices Content Quality:
- Agent Block: Comprehensive guidance on tool restrictions, YAML syntax, and response format usage
- Function Block: Clear direction on execution modes (remote vs local) and variable referencing
- API Trigger: Detailed examples including production curl commands and variable access patterns
- Memory Block: Integration guidance with agent blocks for conversation persistence
The implementation follows a consistent pattern across all blocks, providing practical, actionable guidance that will help the copilot provide better contextual assistance to users building workflows.
Confidence Score: 4/5
- This PR is safe to merge with minor text corrections needed
- Score reflects clean type system changes and comprehensive documentation additions. Only minor typos in memory block prevent a perfect score. The implementation is consistent, follows established patterns, and enhances user experience without introducing breaking changes.
- apps/sim/blocks/blocks/memory.ts contains typos that should be fixed
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/blocks/types.ts | 5/5 | Added optional bestPractices field to BlockConfig interface - clean type definition change |
| apps/sim/lib/copilot/tools/server/blocks/get-blocks-metadata-tool.ts | 5/5 | Updated metadata tool to include bestPractices in CopilotBlockMetadata interface and added to metadata extraction logic |
| apps/sim/blocks/blocks/agent.ts | 5/5 | Added comprehensive best practices for Agent blocks covering tool usage, custom tools YAML syntax, and response format |
| apps/sim/blocks/blocks/function.ts | 5/5 | Added detailed best practices for Function block covering Python/JavaScript execution modes and variable referencing |
| apps/sim/blocks/blocks/memory.ts | 3/5 | Added best practices for Memory block with YAML syntax guidance and agent integration, but contains typos |
| apps/sim/blocks/blocks/api_trigger.ts | 5/5 | Added comprehensive best practices for API trigger including manual testing, variable access patterns, and production curl examples |
Sequence Diagram
sequenceDiagram
participant Dev as Developer
participant UI as Sim UI
participant Copilot as Copilot Agent
participant MetadataTool as get-blocks-metadata-tool
participant BlockRegistry as Block Registry
participant BlockConfig as Block Configuration
Note over Dev,BlockConfig: PR #1427: Adding Best Practices to Block Configs
Dev->>BlockConfig: Add bestPractices field to BlockConfig interface
Dev->>BlockConfig: Implement bestPractices in all 15+ block definitions
Note over BlockConfig: Each block now includes contextual guidance:<br/>- Agent: tool usage, YAML syntax<br/>- API: endpoint testing recommendations<br/>- Function: execution mode guidance<br/>- Memory: integration with agents<br/>- etc.
Dev->>MetadataTool: Update CopilotBlockMetadata interface
Dev->>MetadataTool: Add bestPractices extraction logic
Dev->>MetadataTool: Add bestPractices for loop/parallel special blocks
Note over UI,Copilot: Runtime: Enhanced Copilot Context
UI->>Copilot: User requests workflow assistance
Copilot->>MetadataTool: get_blocks_metadata(blockIds)
MetadataTool->>BlockRegistry: Retrieve block configurations
BlockRegistry-->>MetadataTool: Block configs with bestPractices
MetadataTool-->>Copilot: Enhanced metadata including best practices
Copilot->>UI: Provide contextual guidance using best practices
17 files reviewed, 2 comments
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Sg312
reviewed
Sep 23, 2025
…im into improvement/best-prac-meta
waleedlatif1
pushed a commit
that referenced
this pull request
Sep 23, 2025
* improvement(copilot): add best practices for blocks * fix kb, api * Update apps/sim/blocks/blocks/memory.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * address comments * remove non deterministic test --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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
Add best practices field to block config and get blocks metadata tool to give more context on Sim-native core blocks.
Type of Change
Testing
Manually
Checklist