aion-api-client is the low-level package for connecting Python agents and tools to Aion platform
APIs. It owns HTTP authentication, typed GraphQL access, model-service configuration, and the shared
control-plane addressing models used by Aion MCP helpers.
Use this package directly when you need to construct Aion API clients, build capability URLs, or pass
typed capability references into framework-specific packages.
Install
aion-sdk.
Authentication
The client reads Aion API credentials from environment variables:| Variable | Required | Purpose |
|---|---|---|
AION_CLIENT_ID | yes | API client identifier. |
AION_CLIENT_SECRET | yes | API client secret. |
AION_API_HOST | no | Aion API host. Defaults to the SDK’s production API host. |
aion-mcp,
aion-authoring-langgraph, and aion-authoring-adk reuse that token manager when building authenticated
requests.
Control-plane addressing
The control-plane models describe how to address Aion capabilities without hard-coding URL strings. The core shape is:Capability subjects
| Subject constructor | Route prefix |
|---|---|
CapabilitySubject.distribution(distribution_id) | /distributions/{distributionId} |
CapabilitySubject.environment(agent_environment_id) | /environments/{agentEnvironmentId} |
CapabilitySubject.agent_identity(agent_identity_id) | /agents/{agentIdentityId} |
CapabilitySubject.agent_at_name(agent_at_name) | /agents/@{agentAtName} |
Capability kinds and keys
CapabilityKind identifies the protocol surface. HTTP-addressable values include
CapabilityKind.MCP_SERVER and CapabilityKind.A2A_ENDPOINT.
Subjectless keyed references are reserved for system-owned capabilities. Today, that means the
built-in control-plane MCP server can be addressed either as the primary global MCP route
/mcp or as /mcp/mcp.aion.control_plane.
Subject-qualified keyed references use the same path shape across endpoint kinds:
/{subject}/{kind}/{capabilityKey}. For REST-style A2A calls, protocol operation
segments follow the capability key, for example
/{subject}/a2a/a2a.daemon/message:send.
CapabilityKey identifies either:
- the primary capability of that kind for the addressed subject
- one concrete capability key declared by the behavior
key selects the primary capability.
Runtime capability references
RuntimeCapabilityReference is a template for resolving a reference after an
AionRuntimeContext exists. It does not read from thread-local or ambient state. The framework
adapter must pass the current request context explicitly, or extract it from the framework’s
per-request context object.
CapabilitySubjectSource.INCOMING_DISTRIBUTION means the distribution from the current incoming
request’s Aion Distribution extension payload. It is request-scoped, not a global default.
| Source | Runtime accessor |
|---|---|
ACTIVE_ENVIRONMENT | runtime_context.get_environment() |
INCOMING_DISTRIBUTION | runtime_context.get_distribution() |
PRINCIPAL_IDENTITY | runtime_context.get_principal_identity() |
Principal selectors
PrincipalSelector is request metadata used to tell Aion which runtime principal the call is being
made as. It is not a credential by itself; the API still validates the bearer token and the selected
principal.
For behavior-originated calls back to the control plane, such as MCP or A2A access,
AionRuntimeContext.get_principal_selector() derives this metadata from the active request. It
prefers the environment’s daemon identity when available and falls back to the environment id. Omitting
the selector can make the request look like the broader authenticated subject, which may be denied even
when the runtime daemon or environment would be allowed.
AionRuntimeContext.get_principal_selector() when no
explicit selector is supplied.