Agent
Definition
An agent is the workload Agent Assembly governs: an LLM-driven program that decides, at runtime, which actions to take to accomplish a goal. From the gateway’s point of view an agent is a stable identity that performs actions — calling a tool, making an LLM request, or reaching out over the network. Each agent is organized under a team and an org, which is the scope at which policy and budget are applied.
Two identity types distinguish a long-lived agent from a single run.
aa_core::identity::AgentId is the stable identifier carried across every
session; SessionId is generated fresh for each execution and ties together all
governance events within that run. Both are opaque 16-byte wrappers over UUID v4
raw bytes. The AgentContext carries these together with the OS process ID, a
start timestamp, free-form metadata, the governance level, and the agent’s
position in any delegation hierarchy (parent_agent_id, root_agent_id,
depth, team_id).
aa-coredefines two distinct types both namedAgentId, and they are not interchangeable.identity::AgentIdis the opaque 16-byte runtime id described above.types::AgentIdis a separate newtype over a validated<tenant>/<agent>string — the human-routable identifier that storage drivers persist and round-trip, for exampleacme/billing-bot. Read the module path, not the type name, when following either through the code.
How it works
An agent’s lifecycle has three phases:
- Register. Registration is two round trips, not one. The SDK first calls
RequestChallengeto obtain a single-useregistration_nonce, then callsRegisterwith the agent’s name, framework (for examplelanggraphorcrewai), declared tool names, an Ed25519public_key, metadata, thatregistration_nonce, apossession_proof— a 64-byte Ed25519 signature over the nonce — anddurable_identity_key, which says the key is random and held by the agent rather than derived from its identifier (the gateway records it, and a later process holding the same key can then re-bind a keyless agent; see org isolation). The gateway consumes the nonce (so it cannot be replayed) and verifies the proof against the submittedpublic_key; a missing nonce, a missing proof, or a proof that does not verify is rejected as unauthenticated. Only then does it store anAgentRecordand issue the short-livedcredential_tokenthe agent presents on subsequent calls. Proving possession of the private key at registration is what stops a caller from claiming someone else’s public key. It is not on its own enough to stop a caller claiming someone else’s identity — the proof says nothing about which key theagent_idnames — so the gateway separately requires the DID to embed the presented key; see DID. - Operate. For each governed action the runtime builds an
AgentContextand submits it for a decision. The gateway evaluates policy, tracks budget, and records an audit entry — for both allows and denies. Sub-agents spawned by an agent inherit lineage so a delegation chain can be reconstructed from any node. - Deregister. A clean shutdown unwinds the SDK hooks and closes the gateway
connection. An agent that never deregisters is swept on age, not silence:
the registry compares now against the record’s
registered_attimestamp and force-deregisters any still-Activeagent older than the maximum configured for its team. Heartbeat activity does not extend that window, and an agent whose team has no maximum configured is never swept by age at all. Each eviction emits anAgentForceDeregisteredaudit event.
sequenceDiagram
participant A as Agent
participant G as Gateway
A->>G: RequestChallenge
G-->>A: registration_nonce
A->>G: Register (public_key, possession_proof, nonce, tools, metadata)
G-->>A: credential_token
A->>G: Action + AgentContext
G-->>A: allow / deny
A->>G: Deregister
Example
Each SDK wires an agent into the gateway with a single call. Tool invocations after that point are governed.
from agent_assembly import init_assembly
with init_assembly(
gateway_url="http://localhost:7391",
api_key="dev-key",
agent_id="quickstart-agent",
mode="sdk-only",
):
... # every governed tool call now goes through the policy gate
import { initAssembly } from "@agent-assembly/sdk";
const ctx = await initAssembly({
gatewayUrl: "http://localhost:7391",
agentId: "demo",
langchain: { tools: { searchWeb } },
});
await ctx.shutdown();
ctx := assembly.WithAgentID(context.Background(), "my-agent")
a, err := assembly.Init(ctx, assembly.WithGatewayURL(url), assembly.WithAPIKey(key))
if err != nil {
log.Fatal(err)
}
defer a.Close()
Related
- Policy — what an agent is and is not allowed to do.
- Approval — how an agent’s high-risk actions reach a human.
- Trace — how an agent’s actions are observed per session.
- DID — the cryptographic identity an agent registers with.
- API reference —
aa-core(AgentId,AgentContext) andaa-gateway(registry, lifecycle service) rustdoc entry points. - Quickstart (tracked under AAASM-418) — end-to-end first-run walkthrough.
Last updated: 2026-11-07 by Chisanan232