Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit95aa16d

Browse files
david-fraleyblink-so[bot]bpmctmatifali
authored
docs: add Tasks Core Principles Page (#19878)
---------Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>Co-authored-by: Ben Potter <ben@coder.com>Co-authored-by: Atif Ali <atif@coder.com>
1 parent4e7b518 commit95aa16d

File tree

4 files changed

+190
-3
lines changed

4 files changed

+190
-3
lines changed
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
#Understanding Coder Tasks
2+
3+
##What is a Task?
4+
5+
Coder Tasks is Coder's platform for managing coding agents. With Coder Tasks, you can:
6+
7+
- Run an AI Agent like Claude Code or OpenAI's Codex in your Workspace to assist in day-to-day development and building
8+
- Kick off AI-enabled workflows such as upgrading a vulnerable package and automatically opening a GitHub Pull Requests with the patch
9+
- Configure a background operation where an automated agent can detect a failure in your CI/CD pipeline, spin up a Coder Workspace, apply a fix, and prepare a PR_without_ manual input
10+
11+
![Tasks UI](../images/guides/ai-agents/tasks-ui.png)Coder Tasks Dashboard view to see all available tasks.
12+
13+
Coder Tasks allows you and your organization to build and automate workflows to fully leverage AI. Tasks operate through Coder Workspaces. We support interacting with an agent through the Task UI and CLI. Some Tasks can also be accessed through the Coder Workspace IDE; see[connect via an IDE](../user-guides/workspace-access).
14+
15+
##Why Use Tasks?
16+
17+
Coder Tasks make both developer-driven_and_ autonomous agentic workflows first-class citizens within your organization. Without Coder Tasks, teams revert to ad-hoc scripts, one-off commands, or manual checklists even for tasks that LLMs could automate. These workarounds can help a single engineer, but don't scale or provide consistency across an organization that is attempting to use AI as a true force multiplier.
18+
19+
Coder Tasks exist to solve these types of problems:
20+
21+
-**Consistency:** Capture a known, safe, & secure workflow once that can then be run anywhere
22+
-**Reproducibility:** Every task runs from a Coder Workspace, so results are reliable
23+
-**Productivity:** Eliminate manual processes from developer processes enabling them to focus on less defined and harder-to-do issues
24+
-**Scalability:** Once a workflow is captured in a task, it can be reused by other teams within your organization scaling with you as you grow
25+
-**Flexibility:** Support both developer_AND_ autonomous agentic workflows
26+
27+
###Example Task Workflow
28+
29+
Coder Tasks aren't limited to manual operation. They can operate as event-driven automations triggered by your team's everyday activities. Tasks can be thought of through two different type of triggers: manual and event-driven. In the below diagram, the user reported bug could result in a task being spun up via:
30+
31+
-**Event-Driven:** An automatic hook in your git repository
32+
-**Manual:** An engineer reviewing the bug backlog manually creates a task
33+
34+
Other common triggers for event-based workflows include PRs being created/updated, a failure in your CI/CD pipeline, or issues being created/updated in your repository.
35+
36+
![Example Background Task](../images/guides/ai-agents/background-task-example.png)Example of Background Coder Tasks operation.
37+
38+
##How to Make a Task Template
39+
40+
If you need a refresher on Coder Templates, check out our[starting guide here](https://coder.com/docs/tutorials/template-from-scratch).
41+
42+
###What Makes a Task Template
43+
44+
Task Templates are regular Coder Templates with a few additional resources defined. These resources include the logic that lets the Coder UI and infrastructure recognize a Task, and prepare the system for automated execution and AI-driven workflows rather than development environments for developers and builders.
45+
46+
There are two approaches to turning a Template into a Task Template:
47+
48+
####Using a Registry Module
49+
50+
You can use a pre-existing agent module that[Coder maintains](https://registry.coder.com/modules). When using an agent module, you must define:
51+
52+
-`coder_parameter` named_ai_prompt_: Define the AI prompt input so users can define/specify what tasks need to run
53+
-**Agentic Module** that defines the agent you want to use, e.g. Claude Code, Codex CLI, Gemini CLI
54+
55+
Coder maintains various agentic modules; see[Coder Labs](https://registry.coder.com/contributors/coder-labs). These modules, in addition to defining connection information for the specific agent, reference the[AgentAPI module](https://registry.coder.com/modules/coder/agentapi) which provides connection, reporting, and agent life cycle management operations. The module also defines the`coder_ai_task` resource which allows the Task to be visible in the UI.
56+
57+
The following code snippet can be dropped into any existing template to modify it into a Claude-Code enabled task template. This snippet also includes space for a setup script that will prime the agent for execution.
58+
59+
```hcl
60+
data "coder_parameter" "ai_prompt" {
61+
name = "AI Prompt"
62+
type = "string"
63+
}
64+
65+
data "coder_parameter" "setup_script" {
66+
name = "setup_script"
67+
display_name = "Setup Script"
68+
type = "string"
69+
form_type = "textarea"
70+
description = "Script to run before running the agent"
71+
mutable = false
72+
default = ""
73+
}
74+
75+
# The Claude Code module does the automatic task reporting
76+
# Other agent modules: https://registry.coder.com/modules?search=tag%3Atasks
77+
# Or use a custom agent:
78+
module "claude-code" {
79+
count = data.coder_workspace.me.start_count
80+
source = "registry.coder.com/coder/claude-code/coder"
81+
version = "2.2.0"
82+
agent_id = coder_agent.main.id
83+
folder = "/home/coder/projects"
84+
install_claude_code = true
85+
claude_code_version = "latest"
86+
order = 999
87+
88+
# experiment_post_install_script = data.coder_parameter.setup_script.value
89+
90+
# This enables Coder Tasks
91+
experiment_report_tasks = true
92+
}
93+
94+
variable "anthropic_api_key" {
95+
type = string
96+
description = "Generate one at: https://console.anthropic.com/settings/keys"
97+
sensitive = true
98+
}
99+
100+
resource "coder_env" "anthropic_api_key" {
101+
agent_id = coder_agent.main.id
102+
name = "CODER_MCP_CLAUDE_API_KEY"
103+
value = var.anthropic_api_key
104+
}
105+
```
106+
107+
Let's break down this snippet:
108+
109+
- The`module "claude-code"` sets up the Task template to use Claude Code, but Coder's Registry supports many other agent modules like[OpenAI's Codex](https://registry.coder.com/modules/coder-labs/codex) or[Gemini CLI](https://registry.coder.com/modules/coder-labs/gemini)
110+
- Each module defines its own specific inputs. Claude Code expects the`CODER_MCP_CLAUDE_API_KEY` environment variable to exist, but OpenAI based agents expect`OPENAI_API_KEY` for example. You'll want to check the specific module's defined variables to know what exactly needs to be defined
111+
- You can define specific scripts to run at startup of the Task. For example, you could define a setup script that calls to AWS S3 and pulls specific files you want your agent to have access to
112+
113+
####Using a Custom Agent
114+
115+
Coder allows you to define a custom agent. When doing so, you must define:
116+
117+
-`coder_parameter` named_ai_prompt_: Define the AI prompt input so users can define/specify what tasks need to run
118+
-`coder_ai_task` which registers the task with the UI and allows the task to be visible
119+
-**AgentAPI binary** which provides runtime execution logistics for the task
120+
121+
You can find the latest[AgentAPI binary here](https://github.com/coder/agentapi/releases). You can alternatively import and use the[AgentAPI module](https://registry.coder.com/modules/coder/agentapi?tab=variables) Coder maintains, which also conveniently defines the`coder_ai_task` resource.
122+
123+
Read more about[custom agents here](https://coder.com/docs/ai-coder/custom-agents).
124+
125+
####Putting it all Together
126+
127+
Coder recommends using pre-existing agent modules when making a Task Template. Making a Task Template boils down to:
128+
129+
1. Identify the existing agent you want access to in our[Registry](https://registry.coder.com/modules)
130+
1. Add the agent's module to your existing template
131+
1. Define the module's required inputs
132+
1. Define the`coder_parameter`
133+
134+
and you're all set to go! If you want to build your own custom agent, read up on our[Custom Agents](https://coder.com/docs/ai-coder/custom-agents) documentation.
135+
136+
In summary, Task Templates are highly flexible. You can swap out modules depending on which agent you want to run, adjust their inputs based on the provider's requirements, and layer on custom setup scripts to tailor the environment to your workflow. Whether that means using a different LLM, pointing to a new API key, or pulling files from S3 at startup, the template structure makes it easy to adapt tasks without having to rebuild everything from scratch.
137+
138+
##Task Template Design Principles
139+
140+
Coder Tasks, being based in a given Workspace, operate on very similar principles:
141+
142+
-**Specificity & Refinability:** Tasks, just like Templates, are made to address a specific problem and evolve with that problem and your team over time
143+
-**Security:** Because Tasks are defined through templates, you can define and restrict what access an agent running inside a Task has access to
144+
-**Frugality:** Tasks only consume resources when running. You should design your Task Template to provide just enough compute and storage so that your task can effectively complete its job, reducing infrastructure cost
145+
-**Model Applicability:** Task Templates can specify which model is most appropriate, meaning you can fine tune your Task based on its job, be that a code-focused model for fixing bugs or a generalized LLM to write summaries and updates on Pull Requests
146+
-**Automation:** Coder Tasks provide a comprehensive set of built-in APIs, status monitoring, and notification systems. This allows for you and your team to build seamless integrations with external automation workflows
147+
148+
Together, these principles make up the core idea of designing task templates. Tasks are programmable, secure, and cost-efficient agents that integrate seamlessly into your team's workflow. By treating task templates as living and adaptable designs, you can evolve them with your team and needs without sacrificing clarity or control. The result is a system where automation, resource management, and security are baked into the foundation letting developers focus less on orchestration details and more on solving the problems that matter.
149+
150+
These design principles aren’t just technical guidelines; they're the lens through which to understand what Tasks are and how to use them effectively. By grounding Tasks in specificity, security, frugality, applicability, and automation, you ensure they remain reliable building blocks for both individual workflows and larger team processes.
151+
152+
###Practical Considerations
153+
154+
Tasks don't expose template parameters at runtime, other than the AI Prompt. If users need to choose different compute, region, or tooling options for example, you can define workspace presets in the template and have users select a preset when starting the Task. See workspace presets for details: ../admin/templates/extending-templates/parameters#workspace-presets.
155+
156+
###Identity, Security, and Access
157+
158+
By default, agents running with Coder Tasks always act as the authenticated developer. External auth tokens tie actions directly back to a specific user, so Git operations like cloning, pushing, or creating a PR are executed under the developer's personal OAuth tokens. Workspace SSH keys are generated per user, and external service integrations authenticate with the developer's personal credentials. This preserves audit trails and ensures actions stay traceable. Authentication (who the user is) subsequently stays separate from authorization (what the user can do), with identity providers acting as the source of truth. For human users, OIDC or SSO ensure sessions are consistent, centralized, and easy to govern.
159+
160+
For automated or background use cases, Tasks can also run under service identities. These behave like CI jobs: locked down, narrowly scoped, and managed by the organization. Service accounts or bot identities cover headless API-driven systems, while GitHub Apps enable fine-grained repository access under your organization's control. If long-lived API tokens are needed, they should be tied to service accounts with strict roles and rotation policies. In practice, the default should always be user-context execution for developer workflows while service accounts are reserved for production automation, CI/CD pipelines, and cross-team integrations. This balance keeps developer productivity high while aligning with organizational security requirements.
161+
162+
##How Tasks Fit Into Coder
163+
164+
Coder's platform is built around three core concepts that work together:
165+
166+
**Coder Templates** define the infrastructure and tool configurations that can be reused across your organization. They're the "blueprint" that ensures consistency and captures your team's working preferences.
167+
168+
**Coder Workspaces** are the individual development environments that are spun up from templates. They provide developers with consistent, reproducible environments to perform their job.
169+
170+
**Tasks** extend this model to AI agents and automated workflows. The same template-driven approach is now optimized to allow for autonomous execution that can be independent from human interaction.
171+
172+
###Platform Integration
173+
174+
Tasks aren't a separate system bolted onto Coder, but a natural extension of your existing infrastructure.
175+
176+
-**Security:** Tasks inherit the same access controls, secrets management, and network policies as developer workspaces
177+
-**Resource Management:** Tasks have access to the same compute pools, storage, and scaling policies you've already configured
178+
-**Observability:** Tasks use the same underlying infrastructure for monitoring, and appear in their own custom task-specific dashboards
179+
180+
###Developer Experience Continuity
181+
182+
Coder understands that every team is in a different place in its AI adoption plan. Some teams are still working with AI assistants to speed up development, while other teams are adopting background tasks to automate PR reviews and small bug fixes.
183+
184+
Naturally, your team might want to jump into a task, for example when the agent encounters an issue or needs human input. With Coder Tasks, you're able to jump into the existing Coder Workspace environment backing the task execution so that you can push the work forward. There's no context switching between tools; it's the same workspace you're already used to and the agent's work becomes yours.

‎docs/ai-coder/tasks.md‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ 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/templates/coder-labs/tasks-docker)
4343

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

4946
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. Try adding this terraform block to an existing template where you'll add our Claude Code module. Note: the`coder_ai_task` resource is defined within the[Claude Code Module](https://registry.coder.com/modules/coder/claude-code?tab=readme), so it's not defined within this block.
32.2 KB
Loading

‎docs/manifest.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,12 @@
883883
"path":"./ai-coder/tasks.md",
884884
"state": ["beta"],
885885
"children": [
886+
{
887+
"title":"Understanding Coder Tasks",
888+
"description":"Core principles and concepts behind Coder Tasks",
889+
"path":"./ai-coder/tasks-core-principles.md",
890+
"state": ["beta"]
891+
},
886892
{
887893
"title":"Custom Agents",
888894
"description":"Run custom agents with Coder Tasks",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp