SDK Architecture
The AgenticAI SDK separates operations into two phases: design-time (configuration) and runtime (execution). During design-time, you define your app, agents, and tools. At runtime, those definitions execute as a deployed application. The SDK has two major components:- agentic-core — A Python library that provides design-time configuration models and runtime interfaces.
- Workspace — A project scaffold with a CLI for building, packaging, and deploying your app.
Component Interaction
The diagram below shows how SDK components interact with the platform.agentic-core Library
agentic-core is the foundational library for both design-time and runtime needs.
Design-Time Module
agenticai_core.designtime provides builder-pattern classes for configuring entities. The builder classes capture entity relationships and offer an autocomplete-friendly API for configuring:
- Apps with custom orchestrators.
- Agents with specific roles and capabilities.
- Tools with various implementations.
- LLM models with configurable parameters.
Runtime Module
agenticai_core.runtime provides:
- Abstract interfaces — Base classes (
abstract_agent,abstract_orchestrator) that your custom implementations must extend. - Request/response classes — Classes that parse and encapsulate agentic conversation state across a session.
- MCP server — An SSE (Server-Sent Events) transport server for real-time communication. The MCP server lifecycle is tied to the application — calling
app.start()automatically starts the MCP server.
Library Structure
Design-Time Model
The following class diagram shows the relationships between design-time entities.Runtime Model
At runtime, a separate set of classes manages agent execution and message passing. The following class diagram shows the runtime components and their relationships.Workspace
The Workspace is a project scaffold that includes:- A skeleton project structure to bootstrap new apps.
- Example implementations for custom orchestrators and tools.
- Environment configuration management for dev, staging, and production.
- A CLI (
run.py) for common development and deployment tasks.
Workspace Structure
CLI Reference
| Command | Description |
|---|---|
config -u <name> | Selects the .env config file to use as default. |
package -o <name> | Generates application.config.json and bundles source code into a .kar archive. |
start | Starts the MCP server with registered agents and tools. |
test | Tests the deployed app end to end. |
deploy -f <kar> | Creates resources on the Platform and triggers package deployment. |
publish -a <appId> -n <name> | Creates an environment for the deployed app. |
status -a <appId> -n <name> | Checks the status of an app environment. |
undeploy -f <path> | Undeploys the app environment. |
Deployment Workflow
The following sequence diagram shows the complete lifecycle from development to undeployment. The workflow has five phases:| Phase | Description |
|---|---|
| 1. Development | Define entity models, implement custom orchestrators and tools, configure environments. |
| 2. Packaging | Run package to generate application.config.json and bundle source into a .kar archive. |
| 3. Deployment | Run deploy to upload the package. The platform validates configuration, provisions a container, and starts the MCP server. |
| 4. Runtime | The platform routes user requests to the MCP server, which executes tools and orchestrators and streams responses. |
| 5. Undeployment | Run undeploy to stop and clean up the deployed environment. |
Platform APIs
| Endpoint | Purpose |
|---|---|
POST /deploy/ | Uploads the app config and archive, validates, and creates platform resources. |
POST /undeploy/ | Undeploys the app. |
POST /execute/ | Sends requests to the running app. |
Memory Stores
Memory stores provide persistent data storage scoped to the user, application, or session. You configure them at design-time and access them in your tools at runtime.Configuration
Define a memory store using theMemoryStore class:
.set_memory_store() for each store to add multiple stores to the same app.
Scopes
| Scope | Description |
|---|---|
Scope.USER_SPECIFIC | Data unique to each user. Recommended for most cases. |
Scope.APPLICATION_WIDE | Data shared across all users. Use for global settings or shared resources. |
Scope.SESSION_LEVEL | Temporary data cleared when the session ends. |
Retention Policies
| Policy | Duration |
|---|---|
RetentionPolicy.DAY | 24 hours. |
RetentionPolicy.WEEK | 7 days. |
RetentionPolicy.MONTH | 30 days. |
RetentionPolicy.SESSION | Until the session ends. |
Runtime Usage
Access memory stores in your tools throughRequestContext:
Best Practices
- Define clear, focused schemas. Use
strict_schema=Truein production. - Use
USER_SPECIFICfor personal data,APPLICATION_WIDEfor shared resources, andSESSION_LEVELfor temporary state. - Choose retention policies based on data sensitivity and privacy requirements.
- Use projections in
get_content()to retrieve only the fields you need. - Always handle memory access errors and provide fallback values.
Logging
The SDK provides a structured logging system for tools. Logs are sent to the platform in real-time over SSE.Usage in Tools
Import and initializeLogger with the name of your tool:
Log Levels
| Level | When to use |
|---|---|
DEBUG | Detailed diagnostic information — variable values, function entry/exit points. |
INFO | Normal operation tracking — tool start, successful operations, completion. |
WARNING | Situations that don’t prevent execution but may need attention. |
ERROR | Errors that prevent normal operation. |
Log Message Structure
Each log message is automatically structured with these fields:Example
Receiving Logs
Logs are delivered via SSE. Use a raw SSE client or the MCP client to receive them. SSE client:Best Practices
- Use descriptive logger names that identify the tool or component — for example,
'GreetTool'or'MultiplyMatricesTool'. - Include relevant context (parameters, request IDs) in log messages.
- Log errors with enough detail to diagnose the issue, including stack traces when available.
- Use
DEBUGfor troubleshooting,INFOfor normal flow, and reserveWARNINGandERRORfor actionable conditions.