Skip to main content

Quickstart

Get OpsCode running in your terminal in under five minutes. This guide walks through installing the ops CLI, configuring an LLM provider, running your first infrastructure task in the interactive TUI, and executing non-interactive grading loops in CI/CD.

Read https://www.talkops.ai/docs/agents/opscode/quickstart and help me set up OpsCode with my LLM provider and run my first Terraform validation task.
Platform support

OpsCode runs natively on macOS and Linux. On Windows, run OpsCode inside WSL 2 (Windows Subsystem for Linux).

Prerequisites​

  • Operating system: macOS, Linux, or Windows WSL 2
  • API key: At least one supported LLM provider key (Anthropic, OpenAI, Google Gemini, AWS Bedrock, OpenRouter, or local Ollama)
  • Optional: A Tavily API key (TAVILY_API_KEY) to enable live web_search for provider docs and CVEs

Install and run your first task​

1
Install OpsCode

Run the official install script to download the ops runtime and add it to your PATH:

curl -LsSf https://raw.githubusercontent.com/talkops-ai/opscode/main/scripts/install.sh | bash
2
Launch the interactive TUI

Navigate to any infrastructure repository and start the terminal interface:

ops
3
Configure model provider credentials

Inside the TUI, open the interactive credential manager:

/auth

Select your provider (such as Anthropic, OpenAI, or Google Gemini) and paste your API key. Keys are stored in your OS keychain (macOS Keychain / Linux Secret Service) or ~/.opscode/credentials.json with 0600 permissions. For environment variable setup, see Credentials.

4
Run your first infrastructure task

Enter a prompt in the chat input:

Create a Terraform module for an AWS S3 bucket with KMS encryption, versioning, public access block, and lifecycle rules

OpsCode delegates the task to the aws-terraform-module-writer subagent, generates the module files (main.tf, variables.tf, outputs.tf, versions.tf), presents a syntax-highlighted diff for your approval, and runs terraform validate to verify syntax.

5
Enable LangSmith tracing (optional)

Run /auth and add your LangSmith API key (or set export LANGSMITH_API_KEY="lsv2_..."). Every agent turn, subagent handoff, and MCP tool call is traced automatically on the next session launch.

Interactive mode​

In interactive mode (ops), you converse with the agent in a multi-turn Textual interface while retaining full visibility into tool calls, diffs, and token usage.

Keyboard shortcuts​

ShortcutAction
Shift+TabCycle runtime approval mode (Manual → Auto → YOLO)
EscapeCancel the current streaming response
Ctrl+CInterrupt a running shell command or exit the TUI

Essential slash commands​

CommandWhat it does
/modelSwitch LLM providers or models mid-session without losing context
/effortAdjust reasoning effort (low, medium, high)
/agentsInspect or switch the active domain subagent
/authConfigure LLM provider, Tavily, or LangSmith API keys
/skillsBrowse and invoke discovered SKILL.md playbooks
/memoryView, update, or clear persistent AGENTS.md instructions
/mcpInspect connected MCP servers and discovered tools
/pluginsInstall, update, or remove plugins from marketplaces
/goalDefine a structured goal with tracked acceptance criteria
/rubricAttach or inspect a self-grading rubric
/cost / /contextView session token cost (USD) and context window utilization
/compactSummarize older conversation history to free context capacity
/resumeBrowse and resume previous conversation threads
/doctorRun environment, credential, and MCP health diagnostics

Resume past sessions or target a subagent​

# Resume the most recent conversation thread
ops -r

# Resume a specific thread by ID
ops -r <thread-id>

# Start directly inside a specific domain subagent
ops -a aws-terraform-module-writer

Non-interactive (headless) mode​

Pass -n (--non-interactive) to run single-shot tasks in scripts, git hooks, or CI/CD pipelines:

# Validate all Terraform modules in the current repository
ops -n "Run terraform validate across modules/ and summarize any errors"

# Pipe a manifest via stdin for security auditing
cat deployment.yaml | ops -n "Audit this Kubernetes manifest against Pod Security Standards" --quiet

Headless flags​

FlagWhat it does
-n, --non-interactive <PROMPT>Execute a single task and exit with a deterministic status code
-q, --quietSuppress TUI chrome and progress spinners; emit only the final output for piping
--no-streamBuffer the complete response before printing to stdout
--max-turns <N>Cap the maximum number of agentic reasoning turns
--timeout <SECONDS>Enforce a hard wall-clock timeout for the entire run
--rubric <SPEC_OR_FILE>Grade the agent's output against acceptance criteria (@path/to/rubric.md or inline string)
-y, --yoloAuto-approve tool execution in isolated CI containers

Self-verification with --rubric​

Combine -n with --rubric so OpsCode automatically checks its work before exiting:

ops -n "Create a Kubernetes NetworkPolicy for the payments-api service" \
--rubric "Denies all ingress by default and allows TCP port 8080 only from pods labeled app=api-gateway"

Trace with LangSmith​

Configure LangSmith to inspect subagent delegation trees, prompt caching ratios, and latency waterfalls:

export LANGSMITH_API_KEY="lsv2_pt_..."
export LANGSMITH_PROJECT="opscode-infra-ci"

ops -n "Lint all Helm charts in charts/" --quiet

Use /trace inside an interactive session to verify tracing status at any time.

Next steps​