You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: provide boundary support for agent modules (#780)
## Description
Enable any agent module to run its AI agent inside Coder's Agent
Boundaries.
The agentapi module handles boundary installation, config setup, and
wrapper
script creation, then exports AGENTAPI_BOUNDARY_PREFIX for consuming
modules
to use in their start scripts.
Supports three boundary installation modes:
- coder boundary subcommand (default, Coder v2.30+)
- Standalone binary via install script (use_boundary_directly)
- Compiled from source (compile_boundary_from_source)
Users must provide a boundary config.yaml with their allowlist and
settings when enabling boundary.
Closes#457
## Type of Change
- [x] Feature/enhancement
## Module Information
**Path:** `registry/coder/modules/agentapi`
**Breaking change:** No
## Testing & Validation
- [x] Tests pass (`bun test`)
- [x] Code formatted (`bun fmt`)
- [x] Changes tested locally
---------
Co-authored-by: Shane White <shane.white@cloudsecure.ltd>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: 35C4n0r <70096901+35C4n0r@users.noreply.github.com>
# Optional: install boundary binary instead of using coder subcommand
110
+
# use_boundary_directly = true
111
+
# boundary_version = "0.6.0"
112
+
# compile_boundary_from_source = false
113
+
}
114
+
```
115
+
116
+
### Contract for agent modules
117
+
118
+
When `enable_boundary = true`, the agentapi module exports `AGENTAPI_BOUNDARY_PREFIX`
119
+
as an environment variable pointing to a wrapper script. Agent module start scripts
120
+
should check for this variable and use it to prefix the agent command:
121
+
122
+
```bash
123
+
if [ -n"${AGENTAPI_BOUNDARY_PREFIX:-}" ];then
124
+
agentapi server -- "${AGENTAPI_BOUNDARY_PREFIX}" my-agent "${ARGS[@]}"&
125
+
else
126
+
agentapi server -- my-agent "${ARGS[@]}"&
127
+
fi
128
+
```
129
+
130
+
This ensures only the agent process is sandboxed while agentapi itself runs unrestricted.
131
+
92
132
## For module developers
93
133
94
134
For a complete example of how to use this module, see the [Goose module](https://github.com/coder/registry/blob/main/registry/coder/modules/goose/main.tf).
Copy file name to clipboardExpand all lines: registry/coder/modules/agentapi/main.tf
+45Lines changed: 45 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -164,6 +164,36 @@ variable "module_dir_name" {
164
164
description="Name of the subdirectory in the home directory for module files."
165
165
}
166
166
167
+
variable"enable_boundary" {
168
+
type=bool
169
+
description="Enable coder boundary for network filtering. Requires boundary_config to be set."
170
+
default=false
171
+
}
172
+
173
+
variable"boundary_config_path" {
174
+
type=string
175
+
description="Path to boundary config.yaml inside the workspace. If provided, exposed as BOUNDARY_CONFIG env var."
176
+
default=""
177
+
}
178
+
179
+
variable"boundary_version" {
180
+
type=string
181
+
description="Boundary version. When use_boundary_directly is true, a release version should be provided or 'latest' for the latest release. When compile_boundary_from_source is true, a valid git reference should be provided (tag, commit, branch)."
182
+
default="latest"
183
+
}
184
+
185
+
variable"compile_boundary_from_source" {
186
+
type=bool
187
+
description="Whether to compile boundary from source instead of using the official install script."
188
+
default=false
189
+
}
190
+
191
+
variable"use_boundary_directly" {
192
+
type=bool
193
+
description="Whether to use boundary binary directly instead of coder boundary subcommand. When false (default), uses coder boundary subcommand. When true, installs and uses boundary binary from release."
194
+
default=false
195
+
}
196
+
167
197
variable"enable_state_persistence" {
168
198
type=bool
169
199
description="Enable AgentAPI conversation state persistence across restarts."
0 commit comments