Skip to content

Commit 344b02e

Browse files
blinkagent[bot]blink-so[bot]DevelopmentCats
authored
feat(agentapi,claude-code): add web_app variable to disable the web app (#764)
Adds a `web_app` variable (default: `true`) to both the `claude-code` and `agentapi` modules. When set to `false`, AgentAPI still runs but the web UI app icon is not shown in the Coder dashboard. This mirrors the existing `cli_app` toggle pattern. ## Changes ### `agentapi` module - New `web_app` variable (bool, default `true`) - `coder_app.agentapi_web` now has `count = local.web_app ? 1 : 0` - **Task-safe:** `local.web_app` is computed as `var.web_app || local.is_task`, where `is_task = try(data.coder_task.me.enabled, false)`. This means the web app is always created when the workspace is a Task, regardless of the `web_app` variable. - `task_app_id` output returns `""` when `local.web_app` is `false` ### `claude-code` module - New `web_app` variable (bool, default `true`) - `TODO` comment to wire `web_app` through to agentapi once published ## Usage (once fully wired) ```hcl module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" ... web_app = false # hides the Claude Code web UI from the dashboard } ``` Setting `web_app = false` is safe even in templates that use `coder_ai_task` — the module detects Tasks via `data.coder_task.me.enabled` and automatically enables the web app. ## Merge strategy This needs to land in two steps: 1. **Merge this PR** — publishes the agentapi module with `web_app` support, and adds the `web_app` variable to claude-code (not yet wired through) 2. **Follow-up PR** — bump the agentapi version in claude-code and replace the `TODO` with `web_app = var.web_app` --------- Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com> Co-authored-by: DevCats <christofer@coder.com>
1 parent 31a07ac commit 344b02e

4 files changed

Lines changed: 33 additions & 13 deletions

File tree

registry/coder/modules/agentapi/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The AgentAPI module is a building block for modules that need to run an AgentAPI
1616
```tf
1717
module "agentapi" {
1818
source = "registry.coder.com/coder/agentapi/coder"
19-
version = "2.3.0"
19+
version = "2.4.0"
2020
2121
agent_id = var.agent_id
2222
web_app_slug = local.app_slug

registry/coder/modules/agentapi/main.tf

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ variable "folder" {
5353
default = "/home/coder"
5454
}
5555

56+
variable "web_app" {
57+
type = bool
58+
description = "Whether to create the web workspace app. This is automatically enabled when using Coder Tasks, regardless of this setting."
59+
default = true
60+
}
61+
5662
variable "cli_app" {
5763
type = bool
5864
description = "Whether to create the CLI workspace app."
@@ -220,6 +226,11 @@ resource "coder_env" "boundary_config" {
220226
}
221227

222228
locals {
229+
# If this is a Task, always create the web app regardless of var.web_app
230+
# since coder_ai_task requires the app to function.
231+
is_task = try(data.coder_task.me.enabled, false)
232+
web_app = var.web_app || local.is_task
233+
223234
# we always trim the slash for consistency
224235
workdir = trimsuffix(var.folder, "/")
225236
encoded_pre_install_script = var.pre_install_script != null ? base64encode(var.pre_install_script) : ""
@@ -305,6 +316,8 @@ resource "coder_script" "agentapi_shutdown" {
305316
}
306317

307318
resource "coder_app" "agentapi_web" {
319+
count = local.web_app ? 1 : 0
320+
308321
slug = var.web_app_slug
309322
display_name = var.web_app_display_name
310323
agent_id = var.agent_id
@@ -341,5 +354,5 @@ resource "coder_app" "agentapi_cli" {
341354
}
342355

343356
output "task_app_id" {
344-
value = coder_app.agentapi_web.id
357+
value = local.web_app ? coder_app.agentapi_web[0].id : ""
345358
}

registry/coder/modules/claude-code/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Run the [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude
1313
```tf
1414
module "claude-code" {
1515
source = "registry.coder.com/coder/claude-code/coder"
16-
version = "4.8.2"
16+
version = "4.9.0"
1717
agent_id = coder_agent.main.id
1818
workdir = "/home/coder/project"
1919
claude_api_key = "xxxx-xxxxx-xxxx"
@@ -60,7 +60,7 @@ By default, when `enable_boundary = true`, the module uses `coder boundary` subc
6060
```tf
6161
module "claude-code" {
6262
source = "registry.coder.com/coder/claude-code/coder"
63-
version = "4.8.2"
63+
version = "4.9.0"
6464
agent_id = coder_agent.main.id
6565
workdir = "/home/coder/project"
6666
enable_boundary = true
@@ -81,7 +81,7 @@ For tasks integration with AI Bridge, add `enable_aibridge = true` to the [Usage
8181
```tf
8282
module "claude-code" {
8383
source = "registry.coder.com/coder/claude-code/coder"
84-
version = "4.8.2"
84+
version = "4.9.0"
8585
agent_id = coder_agent.main.id
8686
workdir = "/home/coder/project"
8787
enable_aibridge = true
@@ -110,7 +110,7 @@ data "coder_task" "me" {}
110110
111111
module "claude-code" {
112112
source = "registry.coder.com/coder/claude-code/coder"
113-
version = "4.8.2"
113+
version = "4.9.0"
114114
agent_id = coder_agent.main.id
115115
workdir = "/home/coder/project"
116116
ai_prompt = data.coder_task.me.prompt
@@ -133,7 +133,7 @@ This example shows additional configuration options for version pinning, custom
133133
```tf
134134
module "claude-code" {
135135
source = "registry.coder.com/coder/claude-code/coder"
136-
version = "4.8.2"
136+
version = "4.9.0"
137137
agent_id = coder_agent.main.id
138138
workdir = "/home/coder/project"
139139
@@ -189,7 +189,7 @@ Run and configure Claude Code as a standalone CLI in your workspace.
189189
```tf
190190
module "claude-code" {
191191
source = "registry.coder.com/coder/claude-code/coder"
192-
version = "4.8.2"
192+
version = "4.9.0"
193193
agent_id = coder_agent.main.id
194194
workdir = "/home/coder/project"
195195
install_claude_code = true
@@ -211,7 +211,7 @@ variable "claude_code_oauth_token" {
211211
212212
module "claude-code" {
213213
source = "registry.coder.com/coder/claude-code/coder"
214-
version = "4.8.2"
214+
version = "4.9.0"
215215
agent_id = coder_agent.main.id
216216
workdir = "/home/coder/project"
217217
claude_code_oauth_token = var.claude_code_oauth_token
@@ -284,7 +284,7 @@ resource "coder_env" "bedrock_api_key" {
284284
285285
module "claude-code" {
286286
source = "registry.coder.com/coder/claude-code/coder"
287-
version = "4.8.2"
287+
version = "4.9.0"
288288
agent_id = coder_agent.main.id
289289
workdir = "/home/coder/project"
290290
model = "global.anthropic.claude-sonnet-4-5-20250929-v1:0"
@@ -341,7 +341,7 @@ resource "coder_env" "google_application_credentials" {
341341
342342
module "claude-code" {
343343
source = "registry.coder.com/coder/claude-code/coder"
344-
version = "4.8.2"
344+
version = "4.9.0"
345345
agent_id = coder_agent.main.id
346346
workdir = "/home/coder/project"
347347
model = "claude-sonnet-4@20250514"

registry/coder/modules/claude-code/main.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ variable "report_tasks" {
4747
default = true
4848
}
4949

50+
variable "web_app" {
51+
type = bool
52+
description = "Whether to create the web app for Claude Code. When false, AgentAPI still runs but no web UI app icon is shown in the Coder dashboard. This is automatically enabled when using Coder Tasks, regardless of this setting."
53+
default = true
54+
}
55+
5056
variable "cli_app" {
5157
type = bool
5258
description = "Whether to create a CLI app for Claude Code"
@@ -362,9 +368,10 @@ locals {
362368

363369
module "agentapi" {
364370
source = "registry.coder.com/coder/agentapi/coder"
365-
version = "2.2.0"
371+
version = "2.3.0"
366372

367-
agent_id = var.agent_id
373+
agent_id = var.agent_id
374+
# TODO: pass web_app = var.web_app once agentapi module is published with web_app support
368375
web_app_slug = local.app_slug
369376
web_app_order = var.order
370377
web_app_group = var.group

0 commit comments

Comments
 (0)