Agent Workflows (Experimental)
What are Agent Workflows?
Section titled “What are Agent Workflows?”Agent workflows let you run .prompt.md files locally through AI runtimes — similar to GitHub Agentic Workflows, but on your machine.
Scripts are defined in apm.yml or auto-discovered from installed packages. You execute them with apm run, passing parameters and choosing a runtime (Copilot CLI, Codex, LLM).
Setting Up a Runtime
Section titled “Setting Up a Runtime”Before running workflows, install at least one AI runtime:
# GitHub Copilot CLI (recommended)apm runtime setup copilot
# OpenAI Codex CLIapm runtime setup codex
# LLM libraryapm runtime setup llmVerify installed runtimes:
apm runtime listRuntime requirements
Section titled “Runtime requirements”| Runtime | Requirements | Notes |
|---|---|---|
| Copilot CLI | Node.js v22+, npm v10+ | Recommended. MCP config at ~/.copilot/ |
| Codex | Node.js | Set GITHUB_TOKEN for GitHub Models support |
| LLM | Python 3.10+ | Supports multiple model providers |
Copilot CLI is the recommended runtime — it requires no API keys for installation and integrates with GitHub Copilot directly.
For Codex, configure authentication after setup:
export GITHUB_TOKEN=your_github_tokenFor LLM, configure at least one model provider:
llm keys set github # GitHub Models (free)llm keys set openai # OpenAIllm keys set anthropic # AnthropicFor more details on runtime capabilities and configuration, see the Runtime Compatibility page.
Defining Scripts
Section titled “Defining Scripts”Explicit scripts in apm.yml
Section titled “Explicit scripts in apm.yml”Define scripts in your apm.yml to map names to prompt files and runtimes:
scripts: start: description: "Default workflow" prompt: .apm/prompts/start.prompt.md runtime: copilot review: description: "Code review" prompt: .apm/prompts/review.prompt.md runtime: copilot analyze: description: "Log analysis" prompt: .apm/prompts/analyze-logs.prompt.md runtime: llmYou can also use the shorthand format for simple scripts:
scripts: start: "copilot --full-auto -p analyze-logs.prompt.md" debug: "RUST_LOG=debug codex analyze-logs.prompt.md" llm-script: "llm analyze-logs.prompt.md -m github/gpt-4o-mini"Auto-discovery (zero configuration)
Section titled “Auto-discovery (zero configuration)”When you install packages that include .prompt.md files, APM auto-discovers them as runnable scripts — no apm.yml configuration needed:
apm install github/awesome-copilot/skills/review-and-refactorapm run review-and-refactor # Works immediatelyAPM searches for prompts in this order:
- Local prompts in the project
.apm/prompts/directory.github/prompts/directory- Installed package dependencies
Use apm list to see all available scripts (both configured and auto-discovered).
Handling name collisions
Section titled “Handling name collisions”If multiple packages provide prompts with the same name, use qualified paths:
apm run github/awesome-copilot/code-review --param pr_url=...apm run acme/standards/code-review --param pr_url=...Running Workflows
Section titled “Running Workflows”Basic execution
Section titled “Basic execution”apm run startPassing parameters
Section titled “Passing parameters”Use --param to pass input values that map to ${input:name} placeholders in prompt files:
apm run start --param service_name=api-gateway --param time_window="1h"apm run code-review --param pull_request_url="https://github.com/org/repo/pull/123"Previewing before running
Section titled “Previewing before running”Preview the compiled prompt (with parameters substituted) without executing it:
apm preview start --param service_name=api-gateway --param time_window="1h"Listing available scripts
Section titled “Listing available scripts”apm listThis shows all scripts — both explicitly defined in apm.yml and auto-discovered from installed packages.
Prompt File Structure
Section titled “Prompt File Structure”Prompt files (.prompt.md) use YAML frontmatter for metadata and Markdown for the prompt body:
---description: Analyzes application logs to identify errors and patternsauthor: DevOps Teammcp: - logs-analyzerinput: - service_name - time_window - log_level---
# Analyze Application Logs
You are an expert DevOps engineer specializing in log analysis.
## Context
- Service: ${input:service_name}- Time window: ${input:time_window}- Log level: ${input:log_level}
## Task
1. Retrieve logs for the specified service2. Identify error patterns and anomalies3. Suggest remediation stepsUse ${input:parameter_name} syntax for dynamic values that are filled in at runtime via --param.
For full details on prompt file syntax, compilation, and dependency management, see the Prompts guide.
Example Workflows
Section titled “Example Workflows”Code review
Section titled “Code review”Install a code review prompt and run it against a pull request:
apm install github/awesome-copilot/skills/review-and-refactor
apm run review-and-refactor \ --param pull_request_url="https://github.com/org/repo/pull/42"Security scan
Section titled “Security scan”Define a security-focused workflow in apm.yml:
scripts: security: description: "Security vulnerability scan" prompt: .apm/prompts/security-scan.prompt.md runtime: copilotThen run it:
apm run security --param target_dir="src/"Multi-runtime setup
Section titled “Multi-runtime setup”Use different runtimes for different tasks:
scripts: review: "copilot --full-auto -p code-review.prompt.md" summarize: "llm summarize.prompt.md -m github/gpt-4o-mini" debug: "RUST_LOG=debug codex debug-analysis.prompt.md"apm run review --param files="src/"apm run summarize --param scope="recent-changes"Troubleshooting
Section titled “Troubleshooting”Runtime not found: Run apm runtime list to verify installation. Re-run apm runtime setup <name> if needed.
Command not found after setup: Ensure the runtime binary is on your PATH. For Copilot CLI, verify Node.js v22+ is installed. For LLM, ensure the Python virtual environment is active.
No scripts available: Run apm list to check. If empty, either define scripts in apm.yml or install a package that includes .prompt.md files.