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
Run [Aider](https://aider.chat) AI pair programming in your workspace. This module installs Aider and provides a persistent session using screen or tmux.
11
+
Run [Aider](https://aider.chat) AI pair programming in your workspace. This module installs Aider with AgentAPI for seamless Coder Tasks Support.
12
12
13
13
```tf
14
-
module "aider" {
15
-
source = "registry.coder.com/coder/aider/coder"
16
-
version = "1.1.2"
17
-
agent_id = coder_agent.example.id
18
-
}
19
-
```
20
-
21
-
## Features
22
-
23
-
-**Interactive Parameter Selection**: Choose your AI provider, model, and configuration options when creating the workspace
24
-
-**Multiple AI Providers**: Supports Anthropic (Claude), OpenAI, DeepSeek, GROQ, and OpenRouter
25
-
-**Persistent Sessions**: Uses screen (default) or tmux to keep Aider running in the background
26
-
-**Optional Dependencies**: Install Playwright for web page scraping and PortAudio for voice coding
27
-
-**Project Integration**: Works with any project directory, including Git repositories
28
-
-**Browser UI**: Use Aider in your browser with a modern web interface instead of the terminal
29
-
-**Non-Interactive Mode**: Automatically processes tasks when provided via the `task_prompt` variable
30
-
31
-
## Module Parameters
32
-
33
-
> [!NOTE]
34
-
> The `use_screen` and `use_tmux` parameters cannot both be enabled at the same time. By default, `use_screen` is set to `true` and `use_tmux` is set to `false`.
35
-
36
-
## Usage Examples
37
-
38
-
### Basic setup with API key
39
-
40
-
```tf
41
-
variable "anthropic_api_key" {
14
+
variable "api_key" {
42
15
type = string
43
-
description = "Anthropic API key"
16
+
description = "API key"
44
17
sensitive = true
45
18
}
46
19
47
20
module "aider" {
48
-
count = data.coder_workspace.me.start_count
49
-
source = "registry.coder.com/coder/aider/coder"
50
-
version = "1.1.2"
51
-
agent_id = coder_agent.example.id
52
-
ai_api_key = var.anthropic_api_key
21
+
source = "registry.coder.com/coder/aider/coder"
22
+
version = "2.0.0"
23
+
agent_id = coder_agent.example.id
24
+
api_key = var.api_key
25
+
ai_provider = "google"
26
+
model = "gemini"
53
27
}
54
28
```
55
29
56
-
This basic setup will:
30
+
## Prerequisites
57
31
58
-
- Install Aider in the workspace
59
-
- Create a persistent screen session named "aider"
60
-
- Configure Aider to use Anthropic Claude 3.7 Sonnet model
61
-
- Enable task reporting (configures Aider to report tasks to Coder MCP)
32
+
- pipx is automatically installed if not already available
62
33
63
-
### Using OpenAI with tmux
34
+
##Usage Example
64
35
65
36
```tf
66
-
variable "openai_api_key" {
37
+
data "coder_parameter" "ai_prompt" {
38
+
name = "AI Prompt"
39
+
description = "Write an initial prompt for Aider to work on."
40
+
type = "string"
41
+
default = ""
42
+
mutable = true
43
+
}
44
+
45
+
variable "gemini_api_key" {
67
46
type = string
68
-
description = "OpenAI API key"
47
+
description = "Gemini API key"
69
48
sensitive = true
70
49
}
71
50
72
51
module "aider" {
73
-
count = data.coder_workspace.me.start_count
74
-
source = "registry.coder.com/coder/aider/coder"
75
-
version = "1.1.2"
76
-
agent_id = coder_agent.example.id
77
-
use_tmux = true
78
-
ai_provider = "openai"
79
-
ai_model = "4o" # Uses Aider's built-in alias for gpt-4o
80
-
ai_api_key = var.openai_api_key
52
+
source = "registry.coder.com/coder/aider/coder"
53
+
version = "2.0.0"
54
+
agent_id = coder_agent.example.id
55
+
api_key = var.gemini_api_key
56
+
install_aider = true
57
+
workdir = "/home/coder"
58
+
ai_provider = "google"
59
+
model = "gemini"
60
+
install_agentapi = true
61
+
ai_prompt = data.coder_parameter.ai_prompt.value
62
+
system_prompt = "..."
81
63
}
82
64
```
83
65
@@ -93,174 +75,16 @@ variable "custom_api_key" {
93
75
module "aider" {
94
76
count = data.coder_workspace.me.start_count
95
77
source = "registry.coder.com/coder/aider/coder"
96
-
version = "1.1.2"
78
+
version = "2.0.0"
97
79
agent_id = coder_agent.example.id
80
+
workdir = "/home/coder"
98
81
ai_provider = "custom"
99
82
custom_env_var_name = "MY_CUSTOM_API_KEY"
100
-
ai_model = "custom-model"
101
-
ai_api_key = var.custom_api_key
102
-
}
103
-
```
104
-
105
-
### Adding Custom Extensions (Experimental)
106
-
107
-
You can extend Aider's capabilities by adding custom extensions:
108
-
109
-
```tf
110
-
module "aider" {
111
-
count = data.coder_workspace.me.start_count
112
-
source = "registry.coder.com/coder/aider/coder"
113
-
version = "1.1.2"
114
-
agent_id = coder_agent.example.id
115
-
ai_api_key = var.anthropic_api_key
116
-
117
-
experiment_pre_install_script = <<-EOT
118
-
pip install some-custom-dependency
119
-
EOT
120
-
121
-
experiment_additional_extensions = <<-EOT
122
-
custom-extension:
123
-
args: []
124
-
cmd: custom-extension-command
125
-
description: A custom extension for Aider
126
-
enabled: true
127
-
envs: {}
128
-
name: custom-extension
129
-
timeout: 300
130
-
type: stdio
131
-
EOT
132
-
}
133
-
```
134
-
135
-
Note: The indentation in the heredoc is preserved, so you can write the YAML naturally.
136
-
137
-
## Task Reporting (Experimental)
138
-
139
-
> This functionality is in early access as of Coder v2.21 and is still evolving.
140
-
> For now, we recommend testing it in a demo or staging environment,
141
-
> rather than deploying to production
142
-
>
143
-
> Learn more in [the Coder documentation](https://coder.com/docs/tutorials/ai-agents)
144
-
>
145
-
> Join our [Discord channel](https://discord.gg/coder) or
146
-
> [contact us](https://coder.com/contact) to get help or share feedback.
147
-
148
-
Your workspace must have either `screen` or `tmux` installed to use this.
149
-
150
-
Task reporting is **enabled by default** in this module, allowing you to:
151
-
152
-
- Send an initial prompt to Aider during workspace creation
153
-
- Monitor task progress in the Coder UI
154
-
- Use the `coder_parameter` resource to collect prompts from users
155
-
156
-
### Setting up Task Reporting
157
-
158
-
To use task reporting effectively:
159
-
160
-
1. Add the Coder Login module to your template
161
-
2. Configure the necessary variables to pass the task prompt
162
-
3. Optionally add a coder_parameter to collect prompts from users
You are a helpful Coding assistant. Aim to autonomously investigate
200
-
and solve issues the user gives you and test your work, whenever possible.
201
-
Avoid shortcuts like mocking tests. When you get stuck, you can ask the user
202
-
but opt for autonomy.
203
-
YOU MUST REPORT ALL TASKS TO CODER.
204
-
When reporting tasks, you MUST follow these EXACT instructions:
205
-
- IMMEDIATELY report status after receiving ANY user message.
206
-
- Be granular. If you are investigating with multiple steps, report each step to coder.
207
-
Task state MUST be one of the following:
208
-
- Use "state": "working" when actively processing WITHOUT needing additional user input.
209
-
- Use "state": "complete" only when finished with a task.
210
-
- Use "state": "failure" when you need ANY user input, lack sufficient details, or encounter blockers.
211
-
Task summaries MUST:
212
-
- Include specifics about what you're doing.
213
-
- Include clear and actionable steps for the user.
214
-
- Be less than 160 characters in length.
215
-
EOT
83
+
model = "custom-model"
84
+
api_key = var.custom_api_key
216
85
}
217
86
```
218
87
219
-
When a task prompt is provided via the `task_prompt` variable, the module automatically:
220
-
221
-
1. Combines the system prompt with the task prompt into a single message in the format:
222
-
223
-
```
224
-
SYSTEM PROMPT:
225
-
[system_prompt content]
226
-
227
-
This is your current task: [task_prompt]
228
-
```
229
-
230
-
2. Executes the task during workspace creation using the `--message` and `--yes-always` flags
231
-
3. Logs task output to `$HOME/.aider.log` for reference
232
-
233
-
If you want to disable task reporting, set `experiment_report_tasks = false` in your module configuration.
234
-
235
-
## Using Aider in Your Workspace
236
-
237
-
After the workspace starts, Aider will be installed and configured according to your parameters. A persistent session will automatically be started during workspace creation.
238
-
239
-
### Session Options
240
-
241
-
You can run Aider in three different ways:
242
-
243
-
1.**Direct Mode**: Aider starts directly in the specified folder when you click the app button
244
-
245
-
- Simple setup without persistent context
246
-
- Suitable for quick coding sessions
247
-
248
-
2.**Screen Mode** (Default): Run Aider in a screen session that persists across connections
249
-
250
-
- Session name: "aider" (or configured via `session_name`)
251
-
252
-
3.**Tmux Mode**: Run Aider in a tmux session instead of screen
253
-
254
-
- Set `use_tmux = true` to enable
255
-
- Session name: "aider" (or configured via `session_name`)
256
-
- Configures tmux with mouse support for shared sessions
257
-
258
-
Persistent sessions (screen/tmux) allow you to:
259
-
260
-
- Disconnect and reconnect without losing context
261
-
- Run Aider in the background while doing other work
262
-
- Switch between terminal and browser interfaces
263
-
264
88
### Available AI Providers and Models
265
89
266
90
Aider supports various providers and models, and this module integrates directly with Aider's built-in model aliases:
@@ -280,10 +104,12 @@ For a complete and up-to-date list of supported aliases and models, please refer
280
104
281
105
## Troubleshooting
282
106
283
-
If you encounter issues:
107
+
- If `aider` is not found, ensure `install_aider = true` and your API key is valid
108
+
- Logs are written under `/home/coder/.aider-module/` (`install.log`, `agentapi-start.log`) for debugging
109
+
- If AgentAPI fails to start, verify that your container has network access and executable permissions for the scripts
284
110
285
-
1.**Screen/Tmux issues**: If you can't reconnect to your session, check if the session exists with `screen -list` or `tmux list-sessions`
286
-
2.**API key issues**: Ensure you've entered the correct API key for your selected provider
287
-
3.**Browser mode issues**: If the browser interface doesn't open, check that you're accessing it from a machine that can reach your Coder workspace
111
+
## References
288
112
289
-
For more information on using Aider, see the [Aider documentation](https://aider.chat/docs/).
0 commit comments