Skip to content

Commit 639662f

Browse files
docs(aider): update README.md to enhance API integration details
## Changes made - Updated non-interactive mode description to use `task_prompt` variable - Added new parameters for AI provider, model, and API key configuration - Revised usage examples to include OpenAI and custom provider setups - Enhanced task reporting instructions and system prompt customization - Clarified available AI providers and models with default settings
1 parent b8f5166 commit 639662f

File tree

1 file changed

+109
-102
lines changed

1 file changed

+109
-102
lines changed

registry/coder/modules/aider/README.md

Lines changed: 109 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module "aider" {
2727
- **Optional Dependencies**: Install Playwright for web page scraping and PortAudio for voice coding
2828
- **Project Integration**: Works with any project directory, including Git repositories
2929
- **Browser UI**: Use Aider in your browser with a modern web interface instead of the terminal
30-
- **Non-Interactive Mode**: Automatically processes tasks when provided via the `CODER_MCP_AIDER_TASK_PROMPT` environment variable
30+
- **Non-Interactive Mode**: Automatically processes tasks when provided via the `task_prompt` variable
3131

3232
## Module Parameters
3333

@@ -43,7 +43,12 @@ module "aider" {
4343
| `order` | Position of the app in the UI presentation | `number` | `null` |
4444
| `icon` | The icon to use for the app | `string` | `"/icon/aider.svg"` |
4545
| `experiment_report_tasks` | Whether to enable task reporting | `bool` | `true` |
46-
| `experiment_task_conventions` | Custom conventions for task reporting to be written to CONVENTIONS.md | `string` | See default in code |
46+
| `system_prompt` | System prompt for instructing Aider on task reporting and behavior | `string` | See default in code |
47+
| `task_prompt` | Task prompt to use with Aider | `string` | `""` |
48+
| `ai_provider` | AI provider to use with Aider (openai, anthropic, azure, etc.) | `string` | `"anthropic"` |
49+
| `ai_model` | AI model to use (can use Aider's built-in aliases like "sonnet", "4o") | `string` | `"sonnet"` |
50+
| `ai_api_key` | API key for the selected AI provider | `string` | `""` |
51+
| `custom_env_var_name` | Custom environment variable name when using custom provider | `string` | `""` |
4752
| `experiment_pre_install_script` | Custom script to run before installing Aider | `string` | `null` |
4853
| `experiment_post_install_script` | Custom script to run after installing Aider | `string` | `null` |
4954
| `experiment_additional_extensions` | Additional extensions configuration in YAML format to append to the config | `string` | `null` |
@@ -52,75 +57,70 @@ module "aider" {
5257
5358
## Usage Examples
5459

55-
### Basic setup
60+
### Basic setup with API key
5661

5762
```tf
63+
variable "anthropic_api_key" {
64+
type = string
65+
description = "Anthropic API key"
66+
sensitive = true
67+
}
68+
5869
module "aider" {
59-
count = data.coder_workspace.me.start_count
60-
source = "registry.coder.com/modules/aider/coder"
61-
version = "1.0.0"
62-
agent_id = coder_agent.example.id
63-
folder = "/home/coder"
70+
count = data.coder_workspace.me.start_count
71+
source = "registry.coder.com/modules/aider/coder"
72+
version = "1.0.0"
73+
agent_id = coder_agent.example.id
74+
ai_api_key = var.anthropic_api_key
6475
}
6576
```
6677

6778
This basic setup will:
6879

6980
- Install Aider in the workspace
7081
- Create a persistent screen session named "aider"
82+
- Configure Aider to use Anthropic Claude 3.7 Sonnet model
7183
- Enable task reporting (configures Aider to report tasks to Coder MCP)
7284

73-
### With tmux instead of screen
85+
### Using OpenAI with tmux
7486

7587
```tf
88+
variable "openai_api_key" {
89+
type = string
90+
description = "OpenAI API key"
91+
sensitive = true
92+
}
93+
7694
module "aider" {
77-
count = data.coder_workspace.me.start_count
78-
source = "registry.coder.com/modules/aider/coder"
79-
version = "1.0.0"
80-
agent_id = coder_agent.example.id
81-
folder = "/home/coder"
82-
use_tmux = true
95+
count = data.coder_workspace.me.start_count
96+
source = "registry.coder.com/modules/aider/coder"
97+
version = "1.0.0"
98+
agent_id = coder_agent.example.id
99+
use_tmux = true
100+
ai_provider = "openai"
101+
ai_model = "4o" # Uses Aider's built-in alias for gpt-4o
102+
ai_api_key = var.openai_api_key
83103
}
84104
```
85105

86-
### With API key via environment variables
106+
### Using a custom provider
87107

88108
```tf
89-
variable "anthropic_api_key" {
109+
variable "custom_api_key" {
90110
type = string
91-
description = "Anthropic API key"
111+
description = "Custom provider API key"
92112
sensitive = true
93113
}
94114
95-
variable "anthropic_model" {
96-
type = string
97-
description = "Anthropic Model"
98-
default = "sonnet"
99-
}
100-
101-
resource "coder_agent" "main" {
102-
# ...
103-
}
104-
105-
# Set API key and model using coder_env resource
106-
resource "coder_env" "anthropic" {
107-
agent_id = coder_agent.example.id
108-
name = "ANTHROPIC_API_KEY"
109-
value = var.anthropic_api_key
110-
}
111-
112-
resource "coder_env" "aider_model" {
113-
agent_id = coder_agent.example.id
114-
name = "AIDER_MODEL"
115-
value = var.anthropic_model
116-
}
117-
118115
module "aider" {
119-
count = data.coder_workspace.me.start_count
120-
source = "registry.coder.com/modules/aider/coder"
121-
version = "1.0.0"
122-
agent_id = coder_agent.example.id
123-
folder = "/home/coder"
116+
count = data.coder_workspace.me.start_count
117+
source = "registry.coder.com/modules/aider/coder"
118+
version = "1.0.0"
119+
agent_id = coder_agent.example.id
120+
ai_provider = "custom"
121+
custom_env_var_name = "MY_CUSTOM_API_KEY"
122+
ai_model = "custom-model"
123+
ai_api_key = var.custom_api_key
124124
}
125125
```
126126

@@ -130,11 +130,11 @@ You can extend Aider's capabilities by adding custom extensions:
130130

131131
```tf
132132
module "aider" {
133-
count = data.coder_workspace.me.start_count
134-
source = "registry.coder.com/modules/aider/coder"
135-
version = "1.0.0"
136-
agent_id = coder_agent.example.id
137-
folder = "/home/coder"
133+
count = data.coder_workspace.me.start_count
134+
source = "registry.coder.com/modules/aider/coder"
135+
version = "1.0.0"
136+
agent_id = coder_agent.example.id
137+
ai_api_key = var.anthropic_api_key
138138
139139
experiment_pre_install_script = <<-EOT
140140
pip install some-custom-dependency
@@ -180,7 +180,7 @@ Task reporting is **enabled by default** in this module, allowing you to:
180180
To use task reporting effectively:
181181

182182
1. Add the Coder Login module to your template
183-
2. Configure the necessary environment variables to pass the task prompt and status slug
183+
2. Configure the necessary variables to pass the task prompt
184184
3. Optionally add a coder_parameter to collect prompts from users
185185

186186
Here's a complete example:
@@ -199,12 +199,6 @@ variable "anthropic_api_key" {
199199
sensitive = true
200200
}
201201
202-
variable "anthropic_model" {
203-
type = string
204-
description = "Anthropic Model"
205-
default = "sonnet"
206-
}
207-
208202
data "coder_parameter" "ai_prompt" {
209203
type = "string"
210204
name = "AI Prompt"
@@ -214,44 +208,48 @@ data "coder_parameter" "ai_prompt" {
214208
ephemeral = true
215209
}
216210
217-
# Configure environment variables for API key, model and task prompt
218-
resource "coder_env" "anthropic" {
219-
agent_id = coder_agent.example.id
220-
name = "ANTHROPIC_API_KEY"
221-
value = var.anthropic_api_key
222-
}
223-
224-
resource "coder_env" "aider_model" {
225-
agent_id = coder_agent.example.id
226-
name = "AIDER_MODEL"
227-
value = var.anthropic_model
211+
module "aider" {
212+
count = data.coder_workspace.me.start_count
213+
source = "registry.coder.com/modules/aider/coder"
214+
version = "1.0.0"
215+
agent_id = coder_agent.example.id
216+
ai_api_key = var.anthropic_api_key
217+
task_prompt = data.coder_parameter.ai_prompt.value
218+
219+
# Optionally customize the system prompt
220+
system_prompt = <<-EOT
221+
You are a helpful Coding assistant. Aim to autonomously investigate
222+
and solve issues the user gives you and test your work, whenever possible.
223+
Avoid shortcuts like mocking tests. When you get stuck, you can ask the user
224+
but opt for autonomy.
225+
YOU MUST REPORT ALL TASKS TO CODER.
226+
When reporting tasks, you MUST follow these EXACT instructions:
227+
- IMMEDIATELY report status after receiving ANY user message.
228+
- Be granular. If you are investigating with multiple steps, report each step to coder.
229+
Task state MUST be one of the following:
230+
- Use "state": "working" when actively processing WITHOUT needing additional user input.
231+
- Use "state": "complete" only when finished with a task.
232+
- Use "state": "failure" when you need ANY user input, lack sufficient details, or encounter blockers.
233+
Task summaries MUST:
234+
- Include specifics about what you're doing.
235+
- Include clear and actionable steps for the user.
236+
- Be less than 160 characters in length.
237+
EOT
228238
}
239+
```
229240

230-
resource "coder_env" "task_prompt" {
231-
agent_id = coder_agent.example.id
232-
name = "CODER_MCP_AIDER_TASK_PROMPT"
233-
value = data.coder_parameter.ai_prompt.value
234-
}
241+
When a task prompt is provided via the `task_prompt` variable, the module automatically:
235242

236-
resource "coder_env" "app_status" {
237-
agent_id = coder_agent.example.id
238-
name = "CODER_MCP_APP_STATUS_SLUG"
239-
value = "aider"
240-
}
243+
1. Combines the system prompt with the task prompt into a single message in the format:
241244

242-
module "aider" {
243-
count = data.coder_workspace.me.start_count
244-
source = "registry.coder.com/modules/aider/coder"
245-
version = "1.0.0"
246-
agent_id = coder_agent.example.id
247-
folder = "/home/coder"
248-
}
249245
```
246+
SYSTEM PROMPT:
247+
[system_prompt content]
250248
251-
When a task prompt is provided, the module automatically:
249+
This is your current task: [task_prompt]
250+
```
252251

253-
1. Executes the task during workspace creation using the `--message` and `--yes-always` flags
254-
2. Creates a flag file to prevent duplicate execution if the Aider button is clicked later
252+
2. Executes the task during workspace creation using the `--message` and `--yes-always` flags
255253
3. Logs task output to `$HOME/.aider.log` for reference
256254

257255
If you want to disable task reporting, set `experiment_report_tasks = false` in your module configuration.
@@ -266,16 +264,18 @@ You can run Aider in three different ways:
266264

267265
1. **Direct Mode**: Aider starts directly in the specified folder when you click the app button
268266

269-
- Simple setup without persistent context
270-
- Suitable for quick coding sessions
267+
- Simple setup without persistent context
268+
- Suitable for quick coding sessions
271269

272270
2. **Screen Mode** (Default): Run Aider in a screen session that persists across connections
273271

274-
- Session name: "aider" (or configured via `session_name`)
272+
- Session name: "aider" (or configured via `session_name`)
275273

276274
3. **Tmux Mode**: Run Aider in a tmux session instead of screen
277-
- Set `use_tmux = true` to enable
278-
- Session name: "aider" (or configured via `session_name`)
275+
276+
- Set `use_tmux = true` to enable
277+
- Session name: "aider" (or configured via `session_name`)
278+
- Configures tmux with mouse support for shared sessions
279279

280280
Persistent sessions (screen/tmux) allow you to:
281281

@@ -285,15 +285,20 @@ Persistent sessions (screen/tmux) allow you to:
285285

286286
### Available AI Providers and Models
287287

288-
| Provider | Available Models | API Key Source |
289-
| -------------- | ----------------------------------- | ----------------------------------------------------------- |
290-
| **Anthropic** | Claude 3.7 Sonnet, Claude 3.7 Haiku | [console.anthropic.com](https://console.anthropic.com/) |
291-
| **OpenAI** | o3-mini, o1, GPT-4o | [platform.openai.com](https://platform.openai.com/api-keys) |
292-
| **DeepSeek** | DeepSeek R1, DeepSeek Chat V3 | [platform.deepseek.com](https://platform.deepseek.com/) |
293-
| **GROQ** | Mixtral, Llama 3 | [console.groq.com](https://console.groq.com/keys) |
294-
| **OpenRouter** | OpenRouter | [openrouter.ai](https://openrouter.ai/keys) |
288+
Aider supports various providers and models, and this module integrates directly with Aider's built-in model aliases:
289+
290+
| Provider | Example Models/Aliases | Default Model |
291+
| -------------- | ------------------------------------------- | ----------------- |
292+
| **anthropic** | "sonnet" (Claude 3.7 Sonnet), "opus", "haiku" | "sonnet" |
293+
| **openai** | "4o" (GPT-4o), "4" (GPT-4), "3.5-turbo" | "4o" |
294+
| **azure** | Azure OpenAI models | "gpt-4" |
295+
| **google** | "gemini" (Gemini Pro), "gemini-2.5-pro" | "gemini-2.5-pro" |
296+
| **cohere** | "command-r-plus", etc. | "command-r-plus" |
297+
| **mistral** | "mistral-large-latest" | "mistral-large-latest" |
298+
| **ollama** | "llama3", etc. | "llama3" |
299+
| **custom** | Any model name with custom ENV variable | - |
295300

296-
For a complete and up-to-date list of supported LLMs and models, please refer to the [Aider LLM documentation](https://aider.chat/docs/llms.html) and the [Aider LLM Leaderboards](https://aider.chat/docs/leaderboards.html) which show performance comparisons across different models.
301+
For a complete and up-to-date list of supported aliases and models, please refer to the [Aider LLM documentation](https://aider.chat/docs/llms.html) and the [Aider LLM Leaderboards](https://aider.chat/docs/leaderboards.html) which show performance comparisons across different models.
297302

298303
## Troubleshooting
299304

@@ -304,3 +309,5 @@ If you encounter issues:
304309
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
305310

306311
For more information on using Aider, see the [Aider documentation](https://aider.chat/docs/).
312+
313+
```

0 commit comments

Comments
 (0)