Skip to content

Commit a775326

Browse files
authored
updated cagent (#40)
Signed-off-by: Derek Misler <derek.misler@docker.com>
1 parent 55cfe03 commit a775326

File tree

8 files changed

+133
-238
lines changed

8 files changed

+133
-238
lines changed

.github/workflows/review-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ on:
5353
description: "Version of cagent to use"
5454
required: false
5555
type: string
56-
default: "v1.20.6"
56+
default: "v1.23.0"
5757
auto-review-org:
5858
description: "Organization to check membership for auto-reviews"
5959
required: false

README.md

Lines changed: 39 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# cagent GitHub Action
22

3-
A GitHub Action for running [cagent](https://github.com/docker/cagent) AI agents in your workflows. This action simplifies the setup and execution of CAgent, handling binary downloads and environment configuration automatically.
3+
A GitHub Action for running [cagent](https://github.com/docker/cagent) AI agents in your workflows. This action simplifies the setup and execution of cagent, handling binary downloads and environment configuration automatically.
44

55
## Quick Start
66

@@ -9,7 +9,7 @@ A GitHub Action for running [cagent](https://github.com/docker/cagent) AI agents
99
```yaml
1010
- uses: docker/cagent-action@latest
1111
with:
12-
agent: docker/code-analyzer
12+
agent: path/to/agent.yaml
1313
prompt: "Analyze this code"
1414
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
1515
```
@@ -37,63 +37,46 @@ See [security/README.md](security/README.md) for complete security documentation
3737

3838
## Usage
3939

40-
### Basic Example
40+
### AI-Powered PR Reviews
4141

42-
```yaml
43-
- name: Run CAgent
44-
uses: docker/cagent-action@latest
45-
with:
46-
agent: docker/github-action-security-scanner
47-
prompt: "Analyze these commits for security vulnerabilities"
48-
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
49-
```
42+
For automated pull request reviews with a multi-agent system, see the [PR Review workflow documentation](review-pr/README.md). The workflow supports:
5043

51-
### Analyzing Code Changes
44+
- Automatic reviews when PRs are opened
45+
- Manual `/review` command in PR comments
46+
- Learning from feedback to improve future reviews
47+
- Customizable review guidelines per language/project
5248

53-
````yaml
54-
name: Code Analysis
49+
**Quick setup:** Add a workflow file that calls our reusable workflow:
50+
51+
```yaml
52+
name: PR Review
5553
on:
56-
pull_request:
57-
types: [opened, synchronize]
54+
issue_comment: # Enables /review command in PR comments
55+
types: [created]
56+
pull_request_review_comment: # Captures feedback on review comments for learning
57+
types: [created]
58+
pull_request_target: # Triggers auto-review on PR open; uses base branch context so secrets work with forks
59+
types: [ready_for_review, opened]
5860
5961
permissions:
6062
contents: read
61-
pull-requests: write
62-
issues: write # For security incident reporting
6363
6464
jobs:
65-
analyze:
66-
runs-on: ubuntu-latest
67-
steps:
68-
- uses: actions/checkout@v4
69-
70-
- name: Get PR diff
71-
id: diff
72-
run: |
73-
gh pr diff ${{ github.event.pull_request.number }} > pr.diff
74-
env:
75-
GH_TOKEN: ${{ github.token }}
76-
77-
- name: Analyze Changes
78-
id: analysis
79-
uses: docker/cagent-action@latest
80-
with:
81-
agent: docker/code-analyzer
82-
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
83-
prompt: |
84-
Analyze these code changes for quality and best practices:
85-
86-
```diff
87-
$(cat pr.diff)
88-
```
65+
review:
66+
uses: docker/cagent-action/.github/workflows/review-pr.yml@latest
67+
# Scoped to the job so other jobs in this workflow aren't over-permissioned
68+
permissions:
69+
contents: read # Read repository files and PR diffs
70+
pull-requests: write # Post review comments and approve/request changes
71+
issues: write # Create security incident issues if secrets are detected in output
72+
secrets:
73+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
74+
CAGENT_ORG_MEMBERSHIP_TOKEN: ${{ secrets.CAGENT_ORG_MEMBERSHIP_TOKEN }} # PAT with read:org scope; gates auto-reviews to org members only
75+
CAGENT_REVIEWER_APP_ID: ${{ secrets.CAGENT_REVIEWER_APP_ID }} # GitHub App ID; reviews appear as your app instead of github-actions[bot]
76+
CAGENT_REVIEWER_APP_PRIVATE_KEY: ${{ secrets.CAGENT_REVIEWER_APP_PRIVATE_KEY }} # GitHub App private key; paired with App ID above
77+
```
8978

90-
- name: Post analysis
91-
run: |
92-
gh pr comment ${{ github.event.pull_request.number }} \
93-
--body-file "${{ steps.analysis.outputs.output-file }}"
94-
env:
95-
GH_TOKEN: ${{ github.token }}
96-
````
79+
See the [full PR Review documentation](review-pr/README.md) for more details.
9780

9881
### Using a Local Agent File
9982

@@ -109,13 +92,13 @@ jobs:
10992
### Advanced Configuration
11093

11194
```yaml
112-
- name: Run CAgent with Custom Settings
95+
- name: Run cagent with Custom Settings
11396
uses: docker/cagent-action@latest
11497
with:
11598
agent: docker/code-analyzer
11699
prompt: "Analyze this codebase"
117100
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
118-
cagent-version: v1.20.6
101+
cagent-version: v1.23.0
119102
mcp-gateway: true # Set to true to install mcp-gateway
120103
mcp-gateway-version: v0.22.0
121104
yolo: false # Require manual approval
@@ -130,7 +113,7 @@ jobs:
130113
### Using Outputs
131114

132115
```yaml
133-
- name: Run CAgent
116+
- name: Run cagent
134117
id: agent
135118
uses: docker/cagent-action@latest
136119
with:
@@ -159,7 +142,7 @@ jobs:
159142
| --------------------- | ------------------------------------------------------------------------------------ | -------- | ------------------------------- |
160143
| `agent` | Agent identifier (e.g., `docker/code-analyzer`) or path to `.yaml` file | Yes | - |
161144
| `prompt` | Prompt to pass to the agent | No | - |
162-
| `cagent-version` | Version of cagent to use | No | `v1.20.6` |
145+
| `cagent-version` | Version of cagent to use | No | `v1.23.0` |
163146
| `mcp-gateway` | Install mcp-gateway (`true`/`false`) | No | `false` |
164147
| `mcp-gateway-version` | Version of mcp-gateway to use (specifying this will enable mcp-gateway installation) | No | `v0.22.0` |
165148
| `anthropic-api-key` | Anthropic API key for Claude models (at least one API key required) | No* | - |
@@ -277,59 +260,9 @@ jobs:
277260
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
278261
```
279262

280-
### PR Review Workflow (Reusable)
281-
282-
This repo provides a **reusable workflow** at `.github/workflows/review-pr.yml` that adds AI-powered PR reviews to any repository. It supports automatic reviews on PR open, manual `/review` comments, and feedback learning.
283-
284-
#### Setup (Explicit Secrets — No `secrets: inherit`)
285-
286-
This is the security-team-friendly approach. Only the secrets the workflow needs are passed explicitly — nothing else from your repository leaks across the boundary:
287-
288-
```yaml
289-
name: PR Review
290-
on:
291-
issue_comment: # Enables /review command in PR comments
292-
types: [created]
293-
pull_request_review_comment: # Captures feedback on review comments for learning
294-
types: [created]
295-
pull_request_target: # Triggers auto-review on PR open; uses base branch context so secrets work with forks
296-
types: [ready_for_review, opened]
297-
298-
jobs:
299-
review:
300-
uses: docker/cagent-action/.github/workflows/review-pr.yml@latest
301-
# Scoped to the job so other jobs in this workflow aren't over-permissioned
302-
permissions:
303-
contents: read # Read repository files and PR diffs
304-
pull-requests: write # Post review comments and approve/request changes
305-
issues: write # Create security incident issues if secrets are detected in output
306-
secrets:
307-
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
308-
CAGENT_ORG_MEMBERSHIP_TOKEN: ${{ secrets.CAGENT_ORG_MEMBERSHIP_TOKEN }} # PAT with read:org scope; gates auto-reviews to org members only
309-
CAGENT_REVIEWER_APP_ID: ${{ secrets.CAGENT_REVIEWER_APP_ID }} # GitHub App ID; reviews appear as your app instead of github-actions[bot]
310-
CAGENT_REVIEWER_APP_PRIVATE_KEY: ${{ secrets.CAGENT_REVIEWER_APP_PRIVATE_KEY }} # GitHub App private key; paired with App ID above
311-
```
312-
313-
> **Why not `secrets: inherit`?** Using explicit secrets follows the principle of least privilege — the called workflow only receives the secrets it actually needs, not every secret in your repository. This is the recommended approach for public repos and security-conscious teams.
314-
315-
If you use a different LLM provider, replace `ANTHROPIC_API_KEY` with the appropriate secret (e.g., `OPENAI_API_KEY`, `GOOGLE_API_KEY`). See the full list in the secrets reference below.
316-
317-
#### Reusable Workflow Secrets Reference
318-
319-
| Secret | Required | Description |
320-
| ------ | -------- | ----------- |
321-
| `ANTHROPIC_API_KEY` | Yes* | Anthropic API key (or any one LLM key below) |
322-
| `OPENAI_API_KEY` | No* | OpenAI API key |
323-
| `GOOGLE_API_KEY` | No* | Google Gemini API key |
324-
| `AWS_BEARER_TOKEN_BEDROCK` | No* | AWS Bedrock bearer token |
325-
| `XAI_API_KEY` | No* | xAI Grok API key |
326-
| `NEBIUS_API_KEY` | No* | Nebius API key |
327-
| `MISTRAL_API_KEY` | No* | Mistral API key |
328-
| `CAGENT_ORG_MEMBERSHIP_TOKEN` | No | Classic PAT with `read:org` scope for auto-review gating |
329-
| `CAGENT_REVIEWER_APP_ID` | No | GitHub App ID for custom reviewer identity |
330-
| `CAGENT_REVIEWER_APP_PRIVATE_KEY` | No | GitHub App private key (paired with App ID) |
263+
### PR Review Workflow
331264

332-
_*At least one LLM API key is required._
265+
For comprehensive documentation on setting up AI-powered PR reviews, including features like automatic reviews, the `/review` command, feedback learning, and customization options, see the **[PR Review documentation](review-pr/README.md)**.
333266

334267
### Manual Trigger with Inputs
335268

@@ -384,5 +317,5 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
384317

385318
## Links
386319

387-
- [CAgent Repository](https://github.com/docker/cagent)
320+
- [cagent Repository](https://github.com/docker/cagent)
388321
- [MCP Gateway Repository](https://github.com/docker/mcp-gateway)

action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: "CAgent Runner"
2-
description: "Run a CAgent AI agent with a single line"
1+
name: "cagent Runner"
2+
description: "Run a cagent AI agent with a single line"
33
author: "Docker"
44
branding:
55
icon: "cpu"
@@ -15,7 +15,7 @@ inputs:
1515
cagent-version:
1616
description: "Version of cagent to use"
1717
required: false
18-
default: "v1.20.6"
18+
default: "v1.23.0"
1919
mcp-gateway:
2020
description: "Install mcp-gateway (true/false)"
2121
required: false
@@ -402,7 +402,7 @@ runs:
402402
echo "cagent-version=$CAGENT_VERSION" >> $GITHUB_OUTPUT
403403
echo "mcp-installed=$MCP_INSTALLED" >> $GITHUB_OUTPUT
404404
405-
- name: Run CAgent
405+
- name: Run cagent
406406
id: run-agent
407407
shell: bash
408408
env:
@@ -536,14 +536,14 @@ runs:
536536
537537
# Create job summary
538538
{
539-
echo "## CAgent Execution Summary"
539+
echo "## cagent Execution Summary"
540540
echo ""
541541
echo "| Property | Value |"
542542
echo "|----------|-------|"
543543
echo "| Agent | \`$AGENT\` |"
544544
echo "| Exit Code | $EXIT_CODE |"
545545
echo "| Execution Time | ${EXECUTION_TIME}s |"
546-
echo "| CAgent Version | $CAGENT_VERSION |"
546+
echo "| cagent Version | $CAGENT_VERSION |"
547547
echo "| MCP Gateway | $MCP_INSTALLED |"
548548
if [ "$TIMEOUT" != "0" ]; then
549549
echo "| Timeout | ${TIMEOUT}s |"

examples/code-analysis.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)