@action-llama/action-llama 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +141 -332
- package/dist/agents/container-entry.js +2 -2
- package/dist/agents/container-entry.js.map +1 -1
- package/dist/agents/container-runner.d.ts +2 -2
- package/dist/agents/container-runner.d.ts.map +1 -1
- package/dist/agents/container-runner.js +4 -4
- package/dist/agents/container-runner.js.map +1 -1
- package/dist/agents/prompt.js +1 -1
- package/dist/agents/prompt.js.map +1 -1
- package/dist/agents/runner.js +2 -2
- package/dist/agents/runner.js.map +1 -1
- package/dist/cli/commands/agent/add.js +2 -2
- package/dist/cli/commands/agent/add.js.map +1 -1
- package/dist/cli/commands/{init.d.ts → new.d.ts} +1 -1
- package/dist/cli/commands/new.d.ts.map +1 -0
- package/dist/cli/commands/{init.js → new.js} +2 -2
- package/dist/cli/commands/new.js.map +1 -0
- package/dist/cli/commands/start.js +3 -3
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/main.js +2 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/docker/container.d.ts +1 -1
- package/dist/docker/container.d.ts.map +1 -1
- package/dist/docker/container.js +1 -1
- package/dist/docker/container.js.map +1 -1
- package/dist/{broker → gateway}/index.d.ts +3 -3
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/{broker → gateway}/index.js +5 -5
- package/dist/gateway/index.js.map +1 -0
- package/dist/gateway/router.d.ts.map +1 -0
- package/dist/gateway/router.js.map +1 -0
- package/dist/gateway/routes/shutdown.d.ts.map +1 -0
- package/dist/gateway/routes/shutdown.js.map +1 -0
- package/dist/gateway/routes/webhooks.d.ts.map +1 -0
- package/dist/gateway/routes/webhooks.js.map +1 -0
- package/dist/scheduler/index.d.ts +2 -2
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +26 -26
- package/dist/scheduler/index.js.map +1 -1
- package/dist/setup/prompts.js +1 -1
- package/dist/setup/prompts.js.map +1 -1
- package/dist/shared/config.d.ts +2 -2
- package/dist/shared/config.d.ts.map +1 -1
- package/dist/shared/config.js +7 -1
- package/dist/shared/config.js.map +1 -1
- package/dist/shared/credentials.js +1 -1
- package/dist/shared/credentials.js.map +1 -1
- package/dist/tui/App.js +1 -1
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/status-tracker.d.ts +1 -1
- package/dist/tui/status-tracker.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/broker/index.d.ts.map +0 -1
- package/dist/broker/index.js.map +0 -1
- package/dist/broker/router.d.ts.map +0 -1
- package/dist/broker/router.js.map +0 -1
- package/dist/broker/routes/shutdown.d.ts.map +0 -1
- package/dist/broker/routes/shutdown.js.map +0 -1
- package/dist/broker/routes/webhooks.d.ts.map +0 -1
- package/dist/broker/routes/webhooks.js.map +0 -1
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js.map +0 -1
- /package/dist/{broker → gateway}/router.d.ts +0 -0
- /package/dist/{broker → gateway}/router.js +0 -0
- /package/dist/{broker → gateway}/routes/shutdown.d.ts +0 -0
- /package/dist/{broker → gateway}/routes/shutdown.js +0 -0
- /package/dist/{broker → gateway}/routes/webhooks.d.ts +0 -0
- /package/dist/{broker → gateway}/routes/webhooks.js +0 -0
package/README.md
CHANGED
|
@@ -4,251 +4,136 @@
|
|
|
4
4
|
|
|
5
5
|
# Action Llama
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run agents like scripts: triggered by cron or webhooks.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Dev Experience:
|
|
10
10
|
|
|
11
11
|
1. Either a webhook or cron wakes up the agent
|
|
12
12
|
2. The agent runs according the instructions in AGENTS.md you define
|
|
13
13
|
3. The agent shuts down
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Key features:
|
|
16
16
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
17
|
+
- Agent runs are contained in a Docker container using only the credentials they need. Credentials are stored separately.
|
|
18
|
+
- Define your agents in a git repo, add custom ones, and share them.
|
|
19
|
+
- BYOM: bring your own model.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
Philosophy:
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
- AL is a thin wrapper around Claude or GPT. The models move so quickly, it's important to minimize the harness.
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
# 1. Create a new Action Llama project
|
|
26
|
-
npx create-action-llama my-project
|
|
25
|
+
Use cases:
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
- A developer agent that watches for new Github issues and reacts
|
|
28
|
+
- A reviewer agent that watches for new Github Pull Requests and reviews them then merges if all ok
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
cd my-project
|
|
33
|
-
al start
|
|
34
|
-
```
|
|
30
|
+
Have as many agents as you like. Customize the behaviour as you wish. The system is MIT licensed and fully extensible.
|
|
35
31
|
|
|
36
32
|
Built on [pi.dev](https://github.com/badlogic/pi-mono) as the agent harness.
|
|
37
33
|
|
|
38
|
-
##
|
|
39
|
-
|
|
40
|
-
The project includes a few default agents to get you started
|
|
34
|
+
## How to get started
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
| **PR Reviewer** | Webhook: PR opened/updated; or poll for open PRs | Reviews code for correctness, style, security; approves+merges or requests changes |
|
|
46
|
-
| **DevOps** | Poll for CI failures/Sentry errors | Creates Github issues describing problem and potential fix |
|
|
36
|
+
```bash
|
|
37
|
+
npx @action-llama/action-llama@latest new my-project
|
|
38
|
+
```
|
|
47
39
|
|
|
48
|
-
|
|
40
|
+
The setup wizard walks you through everything:
|
|
49
41
|
|
|
50
|
-
|
|
51
|
-
- Git
|
|
52
|
-
- Docker
|
|
53
|
-
- A GitHub Personal Access Token with `repo` and `workflow` scopes
|
|
54
|
-
- Anthropic auth — one of:
|
|
55
|
-
- Existing pi auth (`pi /login`) or Claude Code auth (`claude setup-token`)
|
|
56
|
-
- An Anthropic API key (`sk-ant-api...`)
|
|
57
|
-
- An OAuth token (`sk-ant-oat...`)
|
|
58
|
-
- (Optional) A Sentry auth token
|
|
59
|
-
- (Optional) A GitHub webhook secret (for webhook-triggered agents)
|
|
42
|
+
**Step 1 — Agents:** Select which agents to create. Pick **dev** to start — this is the developer agent that implements issues and opens PRs.
|
|
60
43
|
|
|
61
|
-
|
|
44
|
+
**Step 2 — Credentials:** Paste your GitHub PAT (needs `repo` + `workflow` scopes) and choose how to authenticate with Anthropic (existing pi auth, API key, or OAuth token). Tokens are validated against their APIs before continuing.
|
|
62
45
|
|
|
63
|
-
|
|
64
|
-
npx @action-llama/action-llama init my-project
|
|
65
|
-
cd my-project
|
|
66
|
-
```
|
|
46
|
+
**Step 3 — LLM Defaults:** Pick a model and thinking level. The defaults (`claude-sonnet-4-20250514`, `medium` thinking) are a good starting point.
|
|
67
47
|
|
|
68
|
-
|
|
48
|
+
**Step 4 — Configure each agent:** For the dev agent you'll be asked:
|
|
49
|
+
- **Repos** — which GitHub repos to monitor (fetched from your token)
|
|
50
|
+
- **Trigger label** — the issue label that activates the agent (default: `agent`)
|
|
51
|
+
- **Assignee** — only trigger on issues assigned to this user (default: your GitHub username)
|
|
52
|
+
- **Webhooks** — say **no** for now (requires setting up a GitHub webhook endpoint)
|
|
53
|
+
- **Schedule** — say **yes**, and accept the default `*/5 * * * *` (poll every 5 minutes)
|
|
69
54
|
|
|
70
|
-
|
|
55
|
+
Once setup finishes:
|
|
71
56
|
|
|
72
57
|
```bash
|
|
73
|
-
# 1. Initialize a project (interactive setup)
|
|
74
|
-
npx @action-llama/action-llama init my-project
|
|
75
|
-
|
|
76
|
-
# 2. Start the agents
|
|
77
58
|
cd my-project
|
|
78
|
-
al start
|
|
59
|
+
npx al start # if using local install
|
|
79
60
|
```
|
|
80
61
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Action Llama separates three concerns:
|
|
62
|
+
The dev agent will poll every 5 minutes looking for issues that match its filter: the issue must have the trigger label (default: `agent`) **and** be assigned to the configured user. When it finds a match, it clones the repo, creates a branch, implements the changes described in the issue, runs tests, and opens a PR.
|
|
84
63
|
|
|
85
|
-
|
|
86
|
-
|-----------|---------|------------|
|
|
87
|
-
| `~/.action-llama-credentials/` | Secrets (shared across projects) | `al init` |
|
|
88
|
-
| `./<project-name>/` | Per-project config, agent instructions, scratch space | `al init` |
|
|
64
|
+
Edit `dev/AGENTS.md` to customize how the agent works — changes take effect on the next run.
|
|
89
65
|
|
|
90
|
-
|
|
66
|
+
### Project structure
|
|
91
67
|
|
|
92
|
-
|
|
68
|
+
The setup creates:
|
|
93
69
|
|
|
94
|
-
The setup CLI (`al init <name>`) walks through three steps:
|
|
95
|
-
|
|
96
|
-
### Step 1: Credentials
|
|
97
|
-
- Paste your GitHub PAT
|
|
98
|
-
- (Optional) Paste your Sentry auth token
|
|
99
|
-
- Choose your Anthropic authentication method:
|
|
100
|
-
- **Use existing pi auth** — if you already ran `pi /login` or `claude setup-token`
|
|
101
|
-
- **Enter an API key** — a standard `sk-ant-api...` key, validated against the API
|
|
102
|
-
- **Enter an OAuth token** — a `sk-ant-oat...` token from `claude setup-token`, format-checked
|
|
103
|
-
|
|
104
|
-
### Step 2: LLM defaults
|
|
105
|
-
- Select a model (default: `claude-sonnet-4-20250514`)
|
|
106
|
-
- Select thinking level (default: `medium`)
|
|
107
|
-
|
|
108
|
-
### Step 3: Agents
|
|
109
|
-
- Select which built-in agents to enable (dev, reviewer, devops) and/or add custom agents
|
|
110
|
-
- For each agent, configure:
|
|
111
|
-
- **Name** (allows multiple instances, e.g., `dev-frontend`, `dev-backend`)
|
|
112
|
-
- **Repos** to monitor
|
|
113
|
-
- Type-specific options: trigger label / assignee (dev), Sentry org / projects (devops)
|
|
114
|
-
- **Webhooks** — listen for GitHub events (default webhook filter per agent type)
|
|
115
|
-
- **Schedule** — poll on a cron interval (optional if webhooks are enabled)
|
|
116
|
-
- If any agent uses webhooks, you'll be asked for a **GitHub webhook secret** (used to verify `x-hub-signature-256` on incoming payloads)
|
|
117
|
-
|
|
118
|
-
## Running
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
# Start all agents (host mode, default)
|
|
122
|
-
al start
|
|
123
|
-
|
|
124
|
-
# Check agent status
|
|
125
|
-
al status
|
|
126
70
|
```
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
# Requires Docker installed and running
|
|
136
|
-
# Enable in config.json: "docker": { "enabled": true }
|
|
137
|
-
al start
|
|
71
|
+
my-project/
|
|
72
|
+
package.json # Includes @action-llama/action-llama as a dependency
|
|
73
|
+
config.json # Global config: docker, gateway, webhooks (no secrets)
|
|
74
|
+
dev/ # One directory per agent
|
|
75
|
+
config.json # Agent config: repos, schedule, model, webhooks, etc.
|
|
76
|
+
AGENTS.md # Agent instructions — edit this to customize behavior
|
|
138
77
|
```
|
|
139
78
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
### Logs
|
|
143
|
-
|
|
144
|
-
Structured JSON logs are written to daily files at `<project>/.al/logs/<agent>-<YYYY-MM-DD>.log` and also printed to stdout. In Docker mode, container logs are forwarded through the same pino logger — tool events and errors all appear in the standard log files.
|
|
79
|
+
Credentials are stored separately in `~/.action-llama-credentials/` (shared across projects, not committed to git).
|
|
145
80
|
|
|
146
81
|
## CLI commands
|
|
147
82
|
|
|
83
|
+
If you installed globally (`npm install -g @action-llama/action-llama`), you can use `al` directly. Otherwise, prefix commands with `npx` (e.g., `npx al start`).
|
|
84
|
+
|
|
148
85
|
| Command | Description |
|
|
149
86
|
|---------|-------------|
|
|
150
|
-
| `
|
|
151
|
-
| `al start` | Start scheduler
|
|
152
|
-
| `al status` | Show
|
|
153
|
-
| `al logs
|
|
154
|
-
| `al agent add` | Add a new agent to an existing project |
|
|
155
|
-
|
|
156
|
-
## Using the developer agent
|
|
157
|
-
|
|
158
|
-
1. Create an issue in one of your monitored repos
|
|
159
|
-
2. Add the trigger label (default: `agent`) and assign it to the configured user
|
|
160
|
-
3. The developer agent wakes (immediately via webhook, or on the next poll) and will:
|
|
161
|
-
- Find the issue via `gh issue list`
|
|
162
|
-
- Clone the repo and create a branch
|
|
163
|
-
- Read `AGENTS.md`/`CLAUDE.md` for project conventions
|
|
164
|
-
- Implement the changes, run tests
|
|
165
|
-
- Push and open a PR via `gh pr create`
|
|
166
|
-
|
|
167
|
-
## Using the PR reviewer agent
|
|
168
|
-
|
|
169
|
-
The reviewer automatically picks up open PRs on each poll. It:
|
|
170
|
-
- Gets the diff via `gh pr diff`, checks CI status
|
|
171
|
-
- Reviews for correctness, style, tests, and security
|
|
172
|
-
- Approves and squash-merges clean PRs with green CI
|
|
173
|
-
- Requests changes with specific feedback on problematic PRs
|
|
174
|
-
- Skips PRs it has already reviewed at the same commit SHA
|
|
87
|
+
| `al new <name>` | Create a new project (interactive setup for credentials, model, and agents) |
|
|
88
|
+
| `al start` | Start the scheduler — runs agents on their cron schedule and/or webhook triggers |
|
|
89
|
+
| `al status` | Show the current status of all agents |
|
|
90
|
+
| `al logs <agent>` | View log entries for an agent |
|
|
91
|
+
| `al agent add [definition]` | Add a new agent to an existing project (built-in name or custom definition path) |
|
|
175
92
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
The DevOps agent monitors for failures:
|
|
179
|
-
- **GitHub Actions**: finds failed workflow runs via `gh run list`
|
|
180
|
-
- **Sentry**: finds new unresolved error groups via `curl` to the Sentry API (if configured)
|
|
181
|
-
|
|
182
|
-
For each new error, it creates a GitHub issue with the error details and a link to the source. Errors are deduplicated by fingerprint so the same failure is never filed twice.
|
|
183
|
-
|
|
184
|
-
## Project structure
|
|
185
|
-
|
|
186
|
-
```
|
|
187
|
-
~/.action-llama-credentials/ # Secrets (shared across projects)
|
|
188
|
-
github-token
|
|
189
|
-
sentry-token # (optional)
|
|
190
|
-
anthropic-key # (optional, if not using pi_auth)
|
|
191
|
-
github-webhook-secret # (optional, for webhook-triggered agents)
|
|
192
|
-
|
|
193
|
-
./<project-name>/ # Per-project (created by npx @action-llama/action-llama init)
|
|
194
|
-
package.json # Includes @action-llama/action-llama as a dependency
|
|
195
|
-
config.json # Global config: docker, broker, webhooks (no secrets)
|
|
196
|
-
dev/ # Agent directory (CWD for agent sessions)
|
|
197
|
-
config.json # Agent config: repos, webhooks, schedule, prompt, etc.
|
|
198
|
-
AGENTS.md # Instructions (written during init, edit to customize)
|
|
199
|
-
dev-backend/ # Multiple instances are supported
|
|
200
|
-
config.json
|
|
201
|
-
AGENTS.md
|
|
202
|
-
reviewer/
|
|
203
|
-
config.json
|
|
204
|
-
AGENTS.md
|
|
205
|
-
devops/
|
|
206
|
-
config.json
|
|
207
|
-
AGENTS.md
|
|
208
|
-
node_modules/ # Dependencies (after npm install)
|
|
209
|
-
.workspace/ # Git clones and worktrees (gitignored)
|
|
210
|
-
.al/
|
|
211
|
-
state/{dev,dev-backend,...}/ # Dedup/tracking state per agent
|
|
212
|
-
logs/ # Structured logs
|
|
213
|
-
```
|
|
93
|
+
### Common options
|
|
214
94
|
|
|
215
|
-
|
|
95
|
+
- `-p, --project <dir>` — specify the project directory (defaults to `.`)
|
|
216
96
|
|
|
217
|
-
###
|
|
97
|
+
### `al logs` options
|
|
218
98
|
|
|
219
|
-
|
|
99
|
+
- `-n, --lines <N>` — number of log entries to show (default: 50)
|
|
100
|
+
- `-f, --follow` — tail mode, watch for new log entries
|
|
101
|
+
- `-d, --date <YYYY-MM-DD>` — view a specific date's log file
|
|
220
102
|
|
|
221
|
-
|
|
222
|
-
2. The runner injects credentials as environment variables (`GITHUB_TOKEN`, etc.) — agents never see raw credential files
|
|
223
|
-
3. Agents use standard tools (`gh` CLI, `git`, `curl`) which read credentials from env vars
|
|
224
|
-
4. Agents have no extensions loaded (`noExtensions: true`) — only bash, read, edit, write tools for working in worktrees
|
|
225
|
-
5. Anti-exfiltration policy is injected into agent prompts — agents are instructed to never output credentials in logs, comments, or PRs
|
|
103
|
+
### `al start` options
|
|
226
104
|
|
|
227
|
-
|
|
105
|
+
- `--dangerous-no-docker` — disable Docker container isolation and run agents directly on the host
|
|
228
106
|
|
|
229
|
-
|
|
107
|
+
## Built-in Agents
|
|
230
108
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
109
|
+
| Agent | Trigger | Action |
|
|
110
|
+
|-------|---------|--------|
|
|
111
|
+
| **Developer** | Webhook: issue labeled; or poll for labeled issues | Checks out a worktree, implements the fix/feature, runs tests, opens a PR |
|
|
112
|
+
| **PR Reviewer** | Webhook: PR opened/updated; or poll for open PRs | Reviews code for correctness, style, security; approves+merges or requests changes |
|
|
113
|
+
| **DevOps** | Poll for CI failures/Sentry errors | Creates Github issues describing problem and potential fix |
|
|
236
114
|
|
|
237
115
|
## Configuration
|
|
238
116
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
**`<project>/config.json`** — global settings (Docker, broker, webhooks):
|
|
117
|
+
### Global config (`config.json`)
|
|
242
118
|
|
|
243
119
|
```json
|
|
244
120
|
{
|
|
245
121
|
"docker": { "enabled": false },
|
|
246
|
-
"
|
|
122
|
+
"gateway": { "port": 8080 },
|
|
247
123
|
"webhooks": { "githubSecretCredential": "github-webhook-secret" }
|
|
248
124
|
}
|
|
249
125
|
```
|
|
250
126
|
|
|
251
|
-
|
|
127
|
+
| Key | Default | Description |
|
|
128
|
+
|-----|---------|-------------|
|
|
129
|
+
| `docker.enabled` | `false` | Run agents in isolated Docker containers |
|
|
130
|
+
| `docker.image` | `"al-agent:latest"` | Docker image for containers |
|
|
131
|
+
| `docker.memory` | `"4g"` | Memory limit per container |
|
|
132
|
+
| `docker.cpus` | `2` | CPU limit per container |
|
|
133
|
+
| `docker.timeout` | `3600` | Max container runtime (seconds) |
|
|
134
|
+
| `gateway.port` | `8080` | Gateway server listen port |
|
|
135
|
+
|
|
136
|
+
### Agent config (`<agent>/config.json`)
|
|
252
137
|
|
|
253
138
|
```json
|
|
254
139
|
{
|
|
@@ -256,12 +141,10 @@ Config is split between a global `config.json` and per-agent `config.json` files
|
|
|
256
141
|
"model": { "provider": "anthropic", "model": "claude-sonnet-4-20250514", "thinkingLevel": "medium", "authType": "pi_auth" },
|
|
257
142
|
"prompt": "An issue was just assigned to you. Implement the changes described in the issue.",
|
|
258
143
|
"repos": ["acme/frontend"],
|
|
259
|
-
"
|
|
260
|
-
"assignee": "bot-user",
|
|
144
|
+
"schedule": "*/5 * * * *",
|
|
261
145
|
"webhooks": {
|
|
262
146
|
"filters": [{
|
|
263
147
|
"source": "github",
|
|
264
|
-
"repos": ["acme/frontend"],
|
|
265
148
|
"events": ["issues"],
|
|
266
149
|
"actions": ["labeled"],
|
|
267
150
|
"labels": ["agent"],
|
|
@@ -271,189 +154,115 @@ Config is split between a global `config.json` and per-agent `config.json` files
|
|
|
271
154
|
}
|
|
272
155
|
```
|
|
273
156
|
|
|
274
|
-
Agents can use webhooks, a cron schedule, or both.
|
|
275
|
-
|
|
276
|
-
Edit these files directly to change triggers, add repos, or switch models. Re-run `al init` for a guided reconfiguration.
|
|
277
|
-
|
|
278
|
-
### Docker config options
|
|
279
|
-
|
|
280
|
-
| Key | Default | Description |
|
|
281
|
-
|-----|---------|-------------|
|
|
282
|
-
| `docker.enabled` | `false` | Enable Docker container mode |
|
|
283
|
-
| `docker.image` | `"al-agent:latest"` | Docker image for agent containers |
|
|
284
|
-
| `docker.memory` | `"4g"` | Memory limit per container |
|
|
285
|
-
| `docker.cpus` | `2` | CPU limit per container |
|
|
286
|
-
| `docker.timeout` | `3600` | Max container runtime in seconds |
|
|
287
|
-
| `broker.port` | `8080` | Broker server listen port |
|
|
288
|
-
| `webhooks.githubSecretCredential` | `"github-webhook-secret"` | Credential name for the GitHub webhook HMAC secret |
|
|
289
|
-
|
|
290
|
-
## Webhooks
|
|
291
|
-
|
|
292
|
-
Agents can be triggered by GitHub webhooks for real-time responses instead of (or in addition to) polling. The setup wizard configures default webhook filters per agent type:
|
|
293
|
-
|
|
294
|
-
| Agent | Default filter |
|
|
295
|
-
|-------|---------------|
|
|
296
|
-
| **Developer** | `issues` event, `labeled` action, matching trigger label + assignee |
|
|
297
|
-
| **PR Reviewer** | `pull_request` event, `opened` / `synchronize` actions |
|
|
298
|
-
| **DevOps** | `workflow_run` event, `completed` action |
|
|
299
|
-
|
|
300
|
-
### Setting up the GitHub webhook
|
|
301
|
-
|
|
302
|
-
1. Run `al init` and enable webhooks for your agents — the wizard will ask for a webhook secret
|
|
303
|
-
2. In your GitHub repo (or org) settings, add a webhook:
|
|
304
|
-
- **Payload URL**: `http://<your-host>:8080/webhooks/github`
|
|
305
|
-
- **Content type**: `application/json`
|
|
306
|
-
- **Secret**: the same secret you entered during `al init`
|
|
307
|
-
- **Events**: select the events your agents listen for (or "Send me everything")
|
|
308
|
-
3. Start AL — the broker server listens for incoming webhooks automatically
|
|
157
|
+
Agents can use webhooks, a cron schedule, or both. Each agent carries its own model config, so you can run different models per agent (e.g., Opus for dev, Haiku for devops). Edit these files directly or re-run `al new` for guided reconfiguration.
|
|
309
158
|
|
|
310
|
-
|
|
159
|
+
### Webhooks
|
|
311
160
|
|
|
312
|
-
|
|
161
|
+
To use webhooks instead of polling, enable them during `al new` and add a webhook in your GitHub repo settings:
|
|
313
162
|
|
|
314
|
-
|
|
163
|
+
- **Payload URL**: `http://<your-host>:8080/webhooks/github`
|
|
164
|
+
- **Content type**: `application/json`
|
|
165
|
+
- **Secret**: the same secret you entered during setup
|
|
315
166
|
|
|
316
|
-
|
|
317
|
-
|-------|------|-------------|
|
|
318
|
-
| `source` | `"github"` | Required — the webhook source |
|
|
319
|
-
| `repos` | `string[]` | Only match events from these repos |
|
|
320
|
-
| `events` | `string[]` | GitHub event types (`issues`, `pull_request`, `push`, etc.) |
|
|
321
|
-
| `actions` | `string[]` | Event actions (`opened`, `labeled`, `synchronize`, etc.) |
|
|
322
|
-
| `labels` | `string[]` | Match if the issue/PR has any of these labels |
|
|
323
|
-
| `assignee` | `string` | Match if assigned to this user |
|
|
324
|
-
| `author` | `string` | Match if authored by this user |
|
|
325
|
-
| `branches` | `string[]` | Match if targeting one of these branches |
|
|
167
|
+
Payloads are validated with HMAC-SHA256 (`x-hub-signature-256`). Webhook filters in `webhooks.filters` support matching on `source`, `repos`, `events`, `actions`, `labels`, `assignee`, `author`, and `branches` (AND logic; omitted fields are not checked).
|
|
326
168
|
|
|
327
|
-
|
|
169
|
+
#### Local development with ngrok
|
|
328
170
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
Each agent has an `AGENTS.md` file written during `al init`. Edit `<project>/<agent>/AGENTS.md` to customize agent behavior — changes take effect on the next run.
|
|
332
|
-
|
|
333
|
-
Agent config values (repos, trigger label, etc.) are automatically injected into the prompt as an `<agent-config>` block, so AGENTS.md can reference them without hardcoding. When triggered by a webhook, a `<webhook-trigger>` block is also injected with event details (issue title, PR number, labels, etc.).
|
|
334
|
-
|
|
335
|
-
## Testing
|
|
336
|
-
|
|
337
|
-
Tests use [Vitest](https://vitest.dev/) with globals enabled and V8 coverage.
|
|
171
|
+
If you're developing locally and need GitHub to reach your machine, use [ngrok](https://ngrok.com) to create a public tunnel:
|
|
338
172
|
|
|
339
173
|
```bash
|
|
340
|
-
#
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
# Watch mode (re-runs on file changes)
|
|
344
|
-
npm run test:watch
|
|
174
|
+
# Install ngrok (macOS)
|
|
175
|
+
brew install ngrok
|
|
345
176
|
|
|
346
|
-
#
|
|
347
|
-
|
|
177
|
+
# Start a tunnel pointing at the Action Llama gateway port
|
|
178
|
+
ngrok http 8080
|
|
348
179
|
```
|
|
349
180
|
|
|
350
|
-
|
|
181
|
+
ngrok will print a forwarding URL like `https://a1b2c3d4.ngrok-free.app`. Use that as your GitHub webhook Payload URL:
|
|
351
182
|
|
|
352
183
|
```
|
|
353
|
-
|
|
354
|
-
helpers.ts # Shared test utilities
|
|
355
|
-
shared/ # Unit tests for shared modules
|
|
356
|
-
agents/ # Agent runner, prompt builder, default agent tests
|
|
357
|
-
setup/ # Setup validators + scaffolding tests
|
|
358
|
-
scheduler/ # Scheduler, webhook integration tests
|
|
359
|
-
webhooks/ # Webhook registry + GitHub provider tests
|
|
184
|
+
https://a1b2c3d4.ngrok-free.app/webhooks/github
|
|
360
185
|
```
|
|
361
186
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
## Docker mode
|
|
187
|
+
Keep the ngrok process running alongside `al start`. The tunnel stays active until you stop it. For a stable URL across restarts, sign up for a free ngrok account and use a static domain:
|
|
365
188
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
```
|
|
369
|
-
HOST DOCKER (al-net)
|
|
370
|
-
┌──────────────────────────────────┐ ┌──────────────────────────────┐
|
|
371
|
-
│ Scheduler │ │ Agent Container (per run) │
|
|
372
|
-
│ generates shutdown secret │ │ pi-coding-agent session │
|
|
373
|
-
│ stages credentials │ │ coding tools (bash,r/w) │
|
|
374
|
-
│ launches container │ │ gh, git, curl │
|
|
375
|
-
│ waits for exit │ │ │
|
|
376
|
-
│ │ │ /credentials/ (read-only) │
|
|
377
|
-
│ Broker (in-process) │◄────────│ anthropic-key │
|
|
378
|
-
│ ● Health endpoint │ HTTP │ github-token │
|
|
379
|
-
│ ● Shutdown kill switch │ │ sentry-token (optional) │
|
|
380
|
-
│ ● Webhook receiver │ │ │
|
|
381
|
-
│ │ │ /workspace/ (tmpfs) │
|
|
382
|
-
│ Credentials (~/.al-creds/) │ │ Internet access: yes │
|
|
383
|
-
│ Workspace (project/.workspace/)│ └──────────────────────────────┘
|
|
384
|
-
└──────────────────────────────────┘
|
|
189
|
+
```bash
|
|
190
|
+
ngrok http 8080 --url=your-name.ngrok-free.app
|
|
385
191
|
```
|
|
386
192
|
|
|
387
|
-
###
|
|
388
|
-
|
|
389
|
-
- Docker installed and running
|
|
390
|
-
- Set `"docker": { "enabled": true }` in `config.json`
|
|
391
|
-
|
|
392
|
-
The agent Docker image is built automatically on first run from `docker/Dockerfile`.
|
|
193
|
+
### Docker mode
|
|
393
194
|
|
|
394
|
-
|
|
195
|
+
Set `"docker": { "enabled": true }` in `config.json`. Agents run in isolated containers with credentials mounted read-only at `/credentials/`, a read-only root FS, dropped capabilities, non-root user, and PID/memory/CPU limits. Each container gets a unique shutdown secret for the anti-exfiltration kill switch. The Docker image is built automatically on first run from `docker/Dockerfile`.
|
|
395
196
|
|
|
396
|
-
|
|
197
|
+
## Developing
|
|
397
198
|
|
|
398
199
|
### Prerequisites
|
|
399
200
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
npm login
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
### Version and publish
|
|
201
|
+
- Node.js >= 20, Git, Docker
|
|
202
|
+
- GitHub PAT with `repo` + `workflow` scopes
|
|
203
|
+
- Anthropic auth (pi auth, API key, or OAuth token)
|
|
407
204
|
|
|
408
|
-
|
|
205
|
+
### Setup
|
|
409
206
|
|
|
410
207
|
```bash
|
|
411
|
-
|
|
412
|
-
|
|
208
|
+
git clone <repo>
|
|
209
|
+
cd action-llama
|
|
210
|
+
npm install
|
|
211
|
+
npm run build
|
|
212
|
+
npm test
|
|
213
|
+
```
|
|
413
214
|
|
|
414
|
-
|
|
415
|
-
npm version minor
|
|
215
|
+
### How it works
|
|
416
216
|
|
|
417
|
-
|
|
418
|
-
npm version major
|
|
419
|
-
```
|
|
217
|
+
`al start` runs a single Node.js process (the **scheduler**) that:
|
|
420
218
|
|
|
421
|
-
|
|
219
|
+
1. Discovers agents in the project directory (each subdirectory with a `config.json`)
|
|
220
|
+
2. Starts a **gateway** HTTP server if webhooks or Docker mode are enabled (health check, webhook receiver, shutdown kill switch)
|
|
221
|
+
3. Creates a **runner** per agent — either `AgentRunner` (host mode) or `ContainerAgentRunner` (Docker mode)
|
|
222
|
+
4. Wires up **cron jobs** and/or **webhook bindings** to trigger each runner
|
|
223
|
+
5. On trigger, the runner builds a prompt (injecting `<agent-config>` and optionally `<webhook-trigger>` blocks), starts a [pi-coding-agent](https://github.com/badlogic/pi-mono) session, and streams output to the logger
|
|
422
224
|
|
|
423
|
-
|
|
424
|
-
|
|
225
|
+
### Source layout
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
src/
|
|
229
|
+
cli/ # Command definitions (new, start, status, logs, agent add)
|
|
230
|
+
setup/ # Interactive setup wizard (prompts, validators, scaffolding)
|
|
231
|
+
scheduler/ # Scheduler: discovers agents, starts gateway, wires cron + webhooks
|
|
232
|
+
agents/ # Agent runners (host + Docker), prompt builder, built-in definitions
|
|
233
|
+
gateway/ # HTTP server: router, health, shutdown, webhook routes
|
|
234
|
+
docker/ # Container lifecycle (launch, wait, logs, remove), image + network
|
|
235
|
+
webhooks/ # Webhook registry, provider interface, GitHub provider
|
|
236
|
+
tui/ # Ink-based terminal UI (App.tsx, status tracker)
|
|
237
|
+
shared/ # Config loader, credentials, logger, paths, git helpers
|
|
425
238
|
```
|
|
426
239
|
|
|
427
|
-
|
|
240
|
+
### Extension points
|
|
428
241
|
|
|
429
|
-
|
|
242
|
+
- **New agent type** — add a definition under `src/agents/definitions/<name>/` with a `config-definition.json` (schema for params, default schedule, webhook filters) and an `AGENTS.md` template. It will appear in `al new` and `al agent add` automatically.
|
|
243
|
+
- **New webhook provider** — implement the `WebhookProvider` interface in `src/webhooks/providers/` and register it in `src/scheduler/index.ts`. The registry handles routing by `source` field.
|
|
244
|
+
- **Custom runner** — subclass or replace `AgentRunner` in `src/agents/runner.ts` to change how agent sessions are created (different model providers, tool sets, etc.).
|
|
245
|
+
- **Gateway routes** — add routes in `src/gateway/routes/` and register them in `src/gateway/index.ts`.
|
|
430
246
|
|
|
431
|
-
|
|
247
|
+
### Tests
|
|
432
248
|
|
|
433
249
|
```bash
|
|
434
|
-
npm
|
|
250
|
+
npm test # run all 175 tests
|
|
251
|
+
npm run test:watch # watch mode
|
|
252
|
+
npm run test:coverage # V8 coverage report
|
|
435
253
|
```
|
|
436
254
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
### What gets published
|
|
255
|
+
Tests live in `test/` mirroring `src/`. Coverage excludes entry points (`cli/main.ts`), interactive prompts (`setup/prompts.ts`), and type-only files.
|
|
440
256
|
|
|
441
|
-
|
|
257
|
+
### Publishing
|
|
442
258
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
### Build scripts
|
|
259
|
+
```bash
|
|
260
|
+
npm login # need @action-llama org access
|
|
261
|
+
npm version patch # or minor / major — bumps, tags, pushes
|
|
262
|
+
npm publish --access public # build + tests run automatically via prepublishOnly
|
|
263
|
+
```
|
|
450
264
|
|
|
451
|
-
|
|
452
|
-
|--------|-------------|
|
|
453
|
-
| `npm run build` | Compile TypeScript to `dist/` and copy agent definition assets |
|
|
454
|
-
| `npm run clean` | Remove the `dist/` directory |
|
|
455
|
-
| `npm test` | Run all tests |
|
|
456
|
-
| `npm version <patch\|minor\|major>` | Bump version, tag, and push |
|
|
265
|
+
Published tarball includes `dist/`, `docker/`, `README.md`, `LICENSE`, and `package.json`.
|
|
457
266
|
|
|
458
267
|
## License
|
|
459
268
|
|
|
@@ -15,7 +15,7 @@ async function main() {
|
|
|
15
15
|
// Switch CWD to /workspace so child processes (git, bash, etc.) default to it.
|
|
16
16
|
// Node must resolve from /app (WORKDIR at build time), so we chdir after startup.
|
|
17
17
|
process.chdir("/workspace");
|
|
18
|
-
const
|
|
18
|
+
const gatewayUrl = process.env.GATEWAY_URL;
|
|
19
19
|
const shutdownSecret = process.env.SHUTDOWN_SECRET;
|
|
20
20
|
// Parse agent config from env var
|
|
21
21
|
const agentConfigStr = process.env.AGENT_CONFIG;
|
|
@@ -29,7 +29,7 @@ async function main() {
|
|
|
29
29
|
const agentConfig = parsed;
|
|
30
30
|
const modelId = agentConfig.model.model;
|
|
31
31
|
const modelThinking = agentConfig.model.thinkingLevel;
|
|
32
|
-
emitLog("info", "container starting", { agentName: agentConfig.name, modelId,
|
|
32
|
+
emitLog("info", "container starting", { agentName: agentConfig.name, modelId, gatewayUrl });
|
|
33
33
|
// Read Anthropic API key from credentials volume
|
|
34
34
|
const anthropicKey = readCredential("anthropic-key");
|
|
35
35
|
if (!anthropicKey) {
|