API Reference
The AgenticAI Core SDK provides two categories of APIs:- Design-time models — Define your app structure, agents, tools, LLM configuration, memory stores, and environment variables before deployment.
- Runtime APIs — Access session context, environment variables, memory, logging, and tracing from within your tools and orchestrators during request processing.
Quick Start
The following examples show a minimal app definition and a tool implementation that uses runtime services.Define an app
Define an app
Implement a tool
Implement a tool
Deploy
Deploy
Design-Time APIs
Design-time models are the blueprint of your application. Use them to define app structure, configure agents, and set up tools, memory stores, and environment variables before deployment. The diagram below shows how the core models relate to each other. Core models:App
from agenticai_core.designtime.models.app import App, OrchestratorType, AppBuilder
The top-level container for your application. It holds agents, memory stores, namespaces, variables, and configuration.
Parameters:
Direct instantiation
Direct instantiation
Builder pattern
Builder pattern
Multi-agent application
Multi-agent application
Agent
from agenticai_core.designtime.models.agent import Agent, AgentRole, AgentSubType, AgentType, AgentBuilder
Defines an AI agent’s behavior, capabilities, and LLM configuration.
Parameters:
agent.to_agent_meta() → AgentMeta — Returns a lightweight representation used for orchestrator registration.
Basic agent
Basic agent
Builder pattern
Builder pattern
Tool
from agenticai_core.designtime.models.tool import Tool, ToolBuilder
Defines a capability available to agents. Supports MCP tools (custom Python functions), inline tools, tool library tools, and more.
Parameters:
@Tool.register decorator to register Python functions as MCP tools:
Registering MCP tools
Registering MCP tools
MCP tool (custom Python function)
MCP tool (custom Python function)
Inline tool
Inline tool
Tool library tool
Tool library tool
Builder pattern
Builder pattern
LlmModel
from agenticai_core.designtime.models.llm_model import LlmModel, LlmModelConfig, LlmModelBuilder
Configures the language model for an agent or app.
LlmModel parameters:
OpenAI
OpenAI
Anthropic
Anthropic
Azure OpenAI
Azure OpenAI
Builder pattern
Builder pattern
Prompt
from agenticai_core.designtime.models.prompt import Prompt
Defines the system instructions and behavioral rules for an agent.
Parameters:
custom and instructions:
Basic prompt
Basic prompt
With instructions
With instructions
With memory context injection
With memory context injection
Orchestrator prompt
Orchestrator prompt
MemoryStore
from agenticai_core.designtime.models.memory_store import MemoryStore, Namespace, RetentionPolicy, Scope, RetentionPeriod, NamespaceType
Configures persistent data storage for your application. You access memory stores at runtime via the Memory runtime API.
MemoryStore parameters:
Session-scoped store
Session-scoped store
User-specific store
User-specific store
- Define clear, focused schemas. Use
strict_schema=Truein production. - Use
USER_SPECIFICfor personal data,APPLICATION_WIDEfor shared resources, andSESSION_LEVELfor temporary state. - Match
technical_nameto how you’ll reference the store in runtime code. - Choose retention policies based on data sensitivity and privacy requirements.
- Use
DYNAMICnamespaces to isolate data per user or session.
AppConfiguration
from agenticai_core.designtime.models.app_configuration import AppConfigurations, FillerMessages, FillerMessageMode, StaticConfig, DynamicConfig
Configures advanced app features such as streaming, file attachments, external agent integration, and filler messages.
AppConfigurations parameters:
Static filler messages
Static filler messages
Dynamic filler messages
Dynamic filler messages
AppNamespace
from agenticai_core.designtime.models.app_namespace import AppNamespace
Defines logical groupings for scoping app variables. Namespaces represent functional areas (for example, authentication, database), not environments — the platform resolves environment-specific variables automatically based on deployment context.
Parameters:
development, production). Use functional names like authentication or database. The platform handles environment resolution automatically. Usage examples
Usage examples
AppVariable
from agenticai_core.designtime.models.app_variable import AppVariable
Defines environment variables accessible in tool code and agent configurations. Variables are scoped to namespaces.
Parameters:
- Always set
is_secured=Truefor credentials, API keys, tokens, and passwords. - Use
$env.VAR_NAMEto reference OS environment variables rather than hardcoding secrets. - Use a
defaultnamespace for variables that apply broadly. - Set
namespaces=[]for truly global variables available everywhere.
Icon
from agenticai_core.designtime.models.icon import Icon
Defines visual identifiers for apps, agents, and tools.
Parameters:
Usage examples
Usage examples
Runtime APIs
Runtime APIs provide access to services available during request processing. Use them inside your tool functions and orchestrator methods. The diagram below shows how runtime services fit into the request flow. Message protocol flow:- The user sends a request via the Platform interface.
- The Platform (MCP Client) calls the SDK Orchestrator (MCP Server).
- The SDK Orchestrator receives a
MessageItemand returns aToolCall. - The Platform Agent executes based on the orchestrator’s routing.
- The Platform calls back to SDK tools, which use runtime services to process the request.
- Results flow back through the Platform to the user.
RequestContext
from agenticai_core.runtime.sessions.request_context import RequestContext
Provides access to request and session information and returns handles to all other runtime services. Always initialize RequestContext inside your tool or orchestrator method. Never initialize it at module level — it depends on active HTTP request headers that only exist during request processing.
Usage example
Usage example
EnvironmentVariables
Accessed viaawait ctx.get_environment_variables().
Provides attribute-style access to app variables configured at design-time using AppVariable.
Access patterns:
Usage examples
Usage examples
Best practices
Best practices
- Call
get_environment_variables()once per tool invocation and reuse the result. - Use
env.get(name, default)for optional variables to avoidAttributeError. - Never log variables that contain
key,secret,password, ortokenin their names. Redact them in output.
Memory
Accessed viactx.get_memory() or ctx.get_memory_store_manager(name).
Provides read, write, and delete operations on memory stores configured at design-time with MemoryStore.
MemoryManager methods (from ctx.get_memory()):
ctx.get_memory_store_manager(name)):
An async context manager for operations on a single store.
Usage examples
Usage examples
Best practices
Best practices
- Use projections to fetch only the fields you need. Avoid
{}projections that return entire documents. - Always check
result.successbefore accessingresult.data. - Provide fallback values when memory is unavailable — don’t let memory failures break tool responses.
- Use
MemoryStoreManageras an async context manager for coordinated operations on a single store.
Logger
from agenticai_core.runtime.sessions.request_context import Logger
Provides structured logging with automatic session context (user ID, session ID) included in every log entry.
Constructor:
Usage examples
Usage examples
Troubleshooting
Troubleshooting
Best practices
Best practices
- Use descriptive logger names:
Logger('UserAuthTool')notLogger('Tool'). - Include relevant context:
f"Processing payment: amount={amount}, user={user_id}". - Never log sensitive data. Sanitize or redact passwords, API keys, and tokens.
- Use DEBUG for diagnostics, INFO for normal operations, WARNING and ERROR for actionable issues.
Tracer
from agenticai_core.runtime.trace._langfuse_tracer import Tracer
Provides distributed tracing for tool and orchestrator execution using Langfuse integration. The @tracer.observe decorator wraps functions to automatically capture inputs, outputs, timing, and session context.
Configuration — Set in your .env files:
Usage examples
Usage examples
Troubleshooting
Troubleshooting
- Ensure tracing occurs within an MCP request context, not at module level.
- Verify
.envfiles are loaded before the tracer initializes.
- Reduce span volume — only trace business-critical operations.
- Avoid large objects in
metadata.
Best practices
Best practices
- Trace tools, agents, and orchestrators. Skip utility functions.
- Use descriptive
span_namevalues —Tool:validate_credit_cardnottool1. - Add
metadatathat helps diagnose failures — operation type, service name, feature flags. - Let the tracer capture exceptions automatically by re-raising them rather than swallowing.