VS Code extension
The Sagewai VS Code extension adds directive syntax highlighting, scaffold commands, and code snippets for agent development. It requires no configuration and activates automatically when you open a Python or Markdown file.
Installation
From VSIX (current)
cd vscode/
npm install
npm run compile
npx @vscode/vsce package
Then open the Command Palette in VS Code, run Extensions: Install from VSIX..., and select the generated .vsix file.
From source (development)
- Open the
vscode/directory in VS Code - Press F5 to launch the Extension Development Host
- The extension activates for Python and Markdown files automatically
VS Code Marketplace (coming soon)
ext install sagewai.sagewai
Directive syntax highlighting
The extension injects TextMate grammar patterns into Python and Markdown files. Directives are highlighted separately from regular Python strings, which helps you spot retrieval calls, agent delegations, and model overrides at a glance.
Supported directives:
| Directive | Purpose | Example |
|---|---|---|
@context() | Retrieve documents from Context Engine | @context('quarterly earnings', scope='project', tags='finance') |
@memory() | Search stored facts | @memory('customer preferences') |
@agent:name() | Delegate to another agent | @agent:researcher('Find latest pricing data') |
@wf:name() | Invoke a saved workflow | @wf:approval_pipeline('Review this contract') |
/tool.name() | Call a tool inline | /tool.web_search('Sagewai documentation') |
#model:name | Override the model | #model:gpt-4o |
#budget:amount | Set a budget limit | #budget:1.00 |
@datetime, @date, @time | Dynamic parameters | Resolved at prompt-processing time |
@user, @project | Context parameters | Current user and project |
{{ expression }} | Template expressions | {{ context.search('query') }} |
Scaffold commands
Open the Command Palette (Cmd+Shift+P or Ctrl+Shift+P) to access these commands:
Sagewai: New Agent
Generates a complete agent file with proper imports, an example @tool decorated function, agent configuration, and an async usage example:
from sagewai import UniversalAgent, tool
@tool
async def search_web(query: str) -> str:
"""Search the web for information."""
# TODO: implement
return f"Results for: {query}"
agent = UniversalAgent(
name="my-agent",
model="gpt-4o",
system_prompt="You are a helpful research assistant.",
tools=[search_web],
)
# Usage: response = await agent.chat("Find the latest AI news")
Sagewai: New Workflow
Generates a multi-agent sequential pipeline:
from sagewai import UniversalAgent, SequentialAgent
researcher = UniversalAgent(
name="researcher",
model="gpt-4o",
system_prompt="You research topics thoroughly.",
)
writer = UniversalAgent(
name="writer",
model="gpt-4o",
system_prompt="You write clear, engaging content.",
)
pipeline = SequentialAgent(
name="research-pipeline",
agents=[researcher, writer],
)
# Usage: result = await pipeline.chat("Write an article about quantum computing")
Sagewai: Add Tool
Inserts a @tool decorated function at your cursor position. Tab stops let you fill in the function name, parameters, and docstring without touching the surrounding boilerplate.
Code snippets
Type a prefix and press Tab to expand:
| Prefix | Expands to | Use case |
|---|---|---|
swagent | Full agent with tool and config | Quick agent setup |
swtool | @tool decorated function | Add a single tool |
swworkflow | Sequential dual-agent pipeline | Multi-stage workflows |
swctx | @context('query', scope='project', tags='...') | Context retrieval directive |
swmem | @memory('query') | Memory search directive |
swag | @agent:name('task') | Agent delegation directive |
What the extension does for your workflow
Scaffold commands generate a complete, correctly structured file in a couple of seconds — correct imports, async patterns, @tool decorator, UniversalAgent config — rather than typing it from scratch.
Syntax highlighting makes directive strings visually distinct from regular Python strings. You can see at a glance which parts of a prompt are directives, which helps when editing multi-directive prompts.
Snippets with tab stops let you fill in the variable parts (name, system prompt, tool parameters) without hunting through boilerplate. Tab from placeholder to placeholder.
Works alongside AI assistants — Copilot, Cursor, and Claude Code can all see highlighted directives in your code. Snippets handle the scaffolding so your AI assistant focuses on the logic.
Configuration
No configuration is required. The extension activates automatically when you open any Python or Markdown file.
Requirements:
- VS Code 1.85.0 or later
- No runtime dependencies
Technical details
- Activation events:
onLanguage:python,onLanguage:markdown - Grammar injection: TextMate grammar patterns injected into Python and Markdown
- Bundle size: Minimal — no runtime dependencies, compiles to a single JS file