Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions registry/coder-labs/modules/sourcegraph-amp/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
display_name: Sourcegraph AMP
display_name: Amp CLI
icon: ../../../../.icons/sourcegraph-amp.svg
description: Sourcegraph's AI coding agent with deep codebase understanding and intelligent code search capabilities
verified: false
tags: [agent, sourcegraph, amp, ai, tasks]
---

# Sourcegraph AMP CLI
# Sourcegraph Amp CLI

Run [Sourcegraph AMP CLI](https://sourcegraph.com/amp) in your workspace to access Sourcegraph's AI-powered code search and analysis tools, with AgentAPI integration for seamless Coder Tasks support.
Run [Amp CLI](https://ampcode.com/) in your workspace to access Sourcegraph's AI-powered code search and analysis tools, with AgentAPI integration for seamless Coder Tasks support.

```tf
module "sourcegraph-amp" {
module "amp-cli" {
source = "registry.coder.com/coder-labs/sourcegraph-amp/coder"
version = "1.0.1"
version = "1.0.2"
agent_id = coder_agent.example.id
sourcegraph_amp_api_key = var.sourcegraph_amp_api_key
install_sourcegraph_amp = true
Expand All @@ -31,19 +31,19 @@ module "sourcegraph-amp" {
```tf
data "coder_parameter" "ai_prompt" {
name = "AI Prompt"
description = "Write an initial prompt for AMP to work on."
description = "Write an initial prompt for Amp to work on."
type = "string"
default = ""
mutable = true

}

# Set system prompt for Sourcegraph Amp via environment variables
# 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.
You are an Amp assistant that helps developers debug and write code efficiently.

Always log task status to Coder.
EOT
Expand All @@ -53,14 +53,14 @@ resource "coder_agent" "main" {

variable "sourcegraph_amp_api_key" {
type = string
description = "Sourcegraph AMP API key"
description = "Sourcegraph Amp API key. Get one at https://ampcode.com/settings"
sensitive = true
}

module "sourcegraph-amp" {
module "amp-cli" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder-labs/sourcegraph-amp/coder"
version = "1.0.1"
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
Expand All @@ -69,8 +69,8 @@ module "sourcegraph-amp" {

## 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
- **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_KEY` and `SOURCEGRAPH_AMP_START_DIRECTORY` for the CLI execution

## Troubleshooting
Expand All @@ -80,11 +80,11 @@ module "sourcegraph-amp" {
- If AgentAPI fails to start, verify that your container has network access and executable permissions for the scripts

> [!IMPORTANT]
> For using **Coder Tasks** with Sourcegraph AMP, make sure to pass the `AI Prompt` parameter and set `sourcegraph_amp_api_key`.
> For using **Coder Tasks** with Amp CLI, make sure to pass the `AI Prompt` parameter and set `sourcegraph_amp_api_key`.
> This ensures task reporting and status updates work seamlessly.

## References

- [Sourcegraph AMP Documentation](https://ampcode.com/manual)
- [Amp CLI Documentation](https://ampcode.com/manual)
- [AgentAPI Documentation](https://github.com/coder/agentapi)
- [Coder AI Agents Guide](https://coder.com/docs/tutorials/ai-agents)