Runtime APIs¶
Runtime APIs provide the execution environment and services for your AgenticAI applications, bridging the gap between your application definition and live execution.
What are Runtime APIs?¶
Runtime APIs handle the execution phase of your AI application lifecycle:
- Design-Time: You define your app structure using models (
App,Agent,Tool, etc.) - Runtime: Your app comes alive and processes real requests using these APIs
Think of it as the difference between writing a recipe (design-time) and actually cooking the meal (runtime).
Runtime Architecture¶
graph TD
A[User Request] --> B[Platform]
B --> C[SDK Orchestrator]
C --> D[RequestContext]
D --> E[Platform Agent Execution]
E --> F[SDK Tool Execution]
F --> G[Memory Store]
F --> H[Logger]
F --> I[Tracer]
F --> J[EnvironmentVariables]
G --> K[Response to Platform]
H --> K
I --> K
J --> K
K --> L[User Response]
style D fill:#e1f5fe
style F fill:#f3e5f5
style G fill:#e8f5e8
style H fill:#fff3e0
style I fill:#fce4ec
style J fill:#e8f4fd
Message Protocol Flow:
- User → Platform: User sends request via Platform interface
- Platform → SDK: Platform (MCP Client) calls SDK Orchestrator (MCP Server)
- SDK Orchestrator: Receives
MessageItem(role='user'orrole='tool'), returnsToolCall - Platform Agent: Executes based on orchestrator's
ToolCallrouting - SDK Tool: Platform calls back to SDK tools for execution with runtime services
- Response Chain: Results flow back through Platform to User
When Do You Use Runtime APIs?¶
Runtime APIs are used inside your tools and orchestrators during request processing:
- Accessing user session information (
RequestContext) - Reading environment variables and configuration
- Storing/retrieving persistent data (
Memory) - Logging operational information (
Logger) - Monitoring performance and debugging (
Tracer)
Available Runtime Services¶
| Service | Purpose | Key Features |
|---|---|---|
| RequestContext | Access request and session information | User ID, session ID, app ID, runtime services access |
| EnvironmentVariables | Environment configuration access | Attribute-style access, defaults, type conversion |
| Memory | Persistent data storage | Cross-session storage, projections, store management |
| Logger | Structured operational logging | Automatic session context, async logging, JSON format |
| Tracer | Distributed tracing and monitoring | Performance tracking, error capture, analytics |
Next Steps¶
Implementation:
- RequestContext API - Access session context and runtime services
- EnvironmentVariables API - Environment configuration access
- Memory API - Persistent data storage operations
- Logger API - Add structured logging to your tools
- Tracer API - Monitor performance and debug issues
Guides & Workflows:
- Quick Start Guide - End-to-end development workflow
- CLI Reference - Package and deploy applications
- Working with Tools Guide - Advanced tool patterns
- Design-Time Models - Application structure and configuration