@action-llama/action-llama 0.13.0 → 0.13.2
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 +4 -17
- package/{docs/agent-reference → agent-docs}/AGENTS.md +27 -0
- package/{docs/agent-reference → agent-docs}/skills/README.md +1 -0
- package/agent-docs/skills/calls.md +82 -0
- package/{docs/agent-reference → agent-docs}/skills/resource-locks.md +13 -7
- package/{docs/agent-reference → agent-docs}/skills/signals.md +1 -1
- package/dist/agents/container-entry.d.ts.map +1 -1
- package/dist/agents/container-entry.js +15 -0
- package/dist/agents/container-entry.js.map +1 -1
- package/dist/agents/prompt.d.ts.map +1 -1
- package/dist/agents/prompt.js +3 -2
- package/dist/agents/prompt.js.map +1 -1
- package/dist/build-info.json +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +15 -0
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/env.d.ts.map +1 -1
- package/dist/cli/commands/env.js +4 -0
- package/dist/cli/commands/env.js.map +1 -1
- package/dist/cli/commands/kill.js +2 -2
- package/dist/cli/commands/kill.js.map +1 -1
- package/dist/cli/commands/pause.js +2 -2
- package/dist/cli/commands/pause.js.map +1 -1
- package/dist/cli/commands/push.js +1 -1
- package/dist/cli/commands/push.js.map +1 -1
- package/dist/cli/commands/resume.js +2 -2
- package/dist/cli/commands/resume.js.map +1 -1
- package/dist/cli/commands/run.js +2 -2
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/status.js +5 -5
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/stop.js +2 -2
- package/dist/cli/commands/stop.js.map +1 -1
- package/dist/cli/gateway-client.d.ts +6 -0
- package/dist/cli/gateway-client.d.ts.map +1 -1
- package/dist/cli/gateway-client.js +19 -0
- package/dist/cli/gateway-client.js.map +1 -1
- package/dist/cloud/vps/constants.d.ts +1 -1
- package/dist/cloud/vps/constants.d.ts.map +1 -1
- package/dist/cloud/vps/constants.js +9 -0
- package/dist/cloud/vps/constants.js.map +1 -1
- package/dist/cloud/vps/provision.js +11 -1
- package/dist/cloud/vps/provision.js.map +1 -1
- package/dist/cloud/vps/ssh.d.ts +7 -0
- package/dist/cloud/vps/ssh.d.ts.map +1 -1
- package/dist/cloud/vps/ssh.js +15 -1
- package/dist/cloud/vps/ssh.js.map +1 -1
- package/dist/credentials/builtins/index.d.ts.map +1 -1
- package/dist/credentials/builtins/index.js +6 -0
- package/dist/credentials/builtins/index.js.map +1 -1
- package/dist/credentials/builtins/mintlify-token.d.ts +4 -0
- package/dist/credentials/builtins/mintlify-token.d.ts.map +1 -0
- package/dist/credentials/builtins/mintlify-token.js +14 -0
- package/dist/credentials/builtins/mintlify-token.js.map +1 -0
- package/dist/credentials/builtins/mintlify-webhook-secret.d.ts +4 -0
- package/dist/credentials/builtins/mintlify-webhook-secret.d.ts.map +1 -0
- package/dist/credentials/builtins/mintlify-webhook-secret.js +12 -0
- package/dist/credentials/builtins/mintlify-webhook-secret.js.map +1 -0
- package/dist/credentials/builtins/reddit-oauth.d.ts +4 -0
- package/dist/credentials/builtins/reddit-oauth.d.ts.map +1 -0
- package/dist/credentials/builtins/reddit-oauth.js +71 -0
- package/dist/credentials/builtins/reddit-oauth.js.map +1 -0
- package/dist/docker/local-runtime.d.ts +0 -3
- package/dist/docker/local-runtime.d.ts.map +1 -1
- package/dist/docker/local-runtime.js +1 -34
- package/dist/docker/local-runtime.js.map +1 -1
- package/dist/docker/runtime.d.ts +0 -4
- package/dist/docker/runtime.d.ts.map +1 -1
- package/dist/gateway/index.d.ts +3 -0
- package/dist/gateway/index.d.ts.map +1 -1
- package/dist/gateway/index.js +23 -3
- package/dist/gateway/index.js.map +1 -1
- package/dist/gateway/routes/calls.d.ts +2 -1
- package/dist/gateway/routes/calls.d.ts.map +1 -1
- package/dist/gateway/routes/calls.js +12 -1
- package/dist/gateway/routes/calls.js.map +1 -1
- package/dist/gateway/routes/control.d.ts +2 -0
- package/dist/gateway/routes/control.d.ts.map +1 -1
- package/dist/gateway/routes/control.js +30 -2
- package/dist/gateway/routes/control.js.map +1 -1
- package/dist/gateway/routes/locks.d.ts +2 -0
- package/dist/gateway/routes/locks.d.ts.map +1 -1
- package/dist/gateway/routes/locks.js +20 -0
- package/dist/gateway/routes/locks.js.map +1 -1
- package/dist/gateway/routes/signals.d.ts +2 -1
- package/dist/gateway/routes/signals.d.ts.map +1 -1
- package/dist/gateway/routes/signals.js +21 -1
- package/dist/gateway/routes/signals.js.map +1 -1
- package/dist/remote/bootstrap.d.ts +2 -0
- package/dist/remote/bootstrap.d.ts.map +1 -1
- package/dist/remote/bootstrap.js +5 -9
- package/dist/remote/bootstrap.js.map +1 -1
- package/dist/remote/push.js +85 -71
- package/dist/remote/push.js.map +1 -1
- package/dist/scheduler/events.d.ts +78 -0
- package/dist/scheduler/events.d.ts.map +1 -0
- package/dist/scheduler/events.js +65 -0
- package/dist/scheduler/events.js.map +1 -0
- package/dist/scheduler/execution.d.ts +15 -0
- package/dist/scheduler/execution.d.ts.map +1 -1
- package/dist/scheduler/execution.js +31 -2
- package/dist/scheduler/execution.js.map +1 -1
- package/dist/scheduler/index.d.ts +5 -0
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +61 -17
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/webhook-setup.d.ts.map +1 -1
- package/dist/scheduler/webhook-setup.js +16 -0
- package/dist/scheduler/webhook-setup.js.map +1 -1
- package/dist/setup/scaffold.js +2 -2
- package/dist/setup/scaffold.js.map +1 -1
- package/dist/shared/config.d.ts +1 -0
- package/dist/shared/config.d.ts.map +1 -1
- package/dist/shared/config.js.map +1 -1
- package/dist/webhooks/definitions/github.d.ts.map +1 -1
- package/dist/webhooks/definitions/github.js +13 -0
- package/dist/webhooks/definitions/github.js.map +1 -1
- package/dist/webhooks/providers/github.d.ts.map +1 -1
- package/dist/webhooks/providers/github.js +6 -0
- package/dist/webhooks/providers/github.js.map +1 -1
- package/dist/webhooks/providers/mintlify.d.ts +9 -0
- package/dist/webhooks/providers/mintlify.d.ts.map +1 -0
- package/dist/webhooks/providers/mintlify.js +69 -0
- package/dist/webhooks/providers/mintlify.js.map +1 -0
- package/dist/webhooks/types.d.ts +9 -1
- package/dist/webhooks/types.d.ts.map +1 -1
- package/docker/bin/_http-exit +35 -0
- package/docker/bin/al-call +10 -4
- package/docker/bin/al-check +9 -3
- package/docker/bin/al-status +1 -1
- package/docker/bin/al-wait +11 -3
- package/docker/bin/rlock +9 -2
- package/docker/bin/rlock-heartbeat +9 -2
- package/docker/bin/runlock +9 -2
- package/package.json +2 -2
- package/docs/agent-config-reference.md +0 -313
- package/docs/agents.md +0 -256
- package/docs/cloud-run.md +0 -173
- package/docs/cloud.md +0 -98
- package/docs/commands.md +0 -286
- package/docs/config-reference.md +0 -241
- package/docs/creating-agents.md +0 -147
- package/docs/credentials.md +0 -167
- package/docs/docker.md +0 -323
- package/docs/ecs.md +0 -795
- package/docs/examples/dev/ACTIONS.md +0 -96
- package/docs/examples/dev/README.md +0 -42
- package/docs/examples/dev/agent-config.toml +0 -24
- package/docs/examples/index.md +0 -15
- package/docs/examples/planner/ACTIONS.md +0 -177
- package/docs/examples/planner/README.md +0 -39
- package/docs/examples/planner/agent-config.toml +0 -31
- package/docs/examples/reviewer/ACTIONS.md +0 -153
- package/docs/examples/reviewer/README.md +0 -39
- package/docs/examples/reviewer/agent-config.toml +0 -21
- package/docs/models.md +0 -191
- package/docs/vps-deployment.md +0 -285
- package/docs/web-dashboard.md +0 -113
- package/docs/webhooks.md +0 -152
- /package/{docs/agent-reference → agent-docs}/skills/credentials.md +0 -0
- /package/{docs/agent-reference → agent-docs}/skills/environment.md +0 -0
package/docs/agents.md
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
# Agents
|
|
2
|
-
|
|
3
|
-
An agent is a directory inside your project that contains instructions and configuration for an autonomous LLM session. Each run is self-contained: the agent wakes up (on a schedule or webhook), executes its task, and shuts down.
|
|
4
|
-
|
|
5
|
-
## Structure
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
my-agent/
|
|
9
|
-
agent-config.toml # Required — credentials, model, schedule, webhooks, params
|
|
10
|
-
ACTIONS.md # Required — system prompt (the agent's instructions)
|
|
11
|
-
Dockerfile # Optional — custom Docker image for this agent
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
The directory name becomes the agent name. No registration is needed — the scheduler discovers agents by scanning for directories that contain an `agent-config.toml`.
|
|
15
|
-
|
|
16
|
-
## `agent-config.toml`
|
|
17
|
-
|
|
18
|
-
Declares what the agent needs to run: which credentials to mount, which model to use, when to trigger, and any custom parameters.
|
|
19
|
-
|
|
20
|
-
```toml
|
|
21
|
-
credentials = ["github_token", "git_ssh"]
|
|
22
|
-
schedule = "*/5 * * * *"
|
|
23
|
-
|
|
24
|
-
[model]
|
|
25
|
-
provider = "anthropic"
|
|
26
|
-
model = "claude-sonnet-4-20250514"
|
|
27
|
-
thinkingLevel = "medium"
|
|
28
|
-
authType = "api_key"
|
|
29
|
-
|
|
30
|
-
[[webhooks]]
|
|
31
|
-
source = "my-github"
|
|
32
|
-
events = ["issues"]
|
|
33
|
-
actions = ["labeled"]
|
|
34
|
-
labels = ["agent"]
|
|
35
|
-
|
|
36
|
-
[params]
|
|
37
|
-
repos = ["acme/app"]
|
|
38
|
-
triggerLabel = "agent"
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Key points:
|
|
42
|
-
|
|
43
|
-
- **`credentials`** — list of credential refs (`"type:instance"`) the agent needs at runtime. These are mounted into the container and injected as environment variables. See [Credentials](credentials.md).
|
|
44
|
-
- **`schedule`** and/or **`webhooks`** — at least one trigger is required. Agents can have both.
|
|
45
|
-
- **`[model]`** — optional. If omitted, the agent inherits the default model from the project's `config.toml`. See [Models](models.md).
|
|
46
|
-
- **`[params]`** — optional key-value pairs injected into the agent's prompt as an `<agent-config>` JSON block. Use these for repo names, label names, org identifiers, or anything else your ACTIONS.md references.
|
|
47
|
-
|
|
48
|
-
See [agent-config.toml Reference](agent-config-reference.md) for the full field reference.
|
|
49
|
-
|
|
50
|
-
## `ACTIONS.md`
|
|
51
|
-
|
|
52
|
-
The system prompt that defines the agent's behavior. This is the most important file — it tells the LLM what to do, step by step.
|
|
53
|
-
|
|
54
|
-
Write it as direct instructions to the model:
|
|
55
|
-
|
|
56
|
-
```markdown
|
|
57
|
-
# My Agent
|
|
58
|
-
|
|
59
|
-
You are an automation agent. Your job is to ...
|
|
60
|
-
|
|
61
|
-
Your configuration is in the `<agent-config>` block at the start of your prompt.
|
|
62
|
-
|
|
63
|
-
`GITHUB_TOKEN` is already set in your environment. Use `gh` CLI and `git` directly.
|
|
64
|
-
|
|
65
|
-
## Workflow
|
|
66
|
-
|
|
67
|
-
1. **Check for work** — ...
|
|
68
|
-
2. **Do the work** — ...
|
|
69
|
-
3. **Report results** — ...
|
|
70
|
-
|
|
71
|
-
## Rules
|
|
72
|
-
|
|
73
|
-
- If you did work and there may be more, run `al-rerun`
|
|
74
|
-
- ...
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### How it's used at runtime
|
|
78
|
-
|
|
79
|
-
The ACTIONS.md is set as the LLM's system prompt. The scheduler then sends a user-message prompt assembled from several blocks:
|
|
80
|
-
|
|
81
|
-
1. **`<agent-config>`** — JSON of the `[params]` table from `agent-config.toml`
|
|
82
|
-
2. **`<credential-context>`** — describes which environment variables and tools are available (e.g. `GITHUB_TOKEN`, `git`, `gh`, SSH config)
|
|
83
|
-
3. **Trigger context** (one of):
|
|
84
|
-
- *Scheduled run:* "You are running on a schedule. Check for new work and act on anything you find."
|
|
85
|
-
- *Manual run:* "You have been triggered manually. Check for new work and act on anything you find."
|
|
86
|
-
- *Webhook:* `<webhook-trigger>` block with the full event payload (source, event, action, repo, etc.)
|
|
87
|
-
- *Agent call:* `<agent-call>` block with the caller agent name and context
|
|
88
|
-
|
|
89
|
-
Your ACTIONS.md should reference `<agent-config>` for parameter values and handle both scheduled and webhook triggers if the agent uses both.
|
|
90
|
-
|
|
91
|
-
### Language skills
|
|
92
|
-
|
|
93
|
-
Before the ACTIONS.md runs, the agent receives a preamble that teaches it a set of **language skills** — shorthand operations the actions can reference naturally. The preamble explains the underlying mechanics (curl commands, env vars) so agent authors never need to think about them.
|
|
94
|
-
|
|
95
|
-
Skills currently taught to agents:
|
|
96
|
-
|
|
97
|
-
| Category | Skills | Description |
|
|
98
|
-
|----------|--------|-------------|
|
|
99
|
-
| **Signals** | `al-rerun`, `al-status`, `al-return`, `al-exit` | Shell commands for signaling the scheduler. See [Signals](#signals). |
|
|
100
|
-
| **Calls** | `al-call`, `al-check`, `al-wait` | Agent-to-agent calls with return values. See [Agent calls](#agent-calls). |
|
|
101
|
-
| **Locks** | `LOCK(...)`, `UNLOCK(...)`, `HEARTBEAT(...)` | Resource locking for parallel coordination. See [Resource locks](#resource-locks). |
|
|
102
|
-
| **Credentials** | `GITHUB_TOKEN`, `gh`, `git`, etc. | Credential access and tool usage. See [Credentials](credentials.md). |
|
|
103
|
-
|
|
104
|
-
Agent authors write the shorthand naturally (e.g. `LOCK("github issue acme/app#42")`). The agent learns what it means from the preamble — no need to document curl commands or API endpoints in your actions.
|
|
105
|
-
|
|
106
|
-
### Signals
|
|
107
|
-
|
|
108
|
-
The agent uses shell commands to signal the scheduler:
|
|
109
|
-
|
|
110
|
-
| Command | Effect |
|
|
111
|
-
|---------|--------|
|
|
112
|
-
| `al-rerun` | Tells the scheduler the agent did work and wants to be re-run immediately to drain remaining backlog. |
|
|
113
|
-
| `al-status "<text>"` | Status update shown in the TUI (e.g. `al-status "reviewing PR #42"`). |
|
|
114
|
-
| `al-return "<value>"` | Returns a value to the calling agent when invoked via `al-call`. |
|
|
115
|
-
| `al-exit [code]` | Terminates the agent with an exit code indicating an unrecoverable error. |
|
|
116
|
-
|
|
117
|
-
### Agent calls
|
|
118
|
-
|
|
119
|
-
Agents running in Docker mode can call other agents and retrieve their results using shell commands:
|
|
120
|
-
|
|
121
|
-
- **`al-call <agent>`** — Call another agent. Pass context via stdin. Returns `{"ok":true,"callId":"..."}`.
|
|
122
|
-
- **`al-check <callId>`** — Non-blocking status check. Returns `{"status":"pending|running|completed|error", ...}`.
|
|
123
|
-
- **`al-wait <callId> [...] [--timeout N]`** — Wait for calls to complete (default timeout: 900s).
|
|
124
|
-
|
|
125
|
-
Calls are non-blocking: fire multiple calls, continue working, then collect results with `al-wait`. If the target agent's runners are all busy, the call is queued until one frees up. Self-calls are rejected; call depth is bounded by `maxCallDepth`.
|
|
126
|
-
|
|
127
|
-
## Runtime lifecycle
|
|
128
|
-
|
|
129
|
-
Each agent run is an isolated, short-lived container. Here's what happens from trigger to exit:
|
|
130
|
-
|
|
131
|
-
1. **Trigger fires** — a cron tick, webhook event, manual `al run`, or `al-call` from another agent.
|
|
132
|
-
2. **Container launches** — a fresh container starts with credentials and config passed via environment variables and volume mounts.
|
|
133
|
-
3. **Credentials are loaded** — the entry point reads credential files from `/credentials/<type>/<instance>/<field>` (local Docker and Cloud Run) or from `AL_SECRET_*` environment variables (ECS). Key credentials are injected as env vars the LLM can use directly: `GITHUB_TOKEN`, `GH_TOKEN`, `SENTRY_AUTH_TOKEN`, `GIT_SSH_COMMAND`, git author identity, etc.
|
|
134
|
-
4. **LLM session starts** — the model is initialized and receives two inputs:
|
|
135
|
-
- **System prompt:** the contents of `ACTIONS.md`
|
|
136
|
-
- **User prompt:** `<agent-config>` (params JSON) + `<credential-context>` (available env vars, tools, and security policy) + trigger context (schedule, webhook payload, or agent call)
|
|
137
|
-
5. **Agent runs autonomously** — the LLM executes tools (bash, file I/O, API calls) until it finishes or hits an error. Rate-limited API calls are retried automatically (up to 5 attempts with exponential backoff).
|
|
138
|
-
6. **Error detection** — the container watches for repeated auth/permission failures (e.g. "bad credentials", "permission denied"). After 3 such errors, it aborts early.
|
|
139
|
-
7. **Signals are processed** — the agent uses `al-rerun`, `al-status`, `al-return`, and `al-exit` commands to write signal files. The scheduler reads them after the session ends.
|
|
140
|
-
8. **Container exits** — exit code 0 (success), 1 (error), or 124 (timeout). Any held locks are released automatically. The scheduler logs the result and the container is removed.
|
|
141
|
-
|
|
142
|
-
### Timeout
|
|
143
|
-
|
|
144
|
-
Each container has a self-termination timer controlled by `local.timeout` in `config.toml` (default: 3600 seconds / 1 hour). If the timer fires, the process exits with code 124. This is a hard kill — there is no graceful shutdown.
|
|
145
|
-
|
|
146
|
-
### Reruns
|
|
147
|
-
|
|
148
|
-
When a scheduled agent runs `al-rerun`, the scheduler immediately re-runs it. This continues until the agent completes without `al-rerun` (no more work), hits an error, or reaches the `maxReruns` limit (default: 10, configurable in `config.toml`). This lets an agent drain its work queue without waiting for the next cron tick.
|
|
149
|
-
|
|
150
|
-
Webhook-triggered and agent-called runs do not re-run — they respond to a single event.
|
|
151
|
-
|
|
152
|
-
See [Docker docs](docker.md) for the full container reference including the startup sequence, log protocol, filesystem layout, and exit codes.
|
|
153
|
-
|
|
154
|
-
## Resource locks
|
|
155
|
-
|
|
156
|
-
When you set `scale > 1` on an agent, multiple instances run concurrently. Without coordination, two instances might pick up the same GitHub issue, review the same PR, or deploy the same service at the same time. Resource locks prevent this.
|
|
157
|
-
|
|
158
|
-
Locks are managed by the scheduler and available to all agents running in Docker mode. Each lock is identified by a **resource key** — for example, `LOCK("github issue acme/app#42")`.
|
|
159
|
-
|
|
160
|
-
### How it works
|
|
161
|
-
|
|
162
|
-
1. Before working on a shared resource, the agent calls `LOCK("resource key")`.
|
|
163
|
-
2. If the lock is free, the agent gets it and proceeds.
|
|
164
|
-
3. If another instance already holds the lock, the agent gets back the holder's name and skips that resource.
|
|
165
|
-
4. When done, the agent calls `UNLOCK("resource key")`.
|
|
166
|
-
|
|
167
|
-
The agent learns the lock API from a preamble injected before the actions run. Agent authors just write the shorthand — no need to think about HTTP endpoints or authentication.
|
|
168
|
-
|
|
169
|
-
### Operations
|
|
170
|
-
|
|
171
|
-
| Operation | Description |
|
|
172
|
-
|-----------|-------------|
|
|
173
|
-
| `LOCK(resourceKey)` | Acquire an exclusive lock on a resource. Fails if another instance holds it. |
|
|
174
|
-
| `UNLOCK(resourceKey)` | Release a lock. Only the holder can release. |
|
|
175
|
-
| `HEARTBEAT(resourceKey)` | Reset the TTL on a held lock. Use during long-running work to prevent expiry. |
|
|
176
|
-
|
|
177
|
-
### One lock at a time
|
|
178
|
-
|
|
179
|
-
Each agent instance can hold **at most one lock**. This keeps the model simple — the agent locks a resource, does the work, unlocks, then moves to the next item. If it tries to acquire a second lock without releasing the first, the request is rejected with a clear error message.
|
|
180
|
-
|
|
181
|
-
### Timeout (TTL)
|
|
182
|
-
|
|
183
|
-
Locks expire automatically after **30 minutes** by default. This prevents deadlocks if an agent crashes or hangs without releasing its lock. The timeout is configurable via `gateway.lockTimeout` in `config.toml` (value in seconds).
|
|
184
|
-
|
|
185
|
-
For work that takes longer than the timeout, use `HEARTBEAT` to extend the TTL. Each heartbeat resets the clock to another full TTL period. If the agent forgets to heartbeat and the lock expires, another instance can claim it.
|
|
186
|
-
|
|
187
|
-
### Authentication
|
|
188
|
-
|
|
189
|
-
Each container gets a unique per-run secret (the same one used for the shutdown API). Lock requests are authenticated with this secret, so only the container that acquired a lock can release or heartbeat it. There is no way for one agent instance to release another's lock — it must wait for the TTL to expire.
|
|
190
|
-
|
|
191
|
-
### Auto-release on exit
|
|
192
|
-
|
|
193
|
-
When a container exits — whether it finishes successfully, hits an error, or times out — all of its locks are released automatically by the scheduler. You don't need to worry about cleanup in error paths.
|
|
194
|
-
|
|
195
|
-
### Example agents
|
|
196
|
-
|
|
197
|
-
```markdown
|
|
198
|
-
## Workflow
|
|
199
|
-
|
|
200
|
-
1. List open issues labeled "agent" in repos from `<agent-config>`
|
|
201
|
-
2. For each issue:
|
|
202
|
-
- LOCK("github issue owner/repo#123")
|
|
203
|
-
- If the lock fails, skip this issue — another instance is handling it
|
|
204
|
-
- Clone the repo, create a branch, implement the fix
|
|
205
|
-
- Open a PR and link it to the issue
|
|
206
|
-
- UNLOCK("github issue owner/repo#123")
|
|
207
|
-
3. If you completed work and there may be more issues, run `al-rerun`
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Resource key conventions
|
|
211
|
-
|
|
212
|
-
Use descriptive, unique keys:
|
|
213
|
-
|
|
214
|
-
| Resource key | Example |
|
|
215
|
-
|-------------|---------|
|
|
216
|
-
| `github issue owner/repo#number` | `LOCK("github issue acme/app#42")` |
|
|
217
|
-
| `github pr owner/repo#number` | `LOCK("github pr acme/app#17")` |
|
|
218
|
-
| `deploy service-name` | `LOCK("deploy api-prod")` |
|
|
219
|
-
|
|
220
|
-
### Configuration
|
|
221
|
-
|
|
222
|
-
| Setting | Location | Default | Description |
|
|
223
|
-
|---------|----------|---------|-------------|
|
|
224
|
-
| `gateway.lockTimeout` | `config.toml` | `1800` (30 min) | Default TTL for locks in seconds |
|
|
225
|
-
|
|
226
|
-
## `Dockerfile` (optional)
|
|
227
|
-
|
|
228
|
-
The base Docker image includes Node.js, git, curl, and openssh. If your agent needs additional tools, add a `Dockerfile` to the agent directory:
|
|
229
|
-
|
|
230
|
-
```dockerfile
|
|
231
|
-
FROM al-agent:latest
|
|
232
|
-
USER root
|
|
233
|
-
RUN apk add --no-cache github-cli jq python3
|
|
234
|
-
USER node
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
Agents without a Dockerfile use the base image directly.
|
|
238
|
-
|
|
239
|
-
See [Docker docs](docker.md) for the full container reference including the base image contents, filesystem layout, and how to write standalone Dockerfiles.
|
|
240
|
-
|
|
241
|
-
## Examples
|
|
242
|
-
|
|
243
|
-
| Agent | Description |
|
|
244
|
-
|-------|-------------|
|
|
245
|
-
| [Dev Agent](examples/dev/) | Picks up GitHub issues and implements changes |
|
|
246
|
-
| [Reviewer Agent](examples/reviewer/) | Reviews and merges open pull requests |
|
|
247
|
-
| [DevOps Agent](examples/devops/) | Monitors CI failures and Sentry errors, files issues |
|
|
248
|
-
|
|
249
|
-
## See also
|
|
250
|
-
|
|
251
|
-
- [Creating Agents](creating-agents.md) — step-by-step setup guide
|
|
252
|
-
- [agent-config.toml Reference](agent-config-reference.md) — all config fields
|
|
253
|
-
- [Models](models.md) — supported LLM providers and model IDs
|
|
254
|
-
- [Credentials](credentials.md) — credential types and storage
|
|
255
|
-
- [Webhooks](webhooks.md) — webhook setup and filter fields
|
|
256
|
-
- [Docker](docker.md) — container isolation and custom images
|
package/docs/cloud-run.md
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
# Cloud Run Mode
|
|
2
|
-
|
|
3
|
-
Run agents as Cloud Run Jobs on GCP instead of local Docker containers. Agents get the same isolation guarantees with the added benefits of serverless scaling, managed infrastructure, and per-agent secret isolation via IAM.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
- GCP project with Cloud Run, Secret Manager, Artifact Registry, and Cloud Build APIs enabled
|
|
8
|
-
- `gcloud` CLI authenticated (`gcloud auth login`)
|
|
9
|
-
|
|
10
|
-
Local Docker is **not required** — images are built using Cloud Build.
|
|
11
|
-
|
|
12
|
-
## Configuration
|
|
13
|
-
|
|
14
|
-
In your project's `config.toml`:
|
|
15
|
-
|
|
16
|
-
```toml
|
|
17
|
-
[cloud]
|
|
18
|
-
provider = "cloud-run"
|
|
19
|
-
gcpProject = "my-gcp-project"
|
|
20
|
-
region = "us-central1"
|
|
21
|
-
artifactRegistry = "us-central1-docker.pkg.dev/my-gcp-project/al-images"
|
|
22
|
-
serviceAccount = "al-runner@my-gcp-project.iam.gserviceaccount.com"
|
|
23
|
-
# secretPrefix = "action-llama" # optional, default: "action-llama"
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
| Key | Required | Description |
|
|
27
|
-
|-----|----------|-------------|
|
|
28
|
-
| `cloud.provider` | Yes | Set to `"cloud-run"` |
|
|
29
|
-
| `cloud.gcpProject` | Yes | GCP project ID |
|
|
30
|
-
| `cloud.region` | Yes | Cloud Run region (e.g. `us-central1`) |
|
|
31
|
-
| `cloud.artifactRegistry` | Yes | Full Artifact Registry repo path |
|
|
32
|
-
| `cloud.serviceAccount` | No | Runtime SA (for job creation). Per-agent SAs are used for job execution. |
|
|
33
|
-
| `cloud.secretPrefix` | No | GSM secret name prefix (default: `"action-llama"`) |
|
|
34
|
-
|
|
35
|
-
Local Docker settings (`[local]`) control resource limits:
|
|
36
|
-
|
|
37
|
-
| Key | Default | Description |
|
|
38
|
-
|-----|---------|-------------|
|
|
39
|
-
| `local.memory` | `"4Gi"` | Memory per job |
|
|
40
|
-
| `local.cpus` | `2` | CPUs per job |
|
|
41
|
-
| `local.timeout` | `3600` | Max execution time in seconds |
|
|
42
|
-
|
|
43
|
-
## Quick Setup
|
|
44
|
-
|
|
45
|
-
The fastest way to get started:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
al setup cloud -p .
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
This interactive wizard prompts for all required fields, writes the `[cloud]` config, pushes credentials, and provisions IAM in one step.
|
|
52
|
-
|
|
53
|
-
## Manual Setup
|
|
54
|
-
|
|
55
|
-
### 1. Enable GCP APIs
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
gcloud services enable \
|
|
59
|
-
run.googleapis.com \
|
|
60
|
-
secretmanager.googleapis.com \
|
|
61
|
-
artifactregistry.googleapis.com \
|
|
62
|
-
--project my-gcp-project
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### 2. Create an Artifact Registry repository
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
gcloud artifacts repositories create al-images \
|
|
69
|
-
--repository-format=docker \
|
|
70
|
-
--location=us-central1 \
|
|
71
|
-
--project my-gcp-project
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### 3. Configure Docker for Artifact Registry
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
gcloud auth configure-docker us-central1-docker.pkg.dev
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### 4. Push credentials and create per-agent service accounts
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
al doctor -c -p .
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
This pushes all local credentials to Google Secret Manager, then creates a service account for each agent (`al-{agentName}@{project}.iam.gserviceaccount.com`) and grants it `secretmanager.secretAccessor` on only the secrets that agent needs.
|
|
87
|
-
|
|
88
|
-
> **Re-run after adding agents:** Whenever you add a new agent to your project, re-run `al doctor -c` to create the service account for the new agent. Without this, the new agent will fail to access its credentials at runtime.
|
|
89
|
-
|
|
90
|
-
### 5. Start
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
al start -c -p .
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
The scheduler will:
|
|
97
|
-
1. Build agent images locally
|
|
98
|
-
2. Push them to Artifact Registry
|
|
99
|
-
3. Create/update Cloud Run jobs with GSM secret volume mounts
|
|
100
|
-
4. Execute jobs on schedule or webhook trigger
|
|
101
|
-
5. Stream logs from Cloud Logging
|
|
102
|
-
|
|
103
|
-
## Cloud Build
|
|
104
|
-
|
|
105
|
-
When running in Cloud Run mode, images are built using [Cloud Build](https://cloud.google.com/build) instead of local Docker. This means you don't need Docker installed on your machine or CI server — Cloud Build handles building and pushing to Artifact Registry in one step.
|
|
106
|
-
|
|
107
|
-
Enable the Cloud Build API:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
gcloud services enable cloudbuild.googleapis.com --project my-gcp-project
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
The scheduler automatically uses `gcloud builds submit` when the cloud provider is `cloud-run`. No additional configuration is needed.
|
|
114
|
-
|
|
115
|
-
## How it works
|
|
116
|
-
|
|
117
|
-
### Image lifecycle
|
|
118
|
-
|
|
119
|
-
Images are built using Cloud Build and pushed to Artifact Registry. Each agent gets its own image tag (`al-{agentName}:latest`). The build happens on every `al start -c` to ensure the latest code is deployed. Cloud Build handles caching automatically.
|
|
120
|
-
|
|
121
|
-
### Secret mounting
|
|
122
|
-
|
|
123
|
-
Cloud Run mounts secrets from Google Secret Manager as files at `/credentials/<type>/<instance>/<field>` — the same layout as local Docker mode. The container entry point reads credentials from this path identically in both modes.
|
|
124
|
-
|
|
125
|
-
Secret names follow the convention: `{prefix}--{type}--{instance}--{field}` (e.g. `action-llama--github_token--default--token`).
|
|
126
|
-
|
|
127
|
-
### Per-agent service accounts
|
|
128
|
-
|
|
129
|
-
Each agent runs as its own GCP service account:
|
|
130
|
-
|
|
131
|
-
```
|
|
132
|
-
al-dev@my-project.iam.gserviceaccount.com → github_token, git_ssh, anthropic_key
|
|
133
|
-
al-reviewer@my-project.iam.gserviceaccount.com → github_token, git_ssh, anthropic_key
|
|
134
|
-
al-devops@my-project.iam.gserviceaccount.com → github_token, sentry_token, anthropic_key
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
Each SA only has `secretmanager.secretAccessor` on its declared secrets. Even if an agent container is compromised and accesses the GCP metadata server to obtain the SA's token, it can only read its own secrets.
|
|
138
|
-
|
|
139
|
-
Run `al doctor -c` to create these SAs and IAM bindings automatically.
|
|
140
|
-
|
|
141
|
-
### Gateway
|
|
142
|
-
|
|
143
|
-
The gateway is **not required** for Cloud Run mode. Containers get their credentials via native GSM mounts (not the gateway's HTTP endpoint), and Cloud Run handles execution timeouts natively (no kill switch needed). The gateway still starts if you have webhooks configured, since webhooks are received by the scheduler process.
|
|
144
|
-
|
|
145
|
-
### Log streaming
|
|
146
|
-
|
|
147
|
-
Logs are streamed from Cloud Logging by polling. There is a ~5-15 second ingestion delay inherent to Cloud Logging. The TUI displays a warning about this delay when running in Cloud Run mode.
|
|
148
|
-
|
|
149
|
-
## Comparison with local Docker
|
|
150
|
-
|
|
151
|
-
| Aspect | Local Docker | Cloud Run |
|
|
152
|
-
|--------|-------------|-----------|
|
|
153
|
-
| Where containers run | Your machine | GCP |
|
|
154
|
-
| Credential delivery | Volume mount from temp dir | GSM secret volume mount |
|
|
155
|
-
| Secret isolation | Mount-level (same trust boundary) | IAM-enforced per-agent SAs |
|
|
156
|
-
| Gateway needed | Yes (kill switch, cred serving) | No (optional for webhooks) |
|
|
157
|
-
| Log latency | Real-time | ~5-15s delay |
|
|
158
|
-
| Scaling | Limited by host resources | Serverless, managed |
|
|
159
|
-
| Cost | Free (your hardware) | Pay per execution |
|
|
160
|
-
|
|
161
|
-
## Troubleshooting
|
|
162
|
-
|
|
163
|
-
**"Cloud Run runtime requires cloud.gcpProject..."** — Ensure all required fields are set in `config.toml` under `[cloud]`.
|
|
164
|
-
|
|
165
|
-
**"Failed to get GCP access token"** — Run `gcloud auth application-default login` or set `GCP_SERVICE_ACCOUNT_KEY` env var.
|
|
166
|
-
|
|
167
|
-
**"Failed to push image"** — Run `gcloud auth configure-docker <region>-docker.pkg.dev` to configure Docker for Artifact Registry.
|
|
168
|
-
|
|
169
|
-
**"Failed to create Cloud Run job"** — Check that Cloud Run API is enabled and the runtime SA has `run.jobs.create` permission.
|
|
170
|
-
|
|
171
|
-
**Logs are delayed** — This is expected. Cloud Logging has a ~5-15 second ingestion delay. The TUI shows a warning when running in Cloud Run mode.
|
|
172
|
-
|
|
173
|
-
**Agent can't access secrets** — Run `al doctor -c` to create per-agent SAs and IAM bindings. Verify with `gcloud secrets get-iam-policy <secret-name> --project <project>`.
|
package/docs/cloud.md
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# Cloud
|
|
2
|
-
|
|
3
|
-
Running `al start` on your laptop works for development, but for production you want agents running 24/7 on managed infrastructure — no laptop required, automatic restarts, and IAM-enforced secret isolation so a compromised agent can only access its own credentials.
|
|
4
|
-
|
|
5
|
-
Action Llama supports three cloud providers. All use the same project structure and agent configs — the only difference is the `[cloud]` section in `config.toml`.
|
|
6
|
-
|
|
7
|
-
## Quick start
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
al setup cloud -p . # Interactive wizard: pick provider, configure, push creds, provision IAM
|
|
11
|
-
al start -c -p . # Start on cloud
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Providers
|
|
15
|
-
|
|
16
|
-
### GCP (Cloud Run Jobs)
|
|
17
|
-
|
|
18
|
-
Agents run as serverless Cloud Run Jobs. Images are built with Cloud Build (no local Docker needed). Credentials are stored in Google Secret Manager and mounted as files natively by Cloud Run.
|
|
19
|
-
|
|
20
|
-
```toml
|
|
21
|
-
[cloud]
|
|
22
|
-
provider = "cloud-run"
|
|
23
|
-
gcpProject = "my-gcp-project"
|
|
24
|
-
region = "us-central1"
|
|
25
|
-
artifactRegistry = "us-central1-docker.pkg.dev/my-gcp-project/al-images"
|
|
26
|
-
serviceAccount = "al-runner@my-gcp-project.iam.gserviceaccount.com"
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
al doctor -c # Push creds + create per-agent service accounts
|
|
31
|
-
al start -c # Start on Cloud Run
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
If you add a new agent later, re-run `al doctor -c` to create its service account and IAM bindings.
|
|
35
|
-
|
|
36
|
-
See [Cloud Run docs](cloud-run.md) for prerequisites, full setup walkthrough, and troubleshooting.
|
|
37
|
-
|
|
38
|
-
### AWS (ECS Fargate)
|
|
39
|
-
|
|
40
|
-
Agents run as ECS Fargate tasks. Images are built locally and pushed to ECR. Credentials are stored in AWS Secrets Manager and injected as environment variables by ECS.
|
|
41
|
-
|
|
42
|
-
```toml
|
|
43
|
-
[cloud]
|
|
44
|
-
provider = "ecs"
|
|
45
|
-
awsRegion = "us-east-1"
|
|
46
|
-
ecsCluster = "al-cluster"
|
|
47
|
-
ecrRepository = "123456789012.dkr.ecr.us-east-1.amazonaws.com/al-images"
|
|
48
|
-
executionRoleArn = "arn:aws:iam::123456789012:role/ecsTaskExecutionRole"
|
|
49
|
-
taskRoleArn = "arn:aws:iam::123456789012:role/al-default-task-role"
|
|
50
|
-
subnets = ["subnet-abc123"]
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
al doctor -c # Push creds + create per-agent IAM task roles
|
|
55
|
-
al start -c # Start on ECS Fargate
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
If you add a new agent later, re-run `al doctor -c` to create its task role and IAM policy.
|
|
59
|
-
|
|
60
|
-
See [ECS docs](ecs.md) for prerequisites, full setup walkthrough, and troubleshooting.
|
|
61
|
-
|
|
62
|
-
### VPS (SSH + Docker)
|
|
63
|
-
|
|
64
|
-
Agents run on any VPS or server you can SSH into. Images are built directly on the server via `tar | ssh docker build` — no container registry needed. Credentials are stored on the VPS filesystem over SSH.
|
|
65
|
-
|
|
66
|
-
```toml
|
|
67
|
-
[cloud]
|
|
68
|
-
provider = "vps"
|
|
69
|
-
host = "your-vps-ip"
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
al doctor -c # Push creds to VPS via SSH
|
|
74
|
-
al start -c # Start on VPS
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Setup supports three paths:
|
|
78
|
-
- **Connect to an existing server** — any provider, any server with Docker installed
|
|
79
|
-
- **Provision a new Vultr VPS** — automated instance creation with cloud-init Docker install
|
|
80
|
-
- **Provision a new Hetzner VPS** — automated server creation with cloud-init Docker install
|
|
81
|
-
|
|
82
|
-
See [VPS docs](vps-deployment.md) for full setup.
|
|
83
|
-
|
|
84
|
-
## Provider comparison
|
|
85
|
-
|
|
86
|
-
| | GCP Cloud Run | AWS ECS (Fargate + Lambda) | VPS (SSH + Docker) |
|
|
87
|
-
|---|---|---|---|
|
|
88
|
-
| Image builds | Cloud Build (no local Docker) | CodeBuild (no local Docker) | `tar \| ssh docker build` (on VPS) |
|
|
89
|
-
| Credential store | Google Secret Manager | AWS Secrets Manager | Filesystem on VPS (over SSH) |
|
|
90
|
-
| Credential delivery | File mount (native) | Env var injection | Volume mount |
|
|
91
|
-
| Secret isolation | Per-agent service accounts | Per-agent IAM task/Lambda roles | SSH access = full access |
|
|
92
|
-
| Setup command | `al doctor -c` | `al doctor -c` | `al doctor -c` |
|
|
93
|
-
| Log latency | ~5-15s (Cloud Logging) | ~5-10s (CloudWatch) | Real-time (SSH) |
|
|
94
|
-
| Cold start | ~10-30s | ~1-2s (Lambda, timeout<=900s) / ~30-60s (Fargate) | ~1-2s |
|
|
95
|
-
| Cost | Pay-per-run | Pay-per-run | Fixed monthly ($5-24/mo) |
|
|
96
|
-
| IAM reconciliation | Per-agent service accounts | Per-agent IAM roles | No-op |
|
|
97
|
-
|
|
98
|
-
On AWS, agents with `timeout <= 900` automatically route to Lambda for faster cold starts. Agents with longer timeouts use ECS Fargate. See [ECS docs](ecs.md#per-agent-timeout-and-lambda-routing) for details.
|