@action-llama/action-llama 0.12.2 → 0.13.1
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/{docs/agent-reference → agent-docs}/AGENTS.md +31 -15
- 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-runner.d.ts +3 -2
- package/dist/agents/container-runner.d.ts.map +1 -1
- package/dist/agents/container-runner.js +12 -12
- package/dist/agents/container-runner.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/agents/runner.d.ts +3 -2
- package/dist/agents/runner.d.ts.map +1 -1
- package/dist/agents/runner.js +14 -14
- package/dist/agents/runner.js.map +1 -1
- package/dist/build-info.json +1 -1
- package/dist/cli/commands/doctor.d.ts +1 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +53 -15
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/env.d.ts +4 -0
- package/dist/cli/commands/env.d.ts.map +1 -1
- package/dist/cli/commands/env.js +41 -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/logs.d.ts.map +1 -1
- package/dist/cli/commands/logs.js +25 -20
- package/dist/cli/commands/logs.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.d.ts +1 -0
- package/dist/cli/commands/push.d.ts.map +1 -1
- package/dist/cli/commands/push.js +2 -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.d.ts.map +1 -1
- package/dist/cli/commands/run.js +21 -46
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +62 -2
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +23 -7
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/stop.d.ts +1 -0
- package/dist/cli/commands/stop.d.ts.map +1 -1
- package/dist/cli/commands/stop.js +3 -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/cli/main.js +12 -0
- package/dist/cli/main.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/hetzner-api.d.ts +14 -3
- package/dist/cloud/vps/hetzner-api.d.ts.map +1 -1
- package/dist/cloud/vps/hetzner-api.js +24 -11
- package/dist/cloud/vps/hetzner-api.js.map +1 -1
- package/dist/cloud/vps/provision.js +29 -6
- 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 +2 -0
- package/dist/credentials/builtins/index.js.map +1 -1
- 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 +1 -0
- package/dist/docker/local-runtime.d.ts.map +1 -1
- package/dist/docker/local-runtime.js +9 -6
- package/dist/docker/local-runtime.js.map +1 -1
- package/dist/gateway/index.d.ts.map +1 -1
- package/dist/gateway/index.js +5 -4
- package/dist/gateway/index.js.map +1 -1
- package/dist/gateway/routes/logs.d.ts.map +1 -1
- package/dist/gateway/routes/logs.js +29 -111
- package/dist/gateway/routes/logs.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 +7 -11
- package/dist/remote/bootstrap.js.map +1 -1
- package/dist/remote/push.d.ts +6 -0
- package/dist/remote/push.d.ts.map +1 -1
- package/dist/remote/push.js +172 -91
- package/dist/remote/push.js.map +1 -1
- package/dist/remote/ssh.d.ts +1 -0
- package/dist/remote/ssh.d.ts.map +1 -1
- package/dist/remote/ssh.js +8 -0
- package/dist/remote/ssh.js.map +1 -1
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +56 -7
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/watcher.d.ts +1 -1
- package/dist/scheduler/watcher.d.ts.map +1 -1
- package/dist/scheduler/watcher.js +5 -6
- package/dist/scheduler/watcher.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/shared/credentials.d.ts +8 -18
- package/dist/shared/credentials.d.ts.map +1 -1
- package/dist/shared/credentials.js +8 -62
- package/dist/shared/credentials.js.map +1 -1
- package/dist/shared/server.d.ts +2 -0
- package/dist/shared/server.d.ts.map +1 -1
- package/dist/shared/server.js.map +1 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +1 -1
- package/dist/tui/App.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/registry.d.ts.map +1 -1
- package/dist/webhooks/registry.js +9 -3
- package/dist/webhooks/registry.js.map +1 -1
- package/dist/webhooks/types.d.ts +3 -1
- package/dist/webhooks/types.d.ts.map +1 -1
- package/docker/bin/_http-exit +17 -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 -75
- package/docs/examples/dev/README.md +0 -28
- package/docs/examples/dev/agent-config.toml +0 -18
- package/docs/examples/devops/ACTIONS.md +0 -33
- package/docs/examples/devops/README.md +0 -23
- package/docs/examples/devops/agent-config.toml +0 -13
- package/docs/examples/index.md +0 -15
- package/docs/examples/reviewer/ACTIONS.md +0 -37
- package/docs/examples/reviewer/README.md +0 -22
- package/docs/examples/reviewer/agent-config.toml +0 -11
- 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
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
# agent-config.toml Reference
|
|
2
|
-
|
|
3
|
-
Each agent has an `agent-config.toml` file in its directory. The agent name is derived from the directory name and should not be included in the config.
|
|
4
|
-
|
|
5
|
-
## Full Annotated Example
|
|
6
|
-
|
|
7
|
-
```toml
|
|
8
|
-
# Required: credential types the agent needs at runtime
|
|
9
|
-
# Instance is resolved automatically: agents/<name>/ first, then default/
|
|
10
|
-
credentials = ["github_token", "git_ssh", "sentry_token"]
|
|
11
|
-
|
|
12
|
-
# Optional: cron schedule (standard cron syntax)
|
|
13
|
-
# Agent must have at least one of: schedule, webhooks
|
|
14
|
-
schedule = "*/5 * * * *"
|
|
15
|
-
|
|
16
|
-
# Optional: number of concurrent runs allowed (default: 1)
|
|
17
|
-
# When scale > 1, use LOCK/UNLOCK in your actions to coordinate
|
|
18
|
-
# and prevent instances from working on the same resource.
|
|
19
|
-
scale = 2
|
|
20
|
-
|
|
21
|
-
# Optional: max runtime in seconds (default: falls back to [local].timeout, then 900)
|
|
22
|
-
# On AWS ECS, agents with timeout <= 900 automatically route to Lambda
|
|
23
|
-
# for faster cold starts (~1-2s vs ~30-60s on Fargate). Agents with
|
|
24
|
-
# timeout > 900 run on ECS Fargate.
|
|
25
|
-
timeout = 600
|
|
26
|
-
|
|
27
|
-
# Required: LLM model configuration
|
|
28
|
-
[model]
|
|
29
|
-
provider = "anthropic" # LLM provider: anthropic, openai, groq, google, xai, mistral, openrouter, or custom
|
|
30
|
-
model = "claude-sonnet-4-20250514" # Model ID (e.g., claude-sonnet-4-20250514, gpt-4o, gemini-2.0-flash-exp)
|
|
31
|
-
thinkingLevel = "medium" # Optional: off | minimal | low | medium | high | xhigh (for models with reasoning support)
|
|
32
|
-
authType = "api_key" # api_key | oauth_token | pi_auth
|
|
33
|
-
|
|
34
|
-
# Optional: webhook triggers (instead of or in addition to schedule)
|
|
35
|
-
# Each source references a named webhook defined in the project's config.toml
|
|
36
|
-
[[webhooks]]
|
|
37
|
-
source = "my-github" # Required: references [webhooks.my-github] in config.toml
|
|
38
|
-
repos = ["acme/app"] # Filter to specific repos (optional)
|
|
39
|
-
events = ["issues"] # GitHub event types (optional)
|
|
40
|
-
actions = ["labeled"] # GitHub event actions (optional)
|
|
41
|
-
labels = ["agent"] # Only trigger on issues with these labels (optional)
|
|
42
|
-
|
|
43
|
-
[[webhooks]]
|
|
44
|
-
source = "my-sentry" # Required: references [webhooks.my-sentry] in config.toml
|
|
45
|
-
resources = ["error", "event_alert"] # Sentry resource types (optional)
|
|
46
|
-
|
|
47
|
-
# Optional: preflight steps — run before the LLM session starts
|
|
48
|
-
# Each step runs a built-in provider to stage data the agent will reference
|
|
49
|
-
[[preflight]]
|
|
50
|
-
provider = "git-clone" # Clone a repo into the workspace
|
|
51
|
-
required = true # If true (default), abort if this step fails
|
|
52
|
-
[preflight.params]
|
|
53
|
-
repo = "acme/app" # Short "owner/repo" or full URL
|
|
54
|
-
dest = "/tmp/repo"
|
|
55
|
-
depth = 1 # Optional: shallow clone
|
|
56
|
-
|
|
57
|
-
[[preflight]]
|
|
58
|
-
provider = "http" # Fetch a URL and write the response to a file
|
|
59
|
-
required = false # Optional step — warn and continue on failure
|
|
60
|
-
[preflight.params]
|
|
61
|
-
url = "https://api.internal/v1/flags"
|
|
62
|
-
output = "/tmp/context/flags.json"
|
|
63
|
-
headers = { Authorization = "Bearer ${INTERNAL_TOKEN}" }
|
|
64
|
-
|
|
65
|
-
[[preflight]]
|
|
66
|
-
provider = "shell" # Run a shell command
|
|
67
|
-
[preflight.params]
|
|
68
|
-
command = "gh issue list --repo acme/app --label P1 --json number,title,body --limit 20"
|
|
69
|
-
output = "/tmp/context/issues.json" # Optional: capture stdout to file
|
|
70
|
-
|
|
71
|
-
# Optional: custom parameters injected into the agent prompt
|
|
72
|
-
[params]
|
|
73
|
-
repos = ["acme/app", "acme/api"]
|
|
74
|
-
triggerLabel = "agent"
|
|
75
|
-
assignee = "bot-user"
|
|
76
|
-
sentryOrg = "acme"
|
|
77
|
-
sentryProjects = ["web-app", "api"]
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Field Reference
|
|
81
|
-
|
|
82
|
-
| Field | Type | Required | Description |
|
|
83
|
-
|-------|------|----------|-------------|
|
|
84
|
-
| `credentials` | string[] | Yes | Credential refs as `"type:instance"` needed at runtime |
|
|
85
|
-
| `schedule` | string | No* | Cron expression for polling |
|
|
86
|
-
| `scale` | number | No | Number of concurrent runs allowed (default: 1). Set to `0` to disable the agent. Use lock skills in your actions to coordinate instances. See [Resource Locks](agents.md#resource-locks). |
|
|
87
|
-
| `timeout` | number | No | Max runtime in seconds. Falls back to `[local].timeout` in project config, then `900`. On AWS ECS, agents with timeout <= 900 auto-route to Lambda for faster startup. See [Timeout](#timeout). |
|
|
88
|
-
| `model` | table | No | LLM model configuration (falls back to `[model]` in project `config.toml`) |
|
|
89
|
-
| `model.provider` | string | Yes* | LLM provider ("anthropic", "openai", "groq", "google", "xai", "mistral", "openrouter", or "custom") |
|
|
90
|
-
| `model.model` | string | Yes* | Model ID |
|
|
91
|
-
| `model.thinkingLevel` | string | No | Thinking budget level: off, minimal, low, medium, high, xhigh. Only relevant for Claude Sonnet/Opus. Omit for other models. |
|
|
92
|
-
| `model.authType` | string | Yes* | Auth method for the provider |
|
|
93
|
-
| `webhooks` | array | No* | Array of webhook trigger objects |
|
|
94
|
-
| `preflight` | array | No | Array of preflight steps that run before the LLM session. See [Preflight](#preflight). |
|
|
95
|
-
| `params` | table | No | Custom key-value params for the agent prompt |
|
|
96
|
-
|
|
97
|
-
*At least one of `schedule` or `webhooks` is required (unless `scale = 0`). *Required within `[model]` if the agent defines its own model block (otherwise inherits from project `config.toml`).
|
|
98
|
-
|
|
99
|
-
## Scale
|
|
100
|
-
|
|
101
|
-
The `scale` field controls how many instances of an agent can run concurrently. This is useful for agents that handle high-volume workloads or when you want to process multiple tasks simultaneously.
|
|
102
|
-
|
|
103
|
-
- **Default**: 1 (only one instance can run at a time)
|
|
104
|
-
- **Minimum**: 0 (disables the agent — no runners, cron jobs, or webhook bindings are created)
|
|
105
|
-
- **Maximum**: No hard limit, but consider system resources and model API rate limits
|
|
106
|
-
|
|
107
|
-
### How it works
|
|
108
|
-
|
|
109
|
-
1. **Scheduled runs**: If a cron trigger fires but all agent instances are busy, the scheduled run is skipped with a warning
|
|
110
|
-
2. **Webhook events**: If a webhook arrives but all instances are busy, the event is queued (up to `workQueueSize` limit in global config, default: 100)
|
|
111
|
-
3. **Agent calls**: If one agent calls another but all target instances are busy, the call is queued in the same work queue and processed when a runner frees up
|
|
112
|
-
|
|
113
|
-
### Example use cases
|
|
114
|
-
|
|
115
|
-
- **Dev agent** with `scale = 3`: Handle multiple GitHub issues simultaneously
|
|
116
|
-
- **Review agent** with `scale = 2`: Review multiple PRs in parallel
|
|
117
|
-
- **Monitoring agent** with `scale = 1`: Ensure only one instance processes alerts at a time
|
|
118
|
-
- **Disabled agent** with `scale = 0`: Keep the config in the project but don't run it
|
|
119
|
-
|
|
120
|
-
### Resource considerations
|
|
121
|
-
|
|
122
|
-
Each parallel instance:
|
|
123
|
-
- Uses separate Docker containers (in Docker mode)
|
|
124
|
-
- Has independent logging streams
|
|
125
|
-
- May consume LLM API quota concurrently
|
|
126
|
-
- Uses system memory and CPU
|
|
127
|
-
|
|
128
|
-
## Timeout
|
|
129
|
-
|
|
130
|
-
The `timeout` field controls the maximum runtime for an agent invocation. When the timeout expires, the container is terminated.
|
|
131
|
-
|
|
132
|
-
**Resolution order:** `agent-config.toml timeout` -> `config.toml [local].timeout` -> `900` (default)
|
|
133
|
-
|
|
134
|
-
This means you can set a project-wide default in `[local].timeout` and override it per-agent.
|
|
135
|
-
|
|
136
|
-
### Automatic Lambda routing (AWS ECS)
|
|
137
|
-
|
|
138
|
-
When using `cloud.provider = "ecs"`, agents are automatically routed to the most efficient AWS compute service based on their effective timeout:
|
|
139
|
-
|
|
140
|
-
| Effective timeout | Runtime | Cold start | Cost |
|
|
141
|
-
|---|---|---|---|
|
|
142
|
-
| **<= 900s** (15 min) | **AWS Lambda** | ~1-2s | Lower (pay per 100ms) |
|
|
143
|
-
| **> 900s** | **ECS Fargate** | ~30-60s | Higher (pay per second, 1-min minimum) |
|
|
144
|
-
|
|
145
|
-
This routing is automatic — you don't need to configure anything beyond setting the timeout. Both runtimes use the same ECR images (built via CodeBuild) and the same Secrets Manager credentials.
|
|
146
|
-
|
|
147
|
-
**Why Lambda is faster:** Lambda keeps your container image warm in a pre-provisioned execution environment. When a function is invoked, Lambda can start executing in 1-2 seconds. ECS Fargate, by contrast, must provision a new VM, pull the container image, and start the container — which takes 30-60 seconds.
|
|
148
|
-
|
|
149
|
-
**When to use a short timeout:** If your agent typically finishes in under 15 minutes (e.g., responding to a webhook, triaging an issue, reviewing a small PR), set `timeout = 600` or similar. The agent gets faster startup and lower cost on AWS. If an agent needs more than 15 minutes (e.g., large refactoring tasks, long-running monitoring loops), use a longer timeout and it will route to ECS Fargate automatically.
|
|
150
|
-
|
|
151
|
-
### Lambda IAM roles
|
|
152
|
-
|
|
153
|
-
When `al doctor -c` runs, it automatically creates Lambda execution roles (`al-{agentName}-lambda-role`) for agents whose effective timeout is <= 900s. These roles include permissions for Secrets Manager access, CloudWatch Logs, and ECR image pull. You can override the role with `cloud.lambdaRoleArn` in `config.toml`.
|
|
154
|
-
|
|
155
|
-
### Examples
|
|
156
|
-
|
|
157
|
-
```toml
|
|
158
|
-
# Fast webhook responder — routes to Lambda on AWS
|
|
159
|
-
timeout = 300 # 5 minutes
|
|
160
|
-
|
|
161
|
-
# Medium-length task — still fits Lambda
|
|
162
|
-
timeout = 900 # 15 minutes (Lambda max)
|
|
163
|
-
|
|
164
|
-
# Long-running agent — routes to ECS Fargate
|
|
165
|
-
timeout = 3600 # 1 hour
|
|
166
|
-
|
|
167
|
-
# Omit timeout — uses [local].timeout or defaults to 900s
|
|
168
|
-
# (routes to Lambda on AWS since 900 <= 900)
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
## Preflight
|
|
172
|
-
|
|
173
|
-
Preflight steps run mechanical data-staging tasks after credentials are loaded but before the LLM session starts. They fetch data, clone repos, or run commands to prepare the workspace so the agent starts with everything it needs — instead of spending tokens fetching context at runtime.
|
|
174
|
-
|
|
175
|
-
### How it works
|
|
176
|
-
|
|
177
|
-
1. Steps run **sequentially** in the order they appear in `agent-config.toml`
|
|
178
|
-
2. Steps run **inside the container** (or host process in `--no-docker` mode) after credential/env setup
|
|
179
|
-
3. Providers write files to disk — your ACTIONS.md references the staged files
|
|
180
|
-
4. Environment variable interpolation is supported: `${VAR_NAME}` in string params is resolved against `process.env` (which already has credentials injected)
|
|
181
|
-
|
|
182
|
-
### Step fields
|
|
183
|
-
|
|
184
|
-
Each `[[preflight]]` entry has these fields:
|
|
185
|
-
|
|
186
|
-
| Field | Type | Required | Description |
|
|
187
|
-
|-------|------|----------|-------------|
|
|
188
|
-
| `provider` | string | Yes | Provider name: `shell`, `http`, or `git-clone` |
|
|
189
|
-
| `required` | boolean | No | If `true` (default), the agent aborts on failure. If `false`, logs a warning and continues. |
|
|
190
|
-
| `params` | table | Yes | Provider-specific parameters (see below) |
|
|
191
|
-
|
|
192
|
-
### Built-in providers
|
|
193
|
-
|
|
194
|
-
#### `shell`
|
|
195
|
-
|
|
196
|
-
Runs a command via `/bin/sh`. Optionally captures stdout to a file.
|
|
197
|
-
|
|
198
|
-
| Param | Type | Required | Description |
|
|
199
|
-
|-------|------|----------|-------------|
|
|
200
|
-
| `command` | string | Yes | Shell command to execute |
|
|
201
|
-
| `output` | string | No | File path to write stdout to. Parent directories are created automatically. |
|
|
202
|
-
|
|
203
|
-
```toml
|
|
204
|
-
[[preflight]]
|
|
205
|
-
provider = "shell"
|
|
206
|
-
[preflight.params]
|
|
207
|
-
command = "gh issue list --repo acme/app --label P1 --json number,title,body --limit 20"
|
|
208
|
-
output = "/tmp/context/issues.json"
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
#### `http`
|
|
212
|
-
|
|
213
|
-
Fetches a URL and writes the response body to a file.
|
|
214
|
-
|
|
215
|
-
| Param | Type | Required | Description |
|
|
216
|
-
|-------|------|----------|-------------|
|
|
217
|
-
| `url` | string | Yes | URL to fetch |
|
|
218
|
-
| `output` | string | Yes | File path to write the response body |
|
|
219
|
-
| `method` | string | No | HTTP method (default: `GET`) |
|
|
220
|
-
| `headers` | table | No | HTTP headers as key-value pairs |
|
|
221
|
-
| `body` | string | No | Request body (for POST/PUT) |
|
|
222
|
-
|
|
223
|
-
```toml
|
|
224
|
-
[[preflight]]
|
|
225
|
-
provider = "http"
|
|
226
|
-
required = false
|
|
227
|
-
[preflight.params]
|
|
228
|
-
url = "https://api.internal/v1/feature-flags"
|
|
229
|
-
output = "/tmp/context/flags.json"
|
|
230
|
-
headers = { Authorization = "Bearer ${INTERNAL_TOKEN}" }
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
#### `git-clone`
|
|
234
|
-
|
|
235
|
-
Clones a git repository. Short `"owner/repo"` names are expanded to `git@github.com:owner/repo.git`; full URLs are passed through. Git credentials (SSH key, HTTPS token) are already configured from the agent's credentials.
|
|
236
|
-
|
|
237
|
-
| Param | Type | Required | Description |
|
|
238
|
-
|-------|------|----------|-------------|
|
|
239
|
-
| `repo` | string | Yes | Repository: `"owner/repo"` or full URL |
|
|
240
|
-
| `dest` | string | Yes | Local path to clone into |
|
|
241
|
-
| `branch` | string | No | Branch to check out |
|
|
242
|
-
| `depth` | number | No | Shallow clone depth (e.g., `1`) |
|
|
243
|
-
|
|
244
|
-
```toml
|
|
245
|
-
[[preflight]]
|
|
246
|
-
provider = "git-clone"
|
|
247
|
-
[preflight.params]
|
|
248
|
-
repo = "acme/app"
|
|
249
|
-
dest = "/tmp/repo"
|
|
250
|
-
branch = "main"
|
|
251
|
-
depth = 1
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### Referencing staged files in ACTIONS.md
|
|
255
|
-
|
|
256
|
-
Preflight writes files to disk — your ACTIONS.md tells the LLM what's there:
|
|
257
|
-
|
|
258
|
-
```markdown
|
|
259
|
-
## Context
|
|
260
|
-
- The repo is cloned at `/tmp/repo`
|
|
261
|
-
- Open P1 issues are at `/tmp/context/issues.json`
|
|
262
|
-
- Feature flags (if available) are at `/tmp/context/flags.json`
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
### Notes
|
|
266
|
-
|
|
267
|
-
- The `shell` provider is the escape hatch — anything a built-in provider doesn't cover can be expressed as a shell command
|
|
268
|
-
- There is no per-step timeout — steps are bounded by the container-level timeout
|
|
269
|
-
- Environment variables set inside `shell` child processes do not propagate back to the agent's `process.env`
|
|
270
|
-
|
|
271
|
-
## Webhook Trigger Fields
|
|
272
|
-
|
|
273
|
-
Each `[[webhooks]]` entry has the following fields:
|
|
274
|
-
|
|
275
|
-
| Field | Type | Required | Description |
|
|
276
|
-
|-------|------|----------|-------------|
|
|
277
|
-
| `source` | string | Yes | Name of a webhook source from the project's `config.toml` (e.g. `"my-github"`) |
|
|
278
|
-
|
|
279
|
-
All filter fields below are optional. Omit all of them to trigger on everything from that source.
|
|
280
|
-
|
|
281
|
-
### GitHub filter fields
|
|
282
|
-
|
|
283
|
-
| Field | Type | Description |
|
|
284
|
-
|-------|------|-------------|
|
|
285
|
-
| `repos` | string[] | Filter to specific repos |
|
|
286
|
-
| `events` | string[] | Event types: issues, pull_request, push, etc. |
|
|
287
|
-
| `actions` | string[] | Event actions: opened, labeled, closed, etc. |
|
|
288
|
-
| `labels` | string[] | Only trigger when issue/PR has these labels |
|
|
289
|
-
| `assignee` | string | Only trigger when assigned to this user |
|
|
290
|
-
| `author` | string | Only trigger for this author |
|
|
291
|
-
| `branches` | string[] | Only trigger for these branches |
|
|
292
|
-
|
|
293
|
-
### Sentry filter fields
|
|
294
|
-
|
|
295
|
-
| Field | Type | Description |
|
|
296
|
-
|-------|------|-------------|
|
|
297
|
-
| `resources` | string[] | Resource types: event_alert, metric_alert, issue, error, comment |
|
|
298
|
-
|
|
299
|
-
## Model Configuration
|
|
300
|
-
|
|
301
|
-
The `[model]` section is optional — agents inherit the default model from the project's `config.toml`. Only add `[model]` to an agent config if you want to override the default for that specific agent.
|
|
302
|
-
|
|
303
|
-
See [Models](models.md) for all supported providers, model IDs, auth types, thinking levels, and credential setup.
|
|
304
|
-
|
|
305
|
-
## Cloud Runtimes
|
|
306
|
-
|
|
307
|
-
### Cloud Run (GCP)
|
|
308
|
-
|
|
309
|
-
When using Cloud Run mode (`cloud.provider = "cloud-run"` in `config.toml`), each agent automatically gets a per-agent service account (`al-{agentName}@{gcpProject}.iam.gserviceaccount.com`) that only has access to the credentials listed in that agent's `credentials` array. Run `al doctor -c` to create the service accounts and IAM bindings. See [Cloud Run docs](cloud-run.md) for details.
|
|
310
|
-
|
|
311
|
-
### ECS Fargate (AWS)
|
|
312
|
-
|
|
313
|
-
When using ECS mode (`cloud.provider = "ecs"` in `config.toml`), each agent automatically uses a per-agent IAM task role (`al-{agentName}-task-role`) that only has access to the credentials listed in that agent's `credentials` array. The task role ARN is derived from the ECR repository's account ID. See [ECS docs](ecs.md) for setup instructions including how to create the per-agent task roles.
|
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
|