Expand description
Core traits and types.
Always available regardless of feature flags. Includes:
Agent- The fundamental trait for all agentsTool/Toolset- For extending agents with capabilitiesSession/State- For managing conversation contextEvent- For streaming agent responsesAdkError/Result- Unified error handling Typed identity primitives for app, user, session, and invocation. Typed identity primitives for ADK-Rust.
This module provides strongly-typed wrappers for the identity values used throughout the ADK runtime: application names, user identifiers, session identifiers, and invocation identifiers.
§Identity Layers
ADK distinguishes three identity concerns:
- Auth identity (
RequestContext): who is authenticated and what scopes they hold. - Session identity (
AdkIdentity): the stable(app, user, session)triple that addresses a conversation session. - Execution identity (
ExecutionIdentity): session identity plus the per-invocationinvocation_id,branch, andagent_name.
§Validation Rules
All leaf identifiers (AppName, UserId, SessionId,
InvocationId) enforce the same validation:
- Must not be empty.
- Must not contain null bytes (
\0). - Must not exceed
MAX_ID_LENbytes (512). - Characters like
:,|,/, and@are allowed — validation does not couple to any backend’s internal key encoding.
§Examples
use adk_core::identity::{AdkIdentity, AppName, ExecutionIdentity, InvocationId, SessionId, UserId};
let identity = AdkIdentity::new(
AppName::try_from("weather-app").unwrap(),
UserId::try_from("tenant:alice@example.com").unwrap(),
SessionId::generate(),
);
let exec = ExecutionIdentity {
adk: identity,
invocation_id: InvocationId::generate(),
branch: String::new(),
agent_name: "planner".to_string(),
};Structs§
- AdkIdentity
- The stable session-scoped identity triple: application name, user, and session.
- AppName
- A typed wrapper around the logical application name used in session addressing.
- Execution
Identity - The per-invocation execution identity, built from a stable
AdkIdentityplus invocation-scoped metadata. - Invocation
Id - A typed wrapper around a single execution or turn identifier.
- Session
Id - A typed wrapper around a logical session identifier.
- UserId
- A typed wrapper around a logical user identifier.
Enums§
- Identity
Error - Error returned when a raw string cannot be converted into a typed identifier.
Constants§
- MAX_
ID_ LEN - Maximum allowed length for any identity value, in bytes.