@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.
Files changed (161) hide show
  1. package/README.md +4 -17
  2. package/{docs/agent-reference → agent-docs}/AGENTS.md +27 -0
  3. package/{docs/agent-reference → agent-docs}/skills/README.md +1 -0
  4. package/agent-docs/skills/calls.md +82 -0
  5. package/{docs/agent-reference → agent-docs}/skills/resource-locks.md +13 -7
  6. package/{docs/agent-reference → agent-docs}/skills/signals.md +1 -1
  7. package/dist/agents/container-entry.d.ts.map +1 -1
  8. package/dist/agents/container-entry.js +15 -0
  9. package/dist/agents/container-entry.js.map +1 -1
  10. package/dist/agents/prompt.d.ts.map +1 -1
  11. package/dist/agents/prompt.js +3 -2
  12. package/dist/agents/prompt.js.map +1 -1
  13. package/dist/build-info.json +1 -1
  14. package/dist/cli/commands/doctor.d.ts.map +1 -1
  15. package/dist/cli/commands/doctor.js +15 -0
  16. package/dist/cli/commands/doctor.js.map +1 -1
  17. package/dist/cli/commands/env.d.ts.map +1 -1
  18. package/dist/cli/commands/env.js +4 -0
  19. package/dist/cli/commands/env.js.map +1 -1
  20. package/dist/cli/commands/kill.js +2 -2
  21. package/dist/cli/commands/kill.js.map +1 -1
  22. package/dist/cli/commands/pause.js +2 -2
  23. package/dist/cli/commands/pause.js.map +1 -1
  24. package/dist/cli/commands/push.js +1 -1
  25. package/dist/cli/commands/push.js.map +1 -1
  26. package/dist/cli/commands/resume.js +2 -2
  27. package/dist/cli/commands/resume.js.map +1 -1
  28. package/dist/cli/commands/run.js +2 -2
  29. package/dist/cli/commands/run.js.map +1 -1
  30. package/dist/cli/commands/status.js +5 -5
  31. package/dist/cli/commands/status.js.map +1 -1
  32. package/dist/cli/commands/stop.js +2 -2
  33. package/dist/cli/commands/stop.js.map +1 -1
  34. package/dist/cli/gateway-client.d.ts +6 -0
  35. package/dist/cli/gateway-client.d.ts.map +1 -1
  36. package/dist/cli/gateway-client.js +19 -0
  37. package/dist/cli/gateway-client.js.map +1 -1
  38. package/dist/cloud/vps/constants.d.ts +1 -1
  39. package/dist/cloud/vps/constants.d.ts.map +1 -1
  40. package/dist/cloud/vps/constants.js +9 -0
  41. package/dist/cloud/vps/constants.js.map +1 -1
  42. package/dist/cloud/vps/provision.js +11 -1
  43. package/dist/cloud/vps/provision.js.map +1 -1
  44. package/dist/cloud/vps/ssh.d.ts +7 -0
  45. package/dist/cloud/vps/ssh.d.ts.map +1 -1
  46. package/dist/cloud/vps/ssh.js +15 -1
  47. package/dist/cloud/vps/ssh.js.map +1 -1
  48. package/dist/credentials/builtins/index.d.ts.map +1 -1
  49. package/dist/credentials/builtins/index.js +6 -0
  50. package/dist/credentials/builtins/index.js.map +1 -1
  51. package/dist/credentials/builtins/mintlify-token.d.ts +4 -0
  52. package/dist/credentials/builtins/mintlify-token.d.ts.map +1 -0
  53. package/dist/credentials/builtins/mintlify-token.js +14 -0
  54. package/dist/credentials/builtins/mintlify-token.js.map +1 -0
  55. package/dist/credentials/builtins/mintlify-webhook-secret.d.ts +4 -0
  56. package/dist/credentials/builtins/mintlify-webhook-secret.d.ts.map +1 -0
  57. package/dist/credentials/builtins/mintlify-webhook-secret.js +12 -0
  58. package/dist/credentials/builtins/mintlify-webhook-secret.js.map +1 -0
  59. package/dist/credentials/builtins/reddit-oauth.d.ts +4 -0
  60. package/dist/credentials/builtins/reddit-oauth.d.ts.map +1 -0
  61. package/dist/credentials/builtins/reddit-oauth.js +71 -0
  62. package/dist/credentials/builtins/reddit-oauth.js.map +1 -0
  63. package/dist/docker/local-runtime.d.ts +0 -3
  64. package/dist/docker/local-runtime.d.ts.map +1 -1
  65. package/dist/docker/local-runtime.js +1 -34
  66. package/dist/docker/local-runtime.js.map +1 -1
  67. package/dist/docker/runtime.d.ts +0 -4
  68. package/dist/docker/runtime.d.ts.map +1 -1
  69. package/dist/gateway/index.d.ts +3 -0
  70. package/dist/gateway/index.d.ts.map +1 -1
  71. package/dist/gateway/index.js +23 -3
  72. package/dist/gateway/index.js.map +1 -1
  73. package/dist/gateway/routes/calls.d.ts +2 -1
  74. package/dist/gateway/routes/calls.d.ts.map +1 -1
  75. package/dist/gateway/routes/calls.js +12 -1
  76. package/dist/gateway/routes/calls.js.map +1 -1
  77. package/dist/gateway/routes/control.d.ts +2 -0
  78. package/dist/gateway/routes/control.d.ts.map +1 -1
  79. package/dist/gateway/routes/control.js +30 -2
  80. package/dist/gateway/routes/control.js.map +1 -1
  81. package/dist/gateway/routes/locks.d.ts +2 -0
  82. package/dist/gateway/routes/locks.d.ts.map +1 -1
  83. package/dist/gateway/routes/locks.js +20 -0
  84. package/dist/gateway/routes/locks.js.map +1 -1
  85. package/dist/gateway/routes/signals.d.ts +2 -1
  86. package/dist/gateway/routes/signals.d.ts.map +1 -1
  87. package/dist/gateway/routes/signals.js +21 -1
  88. package/dist/gateway/routes/signals.js.map +1 -1
  89. package/dist/remote/bootstrap.d.ts +2 -0
  90. package/dist/remote/bootstrap.d.ts.map +1 -1
  91. package/dist/remote/bootstrap.js +5 -9
  92. package/dist/remote/bootstrap.js.map +1 -1
  93. package/dist/remote/push.js +85 -71
  94. package/dist/remote/push.js.map +1 -1
  95. package/dist/scheduler/events.d.ts +78 -0
  96. package/dist/scheduler/events.d.ts.map +1 -0
  97. package/dist/scheduler/events.js +65 -0
  98. package/dist/scheduler/events.js.map +1 -0
  99. package/dist/scheduler/execution.d.ts +15 -0
  100. package/dist/scheduler/execution.d.ts.map +1 -1
  101. package/dist/scheduler/execution.js +31 -2
  102. package/dist/scheduler/execution.js.map +1 -1
  103. package/dist/scheduler/index.d.ts +5 -0
  104. package/dist/scheduler/index.d.ts.map +1 -1
  105. package/dist/scheduler/index.js +61 -17
  106. package/dist/scheduler/index.js.map +1 -1
  107. package/dist/scheduler/webhook-setup.d.ts.map +1 -1
  108. package/dist/scheduler/webhook-setup.js +16 -0
  109. package/dist/scheduler/webhook-setup.js.map +1 -1
  110. package/dist/setup/scaffold.js +2 -2
  111. package/dist/setup/scaffold.js.map +1 -1
  112. package/dist/shared/config.d.ts +1 -0
  113. package/dist/shared/config.d.ts.map +1 -1
  114. package/dist/shared/config.js.map +1 -1
  115. package/dist/webhooks/definitions/github.d.ts.map +1 -1
  116. package/dist/webhooks/definitions/github.js +13 -0
  117. package/dist/webhooks/definitions/github.js.map +1 -1
  118. package/dist/webhooks/providers/github.d.ts.map +1 -1
  119. package/dist/webhooks/providers/github.js +6 -0
  120. package/dist/webhooks/providers/github.js.map +1 -1
  121. package/dist/webhooks/providers/mintlify.d.ts +9 -0
  122. package/dist/webhooks/providers/mintlify.d.ts.map +1 -0
  123. package/dist/webhooks/providers/mintlify.js +69 -0
  124. package/dist/webhooks/providers/mintlify.js.map +1 -0
  125. package/dist/webhooks/types.d.ts +9 -1
  126. package/dist/webhooks/types.d.ts.map +1 -1
  127. package/docker/bin/_http-exit +35 -0
  128. package/docker/bin/al-call +10 -4
  129. package/docker/bin/al-check +9 -3
  130. package/docker/bin/al-status +1 -1
  131. package/docker/bin/al-wait +11 -3
  132. package/docker/bin/rlock +9 -2
  133. package/docker/bin/rlock-heartbeat +9 -2
  134. package/docker/bin/runlock +9 -2
  135. package/package.json +2 -2
  136. package/docs/agent-config-reference.md +0 -313
  137. package/docs/agents.md +0 -256
  138. package/docs/cloud-run.md +0 -173
  139. package/docs/cloud.md +0 -98
  140. package/docs/commands.md +0 -286
  141. package/docs/config-reference.md +0 -241
  142. package/docs/creating-agents.md +0 -147
  143. package/docs/credentials.md +0 -167
  144. package/docs/docker.md +0 -323
  145. package/docs/ecs.md +0 -795
  146. package/docs/examples/dev/ACTIONS.md +0 -96
  147. package/docs/examples/dev/README.md +0 -42
  148. package/docs/examples/dev/agent-config.toml +0 -24
  149. package/docs/examples/index.md +0 -15
  150. package/docs/examples/planner/ACTIONS.md +0 -177
  151. package/docs/examples/planner/README.md +0 -39
  152. package/docs/examples/planner/agent-config.toml +0 -31
  153. package/docs/examples/reviewer/ACTIONS.md +0 -153
  154. package/docs/examples/reviewer/README.md +0 -39
  155. package/docs/examples/reviewer/agent-config.toml +0 -21
  156. package/docs/models.md +0 -191
  157. package/docs/vps-deployment.md +0 -285
  158. package/docs/web-dashboard.md +0 -113
  159. package/docs/webhooks.md +0 -152
  160. /package/{docs/agent-reference → agent-docs}/skills/credentials.md +0 -0
  161. /package/{docs/agent-reference → agent-docs}/skills/environment.md +0 -0
