busbar-sf-agentscript
AgentScript parser, graph analysis, and LSP for Salesforce Agentforce.
AgentScript (.agent) is Salesforce's indentation-sensitive language for defining AI agent behavior in Agentforce. This project provides tooling for authoring, validating, and analyzing .agent files.
Getting Started
Choose the option that fits your workflow:
| Best for | What you get | |
|---|---|---|
| SF CLI Plugin | Salesforce developers | sf agency commands for validation, graph export, and CI integration |
| VS Code Extension | VS Code users | Syntax highlighting, real-time diagnostics, and topic graph visualization |
| LSP Server | Neovim, Helix, and other editors | Full language server for any LSP-capable editor |
| Rust Crates | Rust developers | Parser, graph analysis library, and WASM support |
SF CLI Plugin
Install with the Salesforce CLI:
Validate an AgentScript file:
Export the topic reference graph:
Extract action interface definitions:
The plugin exits non-zero on errors, making it suitable for CI pipelines.
VS Code Extension
Install from the VS Code Marketplace:
Or download the .vsix from GitHub Releases and install manually:
Features:
- Syntax highlighting for
.agentfiles - Real-time diagnostics — undefined references, cycle detection, unreachable topics
- Hover documentation
- Semantic token highlighting
- Topic graph visualization (
AgentScript: Show Topic Graph) - Agent simulation (
AgentScript: Simulate Agent) - AgentScript Dependencies panel in the Explorer sidebar
Settings:
| Setting | Default | Description |
|---|---|---|
agentscript.lsp.serverPath |
auto | Path to a custom busbar-sf-agentscript-lsp binary |
agentscript.maxNumberOfProblems |
100 |
Maximum diagnostics shown per file |
agentscript.trace.server |
off |
LSP communication tracing (off, messages, verbose) |
LSP Server
The busbar-sf-agentscript-lsp binary powers the VS Code extension and works with any LSP-capable editor.
Install
Download the pre-built binary for your platform from GitHub Releases:
| Platform | Binary |
|---|---|
| macOS (Apple Silicon) | busbar-sf-agentscript-lsp-aarch64-apple-darwin |
| macOS (Intel) | busbar-sf-agentscript-lsp-x86_64-apple-darwin |
| Linux x86_64 | busbar-sf-agentscript-lsp-x86_64-unknown-linux-gnu |
| Linux aarch64 | busbar-sf-agentscript-lsp-aarch64-unknown-linux-gnu |
| Windows x86_64 | busbar-sf-agentscript-lsp-x86_64-pc-windows-msvc.exe |
Or install from source:
Neovim
Using nvim-lspconfig:
local lspconfig = require
local configs = require
if not configs.
lspconfig..
Add to ~/.config/nvim/init.lua (or your config's ftdetect):
vim..
Helix
Add to ~/.config/helix/languages.toml:
[[]]
= "agentscript"
= "source.agentscript"
= ["agent"]
= ["sfdx-project.json", ".git"]
= ["agentscript-lsp"]
[]
= "busbar-sf-agentscript-lsp"
Other Editors
Any editor supporting LSP can be configured to launch busbar-sf-agentscript-lsp as a stdio language server for files with the .agent extension.
Rust Crates
Add to Cargo.toml:
[]
# Parser only (default)
= "0.1"
# Parser + graph analysis
= { = "0.1", = ["graph"] }
# Parser + WASM bindings
= { = "0.1", = ["wasm"] }
Parser
use parse;
let source = read_to_string.unwrap;
let ast = parse.unwrap;
println!;
Graph Analysis
use ;
let source = read_to_string.unwrap;
let ast = parse.unwrap;
let graph = from_ast.unwrap;
println!;
println!;
println!;
Individual Crates
The umbrella crate re-exports everything, but you can depend on individual crates directly:
| Crate | docs.rs | Description |
|---|---|---|
busbar-sf-agentscript |
Lexer, parser, AST, serializer, semantic validator, and graph analysis | |
busbar-sf-agentscript-lsp |
LSP server binary |
AgentScript Language
AgentScript (.agent) is an indentation-sensitive (3-space) YAML-like language for defining Agentforce agent behavior. Example:
config:
agent_name: MyAgent
variables:
customerName: ""
start_agent:
message: Hello! How can I help you today?
topics:
- topic: SupportTopic
instructions: Handle customer support requests.
actions:
- action: LookupCase
type: FlowAction
api_name: Look_Up_Case
See agent-script-recipes for real-world examples.
Workspace
src/ — parser, graph analysis, WASM bindings
crates/
lsp/ busbar-sf-agentscript-lsp — LSP server binary
packages/ — VS Code extension
plugin-agency/ — SF CLI plugin (sf agency *)
tree-sitter-agentscript/ — Tree-sitter grammar
zed-extension/ — Zed editor extension
agent-script-recipes/ — test fixtures (git submodule)
Contributing
See CONTRIBUTING.md. All contributions are welcome.
Local Setup
The pre-commit hook runs cargo fmt --check and cargo clippy -- -D warnings before every commit, matching CI exactly.
License
Licensed under either of
at your option.