diff --git a/CLAUDE.md b/CLAUDE.md
index 9ef8eaa..a311ae7 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -44,7 +44,9 @@ Read the ADRs, `README.md` and `docs/spec.html` before changing behaviour.
never let `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`,
`ANTHROPIC_IDENTITY_TOKEN` or `ANTHROPIC_PROFILE` stay set: they outrank
federation and silently shadow it. The ids are not secrets but are still
- flags.
+ flags. An actor on Agent Substrate uses federation only with
+ `--anthropic-identity-token-from-core`: its identity token is one the
+ core signs for it, asked at every exchange, never a file or a variable.
- **The connector is the boundary.** The prompt is best effort. A cluster is
reached only through a connector, whose tools are offered by exact name. By
default the core's tools are allowed by name (`tools.CoreTools`) and the
diff --git a/cmd/tria-spot/main.go b/cmd/tria-spot/main.go
index 13ce0a4..f530553 100644
--- a/cmd/tria-spot/main.go
+++ b/cmd/tria-spot/main.go
@@ -18,6 +18,7 @@ import (
"os"
"os/signal"
"strings"
+ "sync/atomic"
"syscall"
"time"
@@ -82,7 +83,16 @@ func supervise(cfg config.Config, errOut io.Writer) int {
return 1
}
- model, err := newModel(ctx, cfg, log)
+ // The link is made after the model client, and the client asks for the
+ // identity token only at its first exchange: the holder is filled then.
+ var identityFrom atomic.Pointer[triggers.Link]
+ model, err := newModel(ctx, cfg, log, func(ctx context.Context) (string, error) {
+ l := identityFrom.Load()
+ if l == nil {
+ return "", errors.New("identity token: this process has no link to the core (a task actor has none)")
+ }
+ return l.IdentityToken(ctx)
+ })
if err != nil {
log.Error("model client", "err", err)
return 1
@@ -192,6 +202,7 @@ func supervise(cfg config.Config, errOut io.Writer) int {
}
if l, ok := tc.(*triggers.Link); ok {
link = l
+ identityFrom.Store(l)
// The server listens at once and the link starts with the core's first
// request, which the process then waits for.
shutdown, err := serve(cfg.Listen, l.Handler(), log)
@@ -288,7 +299,7 @@ func supervise(cfg config.Config, errOut io.Writer) int {
// newModel builds the model client for the configured provider and auth mode.
// It fails at once on a key file it cannot read or a mode with missing ids.
-func newModel(ctx context.Context, cfg config.Config, log *slog.Logger) (llm.Client, error) {
+func newModel(ctx context.Context, cfg config.Config, log *slog.Logger, identityToken func(context.Context) (string, error)) (llm.Client, error) {
log.Info("model", "provider", cfg.LLMProvider, "id", cfg.Model, "effort", cfg.Effort, "maxSteps", cfg.MaxSteps, "maxToolCalls", cfg.MaxToolCalls, "maxTurnTokens", cfg.MaxTurnTokens)
if cfg.LLMProvider == config.ProviderGemini {
o := llm.GeminiOptions{Auth: cfg.LLMAuth, Model: cfg.Model, KeyFile: cfg.GeminiKeyFile}
@@ -308,6 +319,11 @@ func newModel(ctx context.Context, cfg config.Config, log *slog.Logger) (llm.Cli
RuleID: cfg.FederationRuleID, OrganizationID: cfg.AnthropicOrgID, ServiceAccountID: cfg.AnthropicServiceAcctID,
WorkspaceID: cfg.AnthropicWorkspaceID, IdentityTokenFile: cfg.IdentityTokenFile,
}
+ if cfg.IdentityTokenFromCore {
+ o.Federation.IdentityToken = identityToken
+ log.Info("model auth: Anthropic workload identity federation with an identity token the core signs", "rule", cfg.FederationRuleID, "serviceAccount", cfg.AnthropicServiceAcctID)
+ break
+ }
// The kubelet projects the token; absent here only means it is not mounted yet.
if _, err := os.Stat(cfg.IdentityTokenFile); err != nil {
log.Warn("identity token file is not readable yet; the first exchange will fail until it is", "err", err)
diff --git a/docs/spec.html b/docs/spec.html
index eeb9f65..2fe7b21 100644
--- a/docs/spec.html
+++ b/docs/spec.html
@@ -463,9 +463,9 @@
Runtimes
Reports
Kept until the supervisor is idle (no turn, no task, nothing waiting), then sent in this order: turns, stats, the wake reports last. The core may suspend the actor once it has the wake report, so nothing follows it. A frame that made no wake (the rooms had nothing new) is answered with {"wake":{"reason":"rooms","lane":"long","outcome":"idle"}}, which ends the outstanding wake and leaves the stored plan. The schedule frame follows hello only when the process holds a plan, because one without would replace the core’s.
What survives
/state, the actor’s durable directory: the usage ledger, the room cursors and read marks, the digest, the promises, the identity, and window.json: the tokens of the last hour (the hourly ceiling), the early wakes of the last hour (their cap), the issue state edges are told against and the plan the last wake left (the core holds it; an actor that reports a promise without having run a wake says it back). Held edges do not survive a suspension, so --edge-cooldown and --chat-batch are 0 in this runtime and the next tick reads whatever a cap left.
Task actor
--task-actor makes a process an actor the core made for one piece of work that Tria asked for (the core’s ADR-109). It never joins: no certificate, no hello, no schedule, no rooms to poll, no lanes. It is an A2A agent (Agent2Agent protocol 0.3, a2a-go v0.3.15) and the core is its client; it serves, on --listen, GET /readyz (the substrate’s probe), GET /.well-known/agent-card.json and the JSON-RPC endpoint at / (message/send, tasks/get, tasks/cancel; every other method is refused). The card is static and names no workspace, spot or core: url/, preferredTransportJSONRPC, protocolVersion0.3.0, push notifications on, streaming off, an httpbearer security scheme and one required extension, https://triageagent.dev/a2a/spot-task/v1. The core sends one message/send with Authorization: Bearer <task token>: one text part (the goal), contextId the task key, metadatatriage.workspace, triage.task.key, triage.task.title and triage.task.replyTo, and a pushNotificationConfig (the core’s receiver, the key as its token, the task token as its bearer). The actor has no setting of its own and cannot verify the core’s signature, so before it acts it confirms the task with the core: GET /v2/messenger/spot/link/tasks/{key} with the message’s bearer, answered {key, goal, title, replyTo}. On 401, 403 or 404 the A2A task ends rejected and the actor stays free for the next message; it also ends rejected when the message has no bearer, the key is not the core’s, the message’s text differs from the core’s goal (after trimming), or triage.workspace is not the workspace the actor was made for (--tenant). A second message, while the task runs or after it ended, is answered rejected (one task per actor). The message must also carry a push notification configuration whose URL has the scheme and host:port of --core-api-url (the path may differ), otherwise it ends rejected before the core is asked, and the actor never posts to any other URL; tasks/get and tasks/cancel are for the task’s own bearer, or one the core confirms for the task (the core keeps no task token and mints a fresh one for the same task; the actor asks GET /v2/messenger/spot/link/tasks/{key} with it, once, within 5 s, and remembers it when the core answers 200 with the task’s key). The bearer is written to --core-token-file (outside the state directory) and is the task’s credential for its tools and its confirmation, for this task only: the core refuses it on hello, stats, schedule, control answers and any other workspace. One turn runs the goal (the task prompt, the usual caps, schedule_next and start_task refused, calls to the core always with the workspace of the token, the room bus only). The supervisor then writes the result as one memory item (upsert_memory_item, kind note, scope global, subject the task key, title the core’s title, tags task,spot:<name>) and posts one line in the bus (say_in_workspace, reply_to the request, memory the item’s id; the line is the result in one line of 300 bytes at most). A failed task is a result like any other (failed: …), and a note that cannot be saved is said in the line. The actor then flushes its spans and ends the A2A task completed (failed when the run failed) with one artifact holding a data part {"memory": <item id>, "line": <the bus line>}. The core learns the end from the push notification the SDK’s sender posts to the configuration in the message (Authorization: Bearer <task token>, X-A2A-Notification-Token: <key>) at every state; the actor sends no wake report. tasks/cancel with the task’s bearer stops the turn at its next step, as an operator’s stop does for a task of a deployment spot, and ends the task canceled; another bearer cannot cancel it. The process keeps waiting for the core to end the actor. Spots and task actors report to memory and the bus, never to ego.
-
Model
--llm-auth injected: the Anthropic client sends a fixed placeholder x-api-key to https://api.anthropic.com (or --llm-base-url) and the environment is not read. The egress policy of the actor has a rule for that host whose effect replaces the header with the key of a Secret (ate-secret://…), and only a request that carries the header is changed; the spot never holds the key. Anthropic provider only. The other auth modes stay for the deployment runtime.
+
Model
--llm-auth injected: the Anthropic client sends a fixed placeholder x-api-key to https://api.anthropic.com (or --llm-base-url) and the environment is not read. The egress policy of the actor has a rule for that host whose effect replaces the header with the key of a Secret (ate-secret://…), and only a request that carries the header is changed; the spot never holds the key. Anthropic provider only. Or --llm-auth federation with --anthropic-identity-token-from-core, which needs no key anywhere: at every exchange the spot asks the core for an identity token (GET /v2/messenger/spot/link/identity-token with its access token from hello), a short-lived JWT the core signs that says which spot of which workspace it is, and exchanges it at Anthropic for a short-lived access token it keeps in memory. The core signs one only for the audiences its policy names (spots.identity), and Anthropic checks it with the core's public keys, so one federation rule serves every spot. A task actor has no link and cannot use this mode. The key, vertex and file-token modes stay for the deployment runtime.
TLS
An https rule is intercepted by the egress gateway, which mints its certificates from its own CA. The template mounts a systemInfo volume with the trust bundle (egress-mitm.ate.dev and system-roots.ate.dev) at /run/ate/egress-trust-bundle and sets SSL_CERT_FILE to it, the one environment variable of the container and no credential. In-cluster names must be fully qualified (….svc.cluster.local): the DNS relay forwards the name as asked, and no search domain completes it.
-
No credential
The actor holds no model key, no token file and no enrollment key, and mounts no Secret or ConfigMap: connectors are given inline (--connectors-json), what ego checks on a request is put there by the egress policy, and the one-time enrollment key a spot needs for its first join (the core refuses a spot without one) is put on the join request by the egress too: the spot sends X-Triage-Enroll-Key with a placeholder (--enroll-key-injected) and the policy replaces it from a Secret. The one thing the actor keeps is its own key and certificate on /state.
+
No credential
The actor holds no model key, no token file and no enrollment key (with federation it holds, in memory and for minutes, the identity token the core signed and the access token that bought), and mounts no Secret or ConfigMap: connectors are given inline (--connectors-json), what ego checks on a request is put there by the egress policy, and the one-time enrollment key a spot needs for its first join (the core refuses a spot without one) is put on the join request by the egress too: the spot sends X-Triage-Enroll-Key with a placeholder (--enroll-key-injected) and the policy replaces it from a Secret. The one thing the actor keeps is its own key and certificate on /state.
Install
The manifests in deploy/substrate/ (one ActorTemplate and one EgressPolicy, with <placeholders>) are applied with the substrate CLI: kubectl ate create actor-template -f, create actor <actor-name> -a <atespace> --template <atespace>/<template-name>, create egress-policy <actor-name> -a <atespace> -f. The actor name is the core’s (it returns it with the spot key). The template names the image by digest, the flags, /state as a durable directory, the wake-up probe, the volume snapshot and the limits. The policy has one rule per destination the spot uses, the one for the model API replacing x-api-key with the key of a Secret (http for in-cluster names, https for the rest, hostnames only). The Helm chart installs the deployment runtime only.
@@ -625,7 +625,8 @@
Model
--llm-base-url
empty
injected: the API’s URL when it is not https://api.anthropic.com; only with --llm-auth=injected
--anthropic-key-file
required with anthropic and key
Anthropic API key file; rejected with the others
--gemini-key-file
required with gemini and key
Gemini API key file; rejected with the others
-
--anthropic-identity-token-file
required with federation
projected identity token (JWT)
+
--anthropic-identity-token-file
required with federation, unless the token comes from the core
projected identity token (JWT)
+
--anthropic-identity-token-from-core
false
federation with --runtime=substrate: the identity token is one the core signs for the spot at every exchange; in place of the file
--anthropic-federation-rule-id
required with federation
federation rule id (fdrl_...)
--anthropic-org-id
required with federation
Anthropic organization id
--anthropic-service-account-id
required with federation
Anthropic service account id (svac_...)
@@ -683,7 +684,7 @@
Telemetry and logs
08
Credentials
-
--llm-auth picks the model auth mode; federation and injected are Anthropic only. With injected the spot holds no key: it sends a placeholder, and the egress in front of the API replaces it with the real one. Federation ids are not secrets, but they are flags.
+
--llm-auth picks the model auth mode; federation and injected are Anthropic only. With injected the spot holds no key: it sends a placeholder, and the egress in front of the API replaces it with the real one. A substrate actor takes injected, or federation with --anthropic-identity-token-from-core (section 8). Federation ids are not secrets, but they are flags.