AgentIdentity

Group agentprimitives.authzed.com · Scope Namespaced · Short names agid

AgentIdentity is the named credential set an agent acts as: reusable static and OAuth credential descriptors that toolkits and MCP servers request by name. It carries references to Secrets, never token bytes.

Namespaced. Reconciled by pkg/controllers/agentidentity -- one reconciler for validity (every referenced Secret + key must exist), one for proactive OAuth refresh. type=federated is rejected here: those credentials are minted on demand from a human enterprise identity, so they only ever live on a UserIdentity or SessionUserIdentity.

Spec

FieldTypeDescription
spec.credentials[]objectCredentials are reusable named credential descriptors. Each has a type discriminator and exactly one type-specific block populated.
spec.credentials[].allowedHosts[]stringAllowedHosts scopes where this credential may be sent, as host patterns ("github.com", ".internal.example"). Matching is on the URL authority (host and port), case-insensitively; a leading "." matches one or more leading labels but never the apex, so an author who wants both lists both. It exists because destination and credential were independent fields on the same tenant-writable object with nothing tying them together: a SkillSource naming spec.repoURL: "https://attacker.example/x.git" and spec.auth pointing at a production PAT made the operator send that PAT to that host as an HTTP Basic password, reading the Secret with its own cluster-wide credentials so the actor never needed get secrets. EMPTY MEANS UNSCOPED, which is the only reading that does not break every existing credential on upgrade. That makes the field opt-in, so a caller with a stricter default enforces it itself rather than relying on this: the SkillSource controller refuses an unscoped credential for a clone outright, because there is no safe default destination for one.
spec.credentials[].federatedobjectFederated is populated when type=federated. The credential is MINTED on demand via ID-JAG from the user's enterprise identity — there is no stored access token. Valid ONLY on UserIdentity / SessionUserIdentity; rejected on AgentIdentity (bot identities have no human subject to assert).
spec.credentials[].federated.idpSecretRef *objectIdPSecretRef points at the subject-keyed IdP-identity Secret in IdentitiesNamespace (the user's refresh token).
spec.credentials[].federated.idpSecretRef.name *stringName is the Secret's name, in the referring object's own namespace.
spec.credentials[].federated.resource *stringResource is the identifier the IdP knows the MCP server by — the ID-JAG audience.
spec.credentials[].federated.resourceServerURL *stringResourceServerURL is the MCP server URL whose authorization server accepts the ID-JAG (leg 2 discovery target).
spec.credentials[].federated.scopes[]stringScopes are optional scopes requested at the resource AS.
spec.credentials[].githubAppobjectGitHubApp is populated when type=githubApp.
spec.credentials[].githubApp.secretRef *objectSecretRef points at the Secret the channel wizard wrote.
spec.credentials[].githubApp.secretRef.name *stringName is the Secret's name, in the referring object's own namespace.
spec.credentials[].name *stringName is the credential's unique identifier. It is matched against the credential names a toolkit/MCPServer declares to inject the resolved value at runtime.
spec.credentials[].oauthobjectOAuth is populated when type=oauth. The referenced Secret holds access_token, refresh_token, expires_at, token_endpoint, client_id, scope as separate keys. Key names are fixed; not configurable.
spec.credentials[].oauth.secretRef *objectSecretRef points at a Secret whose keys hold the OAuth state. Required keys (read at runtime / refresh time): access_token — current access token refresh_token — long-lived refresh token (optional) expires_at — RFC 3339 timestamp; absent → never expires token_endpoint — auth-server URL for refresh client_id — OAuth client ID used at registration scope — granted scopes (informational)
spec.credentials[].oauth.secretRef.name *stringName is the Secret's name, in the referring object's own namespace.
spec.credentials[].staticobjectStatic is populated when type=static.
spec.credentials[].static.secretRef *objectSecretRef points at a Secret in the same namespace as the AgentIdentity.
spec.credentials[].static.secretRef.key *stringKey is the data key within the Secret holding the value.
spec.credentials[].static.secretRef.name *stringName is the Secret's name, in the referring object's own namespace.
spec.credentials[].type *stringType discriminates which of the blocks below is populated. (enum: static | oauth | federated | githubApp)
spec.descriptionstringDescription is a human-readable summary surfaced in events / status.
spec.refreshThresholdstringRefreshThreshold overrides the operator-wide default refresh threshold for this AgentIdentity. type=oauth credentials whose expires_at is within this duration are refreshed proactively. No effect on type=static credentials.
* required

Status

Status is controller-owned (observed state).

FieldTypeDescription
status.conditions[]objectConditions carries Valid, Refresh and PlatformLinked.
status.conditions[].lastTransitionTime *string (date-time)lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
status.conditions[].message *stringmessage is a human readable message indicating details about the transition. This may be an empty string.
status.conditions[].observedGenerationinteger (int64)observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. (min 0)
status.conditions[].reason *stringreason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
status.conditions[].status *stringstatus of the condition, one of True, False, Unknown. (enum: True | False | Unknown)
status.conditions[].type *stringtype of condition in CamelCase or in foo.example.com/CamelCase.
status.lastRefreshAtstring (date-time)LastRefreshAt is the most recent successful OAuth refresh performed by the refresh controller.
status.lastSetupAtstring (date-time)LastSetupAt is the most recent timestamp at which any credential on this identity was created or updated by the setup CLI.
status.observedCredentials[]objectObservedCredentials is the durable trigger state for in-flight credential revocation: the credential set the operator has already published revokes for. The reconciler diffs spec.credentials against it, so a removal or replacement committed while the operator was down — or one whose publish failed — is still emitted on the next reconcile, rather than living only in a process-scoped map that dies with the pod. Operator-owned and derived: a pure function of spec.credentials, sorted by name, so an unchanged spec re-writes nothing. An entry whose revoke failed to publish deliberately keeps its PREVIOUS value, which is what makes the next reconcile re-derive and re-emit it.
status.observedCredentials[].fingerprint *stringFingerprint is "<type>:<secretRefName>": stable across reconciles and sensitive to both a type change (static↔oauth) and a Secret-ref rename, which is how an OAuth refresh surfaces a replaced credential.
status.observedCredentials[].name *stringName is the credential name from spec.credentials[].name.
status.observedCredentials[].secretNames[]stringSecretNames are the backing Secret names for this credential, recorded so a REMOVED credential's revoke key can be reconstructed without re-reading a spec that no longer mentions it. Empty for UserIdentity, whose backing Secret name is derived from (identity name, credential name) rather than referenced by the spec.
status.observedGenerationinteger (int64)ObservedGeneration is the spec generation this status reflects.
status.resolvedCredentials[]stringResolvedCredentials lists credential names whose Secret + key resolved.
* required