Skip to main content
AionRuntimeContext lives in aion-core and is shared across all frameworks. It carries the inbound A2A state for a single invocation: the inbox, the typed event, and the distribution extension payload.
from aion.core.runtime import AionRuntimeContext

Properties

PropertyPurpose
inboxRaw A2AInbox — escape hatch for direct access to the underlying A2A structures.
eventTyped inbound Aion event, or None for direct A2A requests without an Aion event envelope.
distribution_extension_payloadParsed Distribution extension payload when the request includes one.
graph_kwargsExtra values passed through from the graph framework runtime.
The context stores the Distribution extension payload in its protocol shape. It does not project distribution, behavior, or environment fields onto an identity object.

Event

context.event is None for direct A2A requests that carry no Aion event envelope. When present, it exposes a typed view of the inbound event.
FieldTypeDescription
kindEventKindEvent type: message, reaction, command, or card_action
idstrProducer-specified event ID for idempotency
sourcestrLogical origin URI of the event
payloadMessageEventPayload | ReactionEventPayload | CommandEventPayload | CardActionEventPayload | NoneNormalized event payload with provider-neutral fields
rawSourceSystemEventPayload | NoneVerbatim provider payload (provider + event dict), None for direct A2A requests
event = context.event

if event is not None:
    # Normalized payload — provider-neutral fields
    context_id = event.payload.context_id

    # Verbatim provider payload — Slack, Telegram, etc.
    if event.raw is not None:
        slack_body = event.raw.event  # original dict from the provider

MessageEventPayload

Normalized inbound message (DM, mention, thread reply, or channel message).
FieldTypeDescription
user_idstrSender identifier on the source network
context_idstrConversation, room, or thread ID
message_idstrSource-network message ID
trajectorystrRouting context: direct-message, reply, conversation, or timeline
parent_context_idstr | NoneParent context ID when nested threads are used

ReactionEventPayload

Reaction or emoji-style activity applied to an existing message.
FieldTypeDescription
user_idstrActor who added or removed the reaction
context_idstrConversation, room, or thread ID
message_idstrTarget message ID on the source network
reaction_keystrProvider-stable reaction identifier
actionstrReaction transition: added or removed
display_valuestr | NoneHuman-readable emoji or provider label
is_custombool | NoneWhether the reaction is provider-specific rather than a standard emoji
parent_context_idstr | NoneParent context ID when nested threads are used

CommandEventPayload

Command-style invocation sent through a messaging provider (slash commands, app commands).
FieldTypeDescription
user_idstrActor who invoked the command
context_idstrRoom, channel, thread, or DM context where the command ran
commandstrProvider-visible command token, e.g. /deploy
argumentsstr | NoneRaw argument string supplied after the command token
invocation_idstr | NoneProvider-native command invocation ID when available
parent_context_idstr | NoneParent context ID when nested threads are used

CardActionEventPayload

User interaction with a previously rendered card (click, submit, or activate).
FieldTypeDescription
user_idstrActor who triggered the card action
context_idstrChannel, space, or conversation ID where the action occurred
action_idstrDeveloper-defined action identifier echoed back by the provider
parent_context_idstr | NoneThread or parent conversation ID when nested context exists

SourceSystemEventPayload

Verbatim provider event preserved for inspection beyond the normalized payload. Available as event.raw when the request was routed through a messaging distribution.
FieldTypeDescription
providerstrSource provider name, e.g. slack or telegram
eventdictVerbatim event payload from the source system

Distribution Accessors

Use these methods when a request includes a Distribution extension payload:
MethodReturns
get_distribution()Distribution model for the current invocation, or None.
get_behavior()Behavior model for the invoked agent implementation, or None.
get_environment()Environment model for the runtime configuration, or None.
get_principal_identity()Principal identity associated with the distribution, or None.
get_service_identity()Service identity associated with the distribution, or None.
get_principal_identity() and get_service_identity() are intentionally separate helpers. The principal identity is the Aion principal that owns the distribution when one exists. The service identity represents an external network identity associated with the distribution when one exists.