Skip to main content

Module agent_self_keys

Module agent_self_keys 

Source
Expand description

GET /agentmux/agents/self/keys — identity M4d-3 (SPEC_AGENT_IDENTITY_CARRIED_NOT_DERIVED_2026_09_23.md §6.5.10).

An agent’s MCP fetches its own signing keys here instead of reading them from .mcp.json, which goes stale: the host jekt key rotates after 24 h (JEKT_KEY_TTL_SECS) while a running agent keeps the copy it was launched with. Served only to Caller::Agent(uid), the agent its X-Agent-Token names: these are private keys, so the 401 is this endpoint’s own.

The name-keyed jekt, LAN and WAN keys are those of the row’s slug only, ensured as injection ensures them (so the jekt key rotates here), and the response says which slug they belong to: the MCP uses them only when that slug is exactly its own AGENTMUX_AGENT_ID. The UID-keyed LAN and WAN keys (M4d-2) ride along for M4d-6’s v2 signatures. Nothing here is logged.

Structs§

SelfKeys 🔒

Functions§

handle_agent_self_keys 🔒
record_config_id_drift 🔒
Identity M4d-3’s own gate signal (spec §6.5.10, “Gating per step”): a config written with an AGENTMUX_AGENT_ID that is not exactly its row’s slug. Such an agent signs under a name its row doesn’t have (a collision-suffixed backfill, a #3573 stub), so the keys /agentmux/agents/self/keys serves are not its keys, and its config must keep carrying them. Counting only: nothing here changes what is written. row_slug is None when no single row could be matched.
self_keys_for 🔒
The keys for uid, or None when it has no row.
single_row_slug_folded 🔒
The one row whose slug equals name folded (trimmed, case-insensitive), or None when none or several do. WriteAgentConfig has no Caller and names its agent only by the id in the content.