@@ -1,167 +0,0 @@
1
- # Credentials
2
-
3
- Credentials are stored in `~/.action-llama/credentials/<type>/<instance>/<field>`. Each credential type is a directory containing one file per field. Reference them in `agent-config.toml` by type name (e.g. `"github_token"`) for the `default` instance, or use `"type:instance"` for a named instance (e.g. `"git_ssh:botty"`).
4
-
5
- ## Built-in Credentials
6
-
7
- | Type | Fields | Description | Runtime Injection |
8
- |------|--------|-------------|-------------------|
9
- | `github_token` | `token` | GitHub PAT with repo and workflow scopes | `GITHUB_TOKEN` and `GH_TOKEN` env vars |
10
- | `anthropic_key` | `token` | Anthropic API key, OAuth token, or pi auth | _(read by SDK)_ |
11
- | `openai_key` | `token` | OpenAI API key | _(read by SDK)_ |
12
- | `groq_key` | `token` | Groq API key | _(read by SDK)_ |
13
- | `google_key` | `token` | Google Gemini API key | _(read by SDK)_ |
14
- | `xai_key` | `token` | xAI API key | _(read by SDK)_ |
15
- | `mistral_key` | `token` | Mistral API key | _(read by SDK)_ |
16
- | `openrouter_key` | `token` | OpenRouter API key | _(read by SDK)_ |
17
- | `custom_key` | `token` | Custom provider API key | _(read by SDK)_ |
18
- | `sentry_token` | `token` | Sentry auth token for error monitoring | `SENTRY_AUTH_TOKEN` env var |
19
- | `linear_token` | `token` | Linear personal API token for workspace access | `LINEAR_API_TOKEN` env var |
20
- | `linear_oauth` | `client_id`, `client_secret`, `access_token`, `refresh_token` | Linear OAuth2 credentials for workspace access | `LINEAR_CLIENT_ID`, `LINEAR_CLIENT_SECRET`, `LINEAR_ACCESS_TOKEN`, `LINEAR_REFRESH_TOKEN` env vars |
21
- | `bugsnag_token` | `token` | Bugsnag auth token for error monitoring and release management | `BUGSNAG_AUTH_TOKEN` env var |
22
- | `netlify_token` | `token` | Netlify Personal Access Token for site management | `NETLIFY_AUTH_TOKEN` env var |
23
- | `git_ssh` | `id_rsa`, `username`, `email` | SSH private key + git author identity | SSH key mounted as file; `GIT_AUTHOR_NAME`/`GIT_AUTHOR_EMAIL`/`GIT_COMMITTER_NAME`/`GIT_COMMITTER_EMAIL` set from `username`/`email` |
24
- | `gateway_api_key` | `key` | API key for dashboard and CLI access to the gateway | _(used by gateway + CLI)_ |
25
- | `github_webhook_secret` | `secret` | Shared secret for GitHub webhook verification | _(used by gateway)_ |
26
- | `sentry_client_secret` | `secret` | Client secret for Sentry webhook verification | _(used by gateway)_ |
27
- | `linear_webhook_secret` | `secret` | Shared secret for Linear webhook verification | _(used by gateway)_ |
28
- | `x_twitter_api` | `api_key`, `api_secret`, `bearer_token`, `access_token`, `access_token_secret` | X (Twitter) API credentials for platform access | `X_API_KEY`, `X_API_SECRET`, `X_BEARER_TOKEN`, `X_ACCESS_TOKEN`, `X_ACCESS_TOKEN_SECRET` env vars |
29
- | `aws` | `access_key_id`, `secret_access_key`, `default_region` | AWS credentials for managing AWS resources | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_DEFAULT_REGION` env vars |
30
- | `vultr_api_key` | `api_key` | Vultr API key for VPS provisioning (not needed at agent runtime) | `VULTR_API_KEY` env var |
31
-
32
- ## How Credentials Work
33
-
34
- 1. **Configuration**: List credential types in your agent's `agent-config.toml`:
35
- ```toml
36
- credentials = ["github_token", "git_ssh"]
37
- ```
38
-
39
- 2. **Storage**: Credential values live in `~/.action-llama/credentials/<type>/<instance>/<field>`. Each field is a plain text file.
40
-
41
- 3. **Injection**: When an agent runs, the credentials it requires are injected into the container.
42
-
43
- 4. **Git identity**: The `git_ssh` credential includes `username` and `email` fields (prompted during `al new`/`al doctor`). These are injected as `GIT_AUTHOR_NAME`/`GIT_AUTHOR_EMAIL` and `GIT_COMMITTER_NAME`/`GIT_COMMITTER_EMAIL` env vars at runtime, so `git commit` works without requiring `git config`.
44
-
45
- ## Named Instances
46
-
47
- Each credential type supports named instances. For example, you could have webhook secrets for multiple GitHub orgs:
48
-
49
- ```
50
- ~/.action-llama/credentials/github_webhook_secret/MyOrg/secret
51
- ~/.action-llama/credentials/github_webhook_secret/OtherOrg/secret
52
- ```
53
-
54
- Or multiple SSH keys:
55
-
56
- ```
57
- ~/.action-llama/credentials/git_ssh/default/id_rsa
58
- ~/.action-llama/credentials/git_ssh/default/username
59
- ~/.action-llama/credentials/git_ssh/botty/id_rsa
60
- ~/.action-llama/credentials/git_ssh/botty/username
61
- ```
62
-
63
- By default, just reference `"git_ssh"` — this resolves to the `default` instance. To use a named instance, use colon syntax: `"git_ssh:botty"`.
64
-
65
- ## Managing Credentials
66
-
67
- ### `al creds add`
68
-
69
- Add or update a credential interactively. Runs validation for the credential type (e.g. API key format, GitHub API check):
70
-
71
- ```bash
72
- al creds add github_token # adds github_token:default
73
- al creds add github_webhook_secret:myapp
74
- al creds add git_ssh:prod
75
- ```
76
-
77
- ### `al creds rm`
78
-
79
- Remove a credential:
80
-
81
- ```bash
82
- al creds rm github_token # removes github_token:default
83
- al creds rm github_webhook_secret:myapp
84
- ```
85
-
86
- ### `al creds ls`
87
-
88
- List all stored credentials grouped by type:
89
-
90
- ```bash
91
- al creds ls
92
- ```
93
-
94
- ### `al doctor`
95
-
96
- Scan all agents in a project and prompt for any missing credentials:
97
-
98
- ```bash
99
- al doctor -p .
100
- ```
101
-
102
- ### During `al new`
103
-
104
- The `al new` command prompts for the Anthropic credential during initial setup. Other credentials are configured per-agent by `al doctor` or `al creds add`.
105
-
106
- ### Manually
107
-
108
- Write credential files directly:
109
-
110
- ```bash
111
- mkdir -p ~/.action-llama/credentials/github_token/default
112
- echo "ghp_your_token_here" > ~/.action-llama/credentials/github_token/default/token
113
-
114
- mkdir -p ~/.action-llama/credentials/anthropic_key/default
115
- echo "sk-ant-api-your_key_here" > ~/.action-llama/credentials/anthropic_key/default/token
116
-
117
- mkdir -p ~/.action-llama/credentials/openai_key/default
118
- echo "sk-your_openai_key_here" > ~/.action-llama/credentials/openai_key/default/token
119
-
120
- mkdir -p ~/.action-llama/credentials/groq_key/default
121
- echo "gsk_your_groq_key_here" > ~/.action-llama/credentials/groq_key/default/token
122
-
123
- mkdir -p ~/.action-llama/credentials/bugsnag_token/default
124
- echo "your_bugsnag_token_here" > ~/.action-llama/credentials/bugsnag_token/default/token
125
-
126
- mkdir -p ~/.action-llama/credentials/netlify_token/default
127
- echo "your_netlify_token_here" > ~/.action-llama/credentials/netlify_token/default/token
128
- ```
129
-
130
- ### Anthropic Auth Methods
131
-
132
- Three auth methods are supported:
133
-
134
- - **`api_key`** — Standard API key (`sk-ant-api-...`). Set `authType = "api_key"` in model config.
135
- - **`oauth_token`** — OAuth token (`sk-ant-oat-...`). Set `authType = "oauth_token"`.
136
- - **`pi_auth`** — Use existing pi auth credentials (`~/.pi/agent/auth.json`). Set `authType = "pi_auth"`. No credential file needed.
137
-
138
- ## Webhook Secrets
139
-
140
- Webhook secrets use named credential instances. For example, to set up a GitHub webhook secret for your org:
141
-
142
- ```bash
143
- mkdir -p ~/.action-llama/credentials/github_webhook_secret/MyOrg
144
- echo "your-webhook-secret" > ~/.action-llama/credentials/github_webhook_secret/MyOrg/secret
145
- ```
146
-
147
- The gateway automatically loads secrets from all credential instances (e.g. `github_webhook_secret:MyOrg`, `sentry_client_secret:MyOrg`) and uses them to verify incoming webhook payloads. No global configuration is needed.
148
-
149
- ## Cloud Credential Sync
150
-
151
- When using cloud runtimes, credentials are automatically pushed to the cloud secret manager by `al doctor -c` or `al setup cloud`. See [Cloud Run docs](cloud-run.md) and [ECS docs](ecs.md) for details.
152
-
153
- ### Google Secret Manager (GSM)
154
-
155
- Secret naming: `{prefix}--{type}--{instance}--{field}` (dashes, since GSM disallows slashes).
156
-
157
- ### AWS Secrets Manager (ASM)
158
-
159
- Secret naming: `{prefix}/{type}/{instance}/{field}` (slashes).
160
-
161
- Requires `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` env vars or a configured AWS CLI (`aws configure`).
162
-
163
- ### VPS Filesystem (SSH)
164
-
165
- Secret naming: `~/.action-llama/credentials/{type}/{instance}/{field}` on the remote server (same layout as local).
166
-
167
- Credentials are transferred via SSH. No external secrets manager needed — same trust model as SSH access.
package/docs/docker.md DELETED
@@ -1,323 +0,0 @@
1
- # Container Isolation
2
-
3
- All agents run in isolated containers for security and consistency. Container isolation is always enabled.
4
-
5
- ## How it works
6
-
7
- When `al start` runs:
8
-
9
- 1. The base image (`al-agent:latest`) is built from `docker/Dockerfile` on first run
10
- 2. Per-agent images are built for any agent that has a custom `Dockerfile`
11
- 3. Each agent run launches a fresh container with:
12
- - Read-only root filesystem
13
- - Credentials mounted read-only at `/credentials/`
14
- - Writable tmpfs at `/tmp` (2GB)
15
- - All capabilities dropped, no-new-privileges
16
- - PID, memory, and CPU limits
17
- - Non-root user (uid 1000)
18
- - A unique shutdown secret for the anti-exfiltration kill switch
19
-
20
- ## Container runtime
21
-
22
- Each agent run is a short-lived container that boots, runs a single LLM session, and exits. The entry point is `node /app/dist/agents/container-entry.js`.
23
-
24
- ### Environment
25
-
26
- The container receives everything it needs via environment variables and mounts:
27
-
28
- | Env var | Description |
29
- |---------|-------------|
30
- | `AGENT_CONFIG` | JSON-serialized agent config (model, credentials, params) plus `ACTIONS.md` content |
31
- | `PROMPT` | The fully assembled prompt (`<agent-config>` + `<credential-context>` + trigger text) |
32
- | `TIMEOUT_SECONDS` | Max runtime in seconds (default: 3600). The container self-terminates if exceeded |
33
- | `GATEWAY_URL` | HTTP URL of the host gateway (local Docker only — used for credential fetch and shutdown) |
34
- | `SHUTDOWN_SECRET` | Unique per-run secret for the anti-exfiltration kill switch (local Docker only) |
35
-
36
- Credentials are injected in one of three ways depending on the runtime:
37
-
38
- | Runtime | Strategy | How it works |
39
- |---------|----------|--------------|
40
- | Local Docker | Volume mount | Files staged to a temp dir, mounted read-only at `/credentials/<type>/<instance>/<field>` |
41
- | Cloud Run | Gateway fetch | Container fetches credentials from `GATEWAY_URL/credentials/<secret>` on startup |
42
- | ECS Fargate | Env vars | Secrets Manager values injected as `AL_SECRET_<type>__<instance>__<field>` env vars |
43
-
44
- The container tries each strategy in order: volume mount, env vars, gateway. The first one that has data wins.
45
-
46
- ### Startup sequence
47
-
48
- 1. **Set working directory** — `chdir("/tmp")`
49
- 2. **Start self-termination timer** — kills the process with exit code 124 if `TIMEOUT_SECONDS` is exceeded
50
- 3. **Parse config** — reads `AGENT_CONFIG`, extracts `ACTIONS.md` content
51
- 4. **Load credentials** — from volume, env vars, or gateway (see table above)
52
- 5. **Inject env vars from credentials:**
53
- - `GITHUB_TOKEN` / `GH_TOKEN` from `github_token` credential
54
- - `SENTRY_AUTH_TOKEN` from `sentry_token` credential
55
- - `GIT_SSH_COMMAND` pointing to the mounted SSH key from `git_ssh` credential
56
- - `GIT_AUTHOR_NAME` / `GIT_AUTHOR_EMAIL` / `GIT_COMMITTER_NAME` / `GIT_COMMITTER_EMAIL` from `git_ssh` credential
57
- - Git HTTPS credential helper configured if `GITHUB_TOKEN` is set
58
- 6. **Create pi-coding-agent session** — initializes the LLM model, tools, and settings
59
- 7. **Send prompt** — delivers the pre-built prompt to the session
60
-
61
- ### Agent session
62
-
63
- The prompt is sent to the LLM with rate-limit retry (up to 5 attempts with exponential backoff, 30s to 5min). The LLM runs autonomously — reading files, executing commands, making API calls — until it finishes or hits an error.
64
-
65
- **Unrecoverable error detection:** The container watches for repeated auth/permission failures (e.g. "bad credentials", "permission denied", "resource not accessible by personal access token"). After 3 such errors, it aborts early rather than burning through retries.
66
-
67
- ### Exit codes
68
-
69
- | Code | Meaning |
70
- |------|---------|
71
- | 0 | Success — agent completed its work |
72
- | 1 | Error — missing config, credential failure, unrecoverable errors, or uncaught exception |
73
- | 124 | Timeout — `TIMEOUT_SECONDS` exceeded, container self-terminated |
74
-
75
- ### Log protocol
76
-
77
- The container communicates with the scheduler via structured JSON lines on stdout. This is how the scheduler tracks progress, surfaces errors in the TUI, and writes log files.
78
-
79
- **Structured log lines** have the format:
80
-
81
- ```json
82
- {"_log": true, "level": "info", "msg": "bash", "cmd": "git clone ...", "ts": 1234567890}
83
- ```
84
-
85
- The `_log: true` field distinguishes structured logs from plain text output. The scheduler parses these and forwards them to the logger at the appropriate level.
86
-
87
- | Field | Description |
88
- |-------|-------------|
89
- | `_log` | Always `true` — marker for structured log lines |
90
- | `level` | `"debug"`, `"info"`, `"warn"`, or `"error"` |
91
- | `msg` | Log message (e.g. `"bash"`, `"tool error"`, `"credentials loaded from volume"`) |
92
- | `ts` | Unix timestamp in milliseconds |
93
- | `...` | Additional fields vary by message (e.g. `cmd`, `tool`, `error`, `result`) |
94
-
95
- Key log messages emitted during a run:
96
-
97
- | Message | Level | When |
98
- |---------|-------|------|
99
- | `"container starting"` | info | Boot, includes `agentName` and `modelId` |
100
- | `"credentials loaded from ..."` | info | After credential loading (`volume`, `env vars`, or `gateway`) |
101
- | `"SSH key configured for git"` | info | After SSH key setup |
102
- | `"creating agent session"` | info | Before LLM session creation |
103
- | `"session created, sending prompt"` | info | Prompt delivery |
104
- | `"bash"` | info | Every bash tool call, with `cmd` field |
105
- | `"tool error"` | error | Failed tool call, with `tool`, `cmd`, and `result` fields |
106
- | `"rate limited, retrying prompt"` | warn | Rate limit hit, with `attempt` and `delayMs` |
107
- | `"run completed"` | info | Agent finished successfully |
108
- | `"no work to do"` | info | Agent found nothing to act on |
109
- | `"container timeout reached, self-terminating"` | error | Timeout exceeded |
110
-
111
- **Signal commands:**
112
-
113
- The container has signal commands installed at `/tmp/bin/` that write to `$AL_SIGNAL_DIR`:
114
-
115
- | Command | Description |
116
- |---------|-------------|
117
- | `al-rerun` | Request an immediate rerun to drain remaining backlog. Without this, the scheduler treats the run as complete and waits for the next scheduled tick. |
118
- | `al-status "<text>"` | Status update shown in the TUI. Example: `al-status "reviewing PR #42"` |
119
- | `al-return "<value>"` | Return a value to the calling agent. Used when this agent was invoked via `al-call`. |
120
- | `al-exit [code]` | Terminate with an exit code indicating an unrecoverable error. Defaults to 15. |
121
-
122
- **Agent-to-agent calls:**
123
-
124
- Agents can call other agents and retrieve structured results using shell commands injected into the container:
125
-
126
- - **`al-call <agent>`** — Call another agent. Pass context via stdin, get back a JSON response with a `callId`.
127
- - **`al-check <callId>`** — Check the status of a call (never blocks). Returns `{"status":"pending|running|completed|error", ...}`.
128
- - **`al-wait <callId> [callId...] [--timeout N]`** — Wait for one or more calls to complete (polls every 5s, default timeout 900s).
129
-
130
- Example:
131
- ```sh
132
- CALL_ID=$(echo "Review PR #42 on acme/app" | al-call reviewer | jq -r .callId)
133
- # ... do other work ...
134
- RESULT=$(al-wait "$CALL_ID" --timeout 600)
135
- echo "$RESULT" | jq ".\"$CALL_ID\".returnValue"
136
- ```
137
-
138
- The called agent receives an `<agent-call>` block with the caller name and context. To return a value, the called agent uses the `al-return` command:
139
- ```
140
- al-return "PR looks good. Approved with minor suggestions."
141
- ```
142
-
143
- Rules:
144
- - An agent cannot call itself (self-calls are rejected)
145
- - If all runners for the target agent are busy, the call is queued (up to `workQueueSize` limit in global config, default: 100)
146
- - Call chains are allowed (agent A calls B, B calls C) up to a configurable depth limit (`maxCallDepth` in `config.toml`, default: 3)
147
- - Called runs do not re-run — they respond to the single call
148
- - These commands require the gateway; they return errors if `GATEWAY_URL` is not set
149
-
150
- Any stdout line that is not valid JSON with `_log: true` is treated as plain agent output (the LLM's final text response).
151
-
152
- ## Base image
153
-
154
- The base image (`al-agent:latest`) is built automatically from the Action Llama package and includes the minimum needed for any agent:
155
-
156
- | Package | Why |
157
- |---------|-----|
158
- | `node:20-slim` | Runs the container entry point and pi-coding-agent SDK |
159
- | `git` | Clone repos, create branches, push commits |
160
- | `curl` | API calls (Sentry, arbitrary HTTP), anti-exfiltration shutdown |
161
- | `ca-certificates` | HTTPS for git, curl, npm |
162
- | `openssh-client` | SSH for `GIT_SSH_COMMAND` — git clone/push over SSH |
163
-
164
- The base image also copies the compiled Action Llama application (`dist/`) and installs its npm dependencies. The entry point is `node /app/dist/agents/container-entry.js`.
165
-
166
- ## Project base image
167
-
168
- The project `Dockerfile` (at the project root) lets you customize the base image for **all** agents in the project. It is created by `al new` and checked into git:
169
-
170
- ```
171
- my-project/
172
- Dockerfile <-- project base image (shared by all agents)
173
- config.toml
174
- dev/
175
- agent-config.toml
176
- ACTIONS.md
177
- reviewer/
178
- agent-config.toml
179
- ACTIONS.md
180
- ```
181
-
182
- By default, the project Dockerfile is a bare `FROM al-agent:latest` with no customizations. In this state, it is skipped entirely — agents build directly on `al-agent:latest` with no overhead.
183
-
184
- To customize, add `RUN`, `ENV`, or other instructions:
185
-
186
- ```dockerfile
187
- FROM al-agent:latest
188
-
189
- # Install tools shared by all agents
190
- RUN apk add --no-cache python3 py3-pip github-cli
191
-
192
- # Set shared environment variables
193
- ENV MY_ORG=acme
194
- ```
195
-
196
- When the project Dockerfile has customizations beyond the bare `FROM`, the build pipeline creates an intermediate image (`al-project-base:latest`) that all per-agent images layer on top of.
197
-
198
- ### Image build order
199
-
200
- ```
201
- al-agent:latest ← Action Llama package (automatic)
202
-
203
-
204
- al-project-base:latest ← project Dockerfile (if customized)
205
-
206
-
207
- al-<agent>:latest ← per-agent Dockerfile (if present)
208
- ```
209
-
210
- If the project Dockerfile is unmodified, the middle layer is skipped.
211
-
212
- ## Custom agent images
213
-
214
- Agents that need extra tools **beyond** what the project base provides can add a `Dockerfile` to their own directory:
215
-
216
- ```
217
- my-project/
218
- Dockerfile <-- project base (shared tools)
219
- dev/
220
- agent-config.toml
221
- ACTIONS.md
222
- Dockerfile <-- custom image for this agent only
223
- reviewer/
224
- agent-config.toml
225
- ACTIONS.md
226
- <-- no Dockerfile, uses project base
227
- ```
228
-
229
- ### Extending the base image
230
-
231
- Use `FROM al-agent:latest` and add what you need. The build pipeline automatically rewrites the `FROM` line to point at the correct base (either `al-project-base:latest` or the cloud registry URI). Switch to `root` to install packages, then back to `node`:
232
-
233
- ```dockerfile
234
- FROM al-agent:latest
235
-
236
- USER root
237
- RUN apk add --no-cache github-cli
238
- USER node
239
- ```
240
-
241
- This is a thin layer on top of the base — fast to build and shares most of the image.
242
-
243
- **Tip:** If multiple agents need the same tool, put it in the project `Dockerfile` instead of duplicating it across agent Dockerfiles.
244
-
245
- Common additions:
246
-
247
- ```dockerfile
248
- # GitHub CLI (for gh issue list, gh pr create, etc.)
249
- RUN apk add --no-cache github-cli
250
-
251
- # Python (for agents that run Python scripts)
252
- RUN apk add --no-cache python3 py3-pip
253
-
254
- # jq (for JSON processing in bash) — already in the base image
255
- # RUN apk add --no-cache jq
256
- ```
257
-
258
- ### Writing a standalone Dockerfile
259
-
260
- If you need full control, you can write a Dockerfile from scratch. It must:
261
-
262
- 1. Include Node.js 20+
263
- 2. Copy the application code from the base image or install it
264
- 3. Set `ENTRYPOINT ["node", "/app/dist/agents/container-entry.js"]`
265
- 4. Use uid 1000 (`USER node` on node images) for compatibility with the container launcher
266
-
267
- Example standalone Dockerfile:
268
-
269
- ```dockerfile
270
- FROM node:20-slim
271
-
272
- # Install your tools
273
- RUN apt-get update && apt-get install -y --no-install-recommends \
274
- git curl ca-certificates openssh-client gh jq python3 \
275
- && rm -rf /var/lib/apt/lists/*
276
-
277
- # Copy app from the base image (avoids rebuilding from source)
278
- COPY --from=al-agent:latest /app /app
279
- WORKDIR /app
280
-
281
- USER node
282
- ENTRYPOINT ["node", "/app/dist/agents/container-entry.js"]
283
- ```
284
-
285
- The key requirement is that `/app/dist/agents/container-entry.js` exists and can run. The entry point reads `AGENT_CONFIG`, `PROMPT`, `GATEWAY_URL`, and `SHUTDOWN_SECRET` from environment variables, and credentials from `/credentials/`.
286
-
287
- ### Build behavior
288
-
289
- - The base image (`al-agent:latest`) is only built if it doesn't exist yet
290
- - The project base image (`al-project-base:latest`) is rebuilt on every `al start` if the project Dockerfile has customizations
291
- - Agent images are named `al-<agent-name>:latest` (e.g. `al-dev:latest`) and are rebuilt on every `al start` to pick up Dockerfile changes
292
- - The build context is the Action Llama package root (not the project directory), so `COPY` paths in per-agent Dockerfiles reference the package's `dist/`, `package.json`, etc.
293
-
294
- ## Configuration
295
-
296
- | Key | Default | Description |
297
- |-----|---------|-------------|
298
- | `local.image` | `"al-agent:latest"` | Base Docker image name |
299
- | `local.memory` | `"4g"` | Memory limit per container |
300
- | `local.cpus` | `2` | CPU limit per container |
301
- | `local.timeout` | `3600` | Max container runtime in seconds |
302
-
303
- For Cloud Run configuration, see [Cloud Run docs](cloud-run.md). For ECS Fargate configuration, see [ECS docs](ecs.md).
304
-
305
- ## Container filesystem layout
306
-
307
- | Path | Mode | Contents |
308
- |------|------|----------|
309
- | `/app` | read-only | Action Llama application + node_modules |
310
- | `/credentials` | read-only | Mounted credential files (`/<type>/<instance>/<field>`) |
311
- | `/tmp` | read-write (tmpfs, 2GB) | Agent working directory — repos, scratch files, SSH keys |
312
-
313
- ## Troubleshooting
314
-
315
- **"Docker is not running"** — Start Docker Desktop or the Docker daemon before running `al start`.
316
-
317
- **Base image build fails** — Run `docker build -t al-agent:latest -f docker/Dockerfile .` from the Action Llama package directory to see the full build output.
318
-
319
- **Project base image build fails** — Check that the project `Dockerfile` starts with `FROM al-agent:latest` and that any `apk add` packages are spelled correctly. The base image uses Alpine Linux.
320
-
321
- **Agent image build fails** — Check that your agent's `Dockerfile` starts with `FROM al-agent:latest` (the build pipeline rewrites this to the correct base) and that any package install commands are correct.
322
-
323
- **Container exits immediately** — Check `al logs <agent>` for the error. Common causes: missing credentials, missing `ACTIONS.md`, invalid model config.