Skip to content

Commit 8e5b2df

Browse files
hugodutkabpmct
andauthored
chore: make suggestions to the Tasks documentation (#18714)
Co-authored-by: Ben Potter <ben@coder.com>
1 parent b36c2dd commit 8e5b2df

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

docs/ai-coder/tasks.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,51 @@ Try prompts such as:
4141

4242
To import the template and begin configuring it, follow the [documentation in the Coder Registry](https://registry.coder.com#coming-soon)
4343

44+
> [!NOTE]
45+
> The Tasks tab will appear automatically after you add a Tasks-compatible template and refresh the page.
46+
4447
### Option 2&rpar; Create or Duplicate Your Own Template
4548

46-
Because Tasks run unpredictable AI agents, often for background tasks, we recommend creating a separate template for Coder Tasks with limited permissions.
49+
A template becomes a Task template if it defines a `coder_ai_task` resource and a `coder_parameter` named `"AI Prompt"`. Coder analyzes template files during template version import to determine if these requirements are met.
50+
51+
```hcl
52+
data "coder_parameter" "ai_prompt" {
53+
name = "AI Prompt"
54+
type = "string"
55+
}
56+
57+
# Multiple coder_ai_tasks can be defined in a template
58+
resource "coder_ai_task" "claude-code" {
59+
# At most one coder ai task can be instantiated during a workspace build.
60+
# Coder fails the build if it would instantiate more than 1.
61+
count = data.coder_parameter.ai_prompt.value != "" ? 1 : 0
62+
63+
sidebar_app {
64+
# which app to display in the sidebar on the task page
65+
id = coder_app.claude-code.id
66+
}
67+
}
68+
```
69+
70+
> [!NOTE]
71+
> This definition is not final and may change while Tasks is in beta. After any changes, we guarantee backwards compatibility for one minor Coder version. After that, you may need to update your template to continue using it with Tasks.
4772
48-
You can always duplicate your existing template, then apply separate network policies/firewalls/permissions to the template. From there, follow the docs for one of our [built-in modules for agents](https://registry.coder.com/modules?search=tag%3Aagent) in order to add it to your template, configure your LLM provider.
73+
Because Tasks run unpredictable AI agents, often for background tasks, we recommend creating a separate template for Coder Tasks with limited permissions. You can always duplicate your existing template, then apply separate network policies/firewalls/permissions to the template. From there, follow the docs for one of our [built-in modules for agents](https://registry.coder.com/modules?search=tag%3Aagent) in order to add it to your template, configure your LLM provider.
4974

5075
Alternatively, follow our guide for [custom agents](./custom-agents.md)
5176

77+
## Customizing the Task UI
78+
79+
The Task UI displays all workspace apps declared in a Task template. You can customize the app shown in the sidebar using the `sidebar_app.id` field on the `coder_ai_task` resource.
80+
81+
If a workspace app has the special `"preview"` slug, a navbar will appear above it. This is intended for templates that let users preview a web app they’re working on.
82+
83+
We plan to introduce more customization options in future releases.
84+
85+
## Opting out of Tasks
86+
87+
If you tried Tasks and decided you don't want to use it, you can hide the Tasks tab by starting `coder server` with the `CODER_HIDE_AI_TASKS=true` environment variable or the `--hide-ai-tasks` flag.
88+
5289
## Next Steps
5390

5491
<children></children>

0 commit comments

Comments
 (0)