agent-servers.md

  1# Agent Server Extensions
  2
  3Agent Servers are programs that provide AI agent implementations through the [Agent Client Protocol (ACP)](https://agentclientprotocol.com).
  4Agent Server Extensions let you package up an Agent Server so that users can install the extension and have your agent easily available to use in Zed.
  5
  6You can see the current Agent Server extensions either by opening the Extensions tab in Zed (execute the `zed: extensions` command) and changing the filter from `All` to `Agent Servers`, or by visiting [the Zed website](https://zed.dev/extensions?filter=agent-servers).
  7
  8## Defining Agent Server Extensions
  9
 10An extension can register one or more agent servers in the `extension.toml` like so:
 11
 12```toml
 13[agent_servers.my-agent]
 14name = "My Agent"
 15
 16[agent_servers.my-agent.targets.darwin-aarch64]
 17archive = "https://github.com/owner/repo/releases/download/v1.0.0/agent-darwin-arm64.tar.gz"
 18cmd = "./agent"
 19args = ["--serve"]
 20
 21[agent_servers.my-agent.targets.linux-x86_64]
 22archive = "https://github.com/owner/repo/releases/download/v1.0.0/agent-linux-x64.tar.gz"
 23cmd = "./agent"
 24args = ["--serve"]
 25
 26[agent_servers.my-agent.targets.windows-x86_64]
 27archive = "https://github.com/owner/repo/releases/download/v1.0.0/agent-windows-x64.zip"
 28cmd = "./agent.exe"
 29args = ["--serve"]
 30```
 31
 32### Required Fields
 33
 34- `name`: A human-readable display name for the agent server (shown in menus)
 35- `targets`: Platform-specific configurations for downloading and running the agent
 36
 37### Target Configuration
 38
 39Each target key uses the format `{os}-{arch}` where:
 40
 41- **os**: `darwin` (macOS), `linux`, or `windows`
 42- **arch**: `aarch64` (ARM64) or `x86_64`
 43
 44Each target must specify:
 45
 46- `archive`: URL to download the archive from (supports `.tar.gz`, `.zip`, etc.)
 47- `cmd`: Command to run the agent server (relative to the extracted archive)
 48- `args`: Command-line arguments to pass to the agent server (optional)
 49- `sha256`: SHA-256 hash string of the archive's bytes (optional, but recommended for security)
 50- `env`: Environment variables specific to this target (optional, overrides agent-level env vars with the same name)
 51
 52### Optional Fields
 53
 54You can also optionally specify at the agent server level:
 55
 56- `env`: Environment variables to set in the agent's spawned process. These apply to all targets by default.
 57- `icon`: Path to an SVG icon (relative to extension root) for display in menus.
 58
 59### Environment Variables
 60
 61Environment variables can be configured at two levels:
 62
 631. **Agent-level** (`[agent_servers.my-agent.env]`): Variables that apply to all platforms
 642. **Target-level** (`[agent_servers.my-agent.targets.{platform}.env]`): Variables specific to a platform
 65
 66When both are specified, target-level environment variables override agent-level variables with the same name. Variables defined only at the agent level are inherited by all targets.
 67
 68### Complete Example
 69
 70Here's a more complete example with all optional fields:
 71
 72```toml
 73[agent_servers.example-agent]
 74name = "Example Agent"
 75icon = "icon/agent.svg"
 76
 77[agent_servers.example-agent.env]
 78AGENT_LOG_LEVEL = "info"
 79AGENT_MODE = "production"
 80
 81[agent_servers.example-agent.targets.darwin-aarch64]
 82archive = "https://github.com/example/agent/releases/download/v2.0.0/agent-darwin-arm64.tar.gz"
 83cmd = "./bin/agent"
 84args = ["serve", "--port", "8080"]
 85sha256 = "abc123def456..."
 86
 87[agent_servers.example-agent.targets.linux-x86_64]
 88archive = "https://github.com/example/agent/releases/download/v2.0.0/agent-linux-x64.tar.gz"
 89cmd = "./bin/agent"
 90args = ["serve", "--port", "8080"]
 91sha256 = "def456abc123..."
 92
 93[agent_servers.example-agent.targets.linux-x86_64.env]
 94AGENT_MEMORY_LIMIT = "2GB"  # Linux-specific override
 95```
 96
 97## Installation Process
 98
 99When a user installs your extension and selects the agent server:
100
1011. Zed downloads the appropriate archive for the user's platform
1022. The archive is extracted to a cache directory
1033. Zed launches the agent using the specified command and arguments
1044. Environment variables are set as configured
1055. The agent server runs in the background, ready to assist the user
106
107Archives are cached locally, so subsequent launches are fast.
108
109## Distribution Best Practices
110
111### Use GitHub Releases
112
113GitHub Releases are a reliable way to distribute agent server binaries:
114
1151. Build your agent for each platform (macOS ARM64, macOS x86_64, Linux x86_64, Windows x86_64)
1162. Package each build as a compressed archive (`.tar.gz` or `.zip`)
1173. Create a GitHub release and upload the archives
1184. Use the release URLs in your `extension.toml`
119
120## SHA-256 Hashes
121
122It's good for security to include SHA-256 hashes of your archives in `extension.toml`. Here's how to generate it:
123
124### macOS and Linux
125
126```bash
127shasum -a 256 agent-darwin-arm64.tar.gz
128```
129
130### Windows
131
132```bash
133certutil -hashfile agent-windows-x64.zip SHA256
134```
135
136Then add that string to your target configuration:
137
138```toml
139[agent_servers.my-agent.targets.darwin-aarch64]
140archive = "https://github.com/owner/repo/releases/download/v1.0.0/agent-darwin-arm64.tar.gz"
141cmd = "./agent"
142sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
143```
144
145## Testing
146
147To test your Agent Server Extension:
148
1491. [Install it as a dev extension](./developing-extensions.md#developing-an-extension-locally)
1502. Open the [Agent Panel](../ai/agent-panel.md)
1513. Select your Agent Server from the list
1524. Verify that it downloads, installs, and launches correctly
1535. Test its functionality by conversing with it and watching the [ACP logs](../ai/external-agents.md#debugging-agents)
154
155## Icon Guideline
156
157In case your agent server has a logo, we highly recommend adding it as an SVG icon.
158For optimal display, follow these guidelines:
159
160- Make sure you resize your SVG to fit a 16x16 bounding box, with a padding of around one or two pixels
161- Ensure you have a clean SVG code by processing it through [SVGOMG](https://jakearchibald.github.io/svgomg/)
162- Avoid including icons with gradients as they will often make the SVG more complicated and possibly not render perfectly
163
164Note that we'll automatically convert your icon to monochrome to preserve Zed's design consistency.
165(You can still use opacity in different paths of your SVG to add visual layering.)
166
167---
168
169This is all you need to distribute an agent server through Zed's extension system!
170
171## Publishing
172
173Once your extension is ready, see [Publishing your extension](./developing-extensions.md#publishing-your-extension) to learn how to submit it to the Zed extension registry.