Harsh Singh Panwar bc39c2ee29
Aider module support agentAPI (#356)
Closes #239

/claim #239

## Description

video :-
https://www.loom.com/share/d1d1d54d48bc45c4a48271ca9a387a88?sid=933e250d-78f8-4a7f-9745-0e908c0ee4d9
<!-- Briefly describe what this PR does and why -->

## Type of Change

- [x] New module
- [ ] Bug fix
- [ ] Feature/enhancement
- [ ] Documentation
- [ ] Other

## Module Information

<!-- Delete this section if not applicable -->

**Path:** `registry/coder/modules/aider`  
**New version:** `v1.0.0`  
**Breaking change:** [ ] Yes [x] No

## Testing & Validation

- [ ] Tests pass (`bun test`)
- [ ] Code formatted (`bun run fmt`)
- [ ] Changes tested locally

## Related Issues

<!-- Link related issues or write "None" if not applicable -->

---------

Co-authored-by: DevCats <christofer@coder.com>
2025-10-24 10:25:40 -05:00

3.8 KiB

display_name description icon verified tags
Aider Run Aider AI pair programming in your workspace ../../../../.icons/aider.svg true
agent
ai
aider

Aider

Run Aider AI pair programming in your workspace. This module installs Aider with AgentAPI for seamless Coder Tasks Support.

variable "api_key" {
  type        = string
  description = "API key"
  sensitive   = true
}

module "aider" {
  source      = "registry.coder.com/coder/aider/coder"
  version     = "2.0.0"
  agent_id    = coder_agent.example.id
  api_key     = var.api_key
  ai_provider = "google"
  model       = "gemini"
}

Prerequisites

  • pipx is automatically installed if not already available

Usage Example

data "coder_parameter" "ai_prompt" {
  name        = "AI Prompt"
  description = "Write an initial prompt for Aider to work on."
  type        = "string"
  default     = ""
  mutable     = true
}

variable "gemini_api_key" {
  type        = string
  description = "Gemini API key"
  sensitive   = true
}

module "aider" {
  source           = "registry.coder.com/coder/aider/coder"
  version          = "2.0.0"
  agent_id         = coder_agent.example.id
  api_key          = var.gemini_api_key
  install_aider    = true
  workdir          = "/home/coder"
  ai_provider      = "google"
  model            = "gemini"
  install_agentapi = true
  ai_prompt        = data.coder_parameter.ai_prompt.value
  system_prompt    = "..."
}

Using a custom provider

variable "custom_api_key" {
  type        = string
  description = "Custom provider API key"
  sensitive   = true
}

module "aider" {
  count               = data.coder_workspace.me.start_count
  source              = "registry.coder.com/coder/aider/coder"
  version             = "2.0.0"
  agent_id            = coder_agent.example.id
  workdir             = "/home/coder"
  ai_provider         = "custom"
  custom_env_var_name = "MY_CUSTOM_API_KEY"
  model               = "custom-model"
  api_key             = var.custom_api_key
}

Available AI Providers and Models

Aider supports various providers and models, and this module integrates directly with Aider's built-in model aliases:

Provider Example Models/Aliases Default Model
anthropic "sonnet" (Claude 3.7 Sonnet), "opus", "haiku" "sonnet"
openai "4o" (GPT-4o), "4" (GPT-4), "3.5-turbo" "4o"
azure Azure OpenAI models "gpt-4"
google "gemini" (Gemini Pro), "gemini-2.5-pro" "gemini-2.5-pro"
cohere "command-r-plus", etc. "command-r-plus"
mistral "mistral-large-latest" "mistral-large-latest"
ollama "llama3", etc. "llama3"
custom Any model name with custom ENV variable -

For a complete and up-to-date list of supported aliases and models, please refer to the Aider LLM documentation and the Aider LLM Leaderboards which show performance comparisons across different models.

Troubleshooting

  • If aider is not found, ensure install_aider = true and your API key is valid
  • Logs are written under /home/coder/.aider-module/ (install.log, agentapi-start.log) for debugging
  • If AgentAPI fails to start, verify that your container has network access and executable permissions for the scripts

References