## Description Update Sourcegraph AMP to Amp CLI as this seems the preferred name. <!-- Briefly describe what this PR does and why --> ## Type of Change - [ ] New module - [ ] Bug fix - [ ] Feature/enhancement - [x] Documentation - [ ] Other ## Module Information <!-- Delete this section if not applicable --> **Path:** `registry/coder-labs/modules/sourcegraph-amp` **New version:** `v1.0.2` **Breaking change:** [ ] Yes [x] No ## Testing & Validation - [x] Tests pass (`bun test`) - [x] Code formatted (`bun run fmt`) - [x] Changes tested locally ## Related Issues <!-- Link related issues or write "None" if not applicable -->
3.2 KiB
3.2 KiB
| display_name | icon | description | verified | tags | |||||
|---|---|---|---|---|---|---|---|---|---|
| Amp CLI | ../../../../.icons/sourcegraph-amp.svg | Sourcegraph's AI coding agent with deep codebase understanding and intelligent code search capabilities | false |
|
Sourcegraph Amp CLI
Run Amp CLI in your workspace to access Sourcegraph's AI-powered code search and analysis tools, with AgentAPI integration for seamless Coder Tasks support.
module "amp-cli" {
source = "registry.coder.com/coder-labs/sourcegraph-amp/coder"
version = "1.0.2"
agent_id = coder_agent.example.id
sourcegraph_amp_api_key = var.sourcegraph_amp_api_key
install_sourcegraph_amp = true
agentapi_version = "latest"
}
Prerequisites
- Include the Coder Login module in your template
- Node.js and npm are automatically installed (via NVM) if not already available
Usage Example
data "coder_parameter" "ai_prompt" {
name = "AI Prompt"
description = "Write an initial prompt for Amp to work on."
type = "string"
default = ""
mutable = true
}
# Set system prompt for Amp CLI via environment variables
resource "coder_agent" "main" {
# ...
env = {
SOURCEGRAPH_AMP_SYSTEM_PROMPT = <<-EOT
You are an Amp assistant that helps developers debug and write code efficiently.
Always log task status to Coder.
EOT
SOURCEGRAPH_AMP_TASK_PROMPT = data.coder_parameter.ai_prompt.value
}
}
variable "sourcegraph_amp_api_key" {
type = string
description = "Sourcegraph Amp API key. Get one at https://ampcode.com/settings"
sensitive = true
}
module "amp-cli" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder-labs/sourcegraph-amp/coder"
version = "1.0.2"
agent_id = coder_agent.example.id
sourcegraph_amp_api_key = var.sourcegraph_amp_api_key # recommended for authenticated usage
install_sourcegraph_amp = true
}
How it Works
- Install: Installs Sourcegraph Amp CLI using npm (installs Node.js via NVM if required)
- Start: Launches Amp CLI in the specified directory, wrapped with AgentAPI to enable tasks and AI interactions
- Environment Variables: Sets
SOURCEGRAPH_AMP_API_KEYandSOURCEGRAPH_AMP_START_DIRECTORYfor the CLI execution
Troubleshooting
- If
ampis not found, ensureinstall_sourcegraph_amp = trueand your API key is valid - Logs are written under
/home/coder/.sourcegraph-amp-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
Important
For using Coder Tasks with Amp CLI, make sure to pass the
AI Promptparameter and setsourcegraph_amp_api_key. This ensures task reporting and status updates work seamlessly.