Skip to main content

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.
The diagram below shows how these API categories map to the development workflow.

Quick Start

The following examples show a minimal app definition and a tool implementation that uses runtime services.

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: Configuration 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: OrchestratorType: AppBuilder methods:

Agent

from agenticai_core.designtime.models.agent import Agent, AgentRole, AgentSubType, AgentType, AgentBuilder Defines an AI agent’s behavior, capabilities, and LLM configuration. Parameters: Supporting enumerations: AgentConfig parameters (optional overrides for agent prompts): Key method: agent.to_agent_meta()AgentMeta — Returns a lightweight representation used for orchestrator registration.

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 types: Use the @Tool.register decorator to register Python functions as MCP tools:

LlmModel

from agenticai_core.designtime.models.llm_model import LlmModel, LlmModelConfig, LlmModelBuilder Configures the language model for an agent or app. LlmModel parameters: LlmModelConfig parameters: Temperature guidance:

Prompt

from agenticai_core.designtime.models.prompt import Prompt Defines the system instructions and behavioral rules for an agent. Parameters: Template variables — Resolved at runtime in custom and instructions:

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: Scope values: Namespace parameters: RetentionPolicy parameters:
  • Define clear, focused schemas. Use strict_schema=True in production.
  • Use USER_SPECIFIC for personal data, APPLICATION_WIDE for shared resources, and SESSION_LEVEL for temporary state.
  • Match technical_name to how you’ll reference the store in runtime code.
  • Choose retention policies based on data sensitivity and privacy requirements.
  • Use DYNAMIC namespaces 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: FillerMessages parameters:

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:
Do not create namespaces for environments (for example, development, production). Use functional names like authentication or database. The platform handles environment resolution automatically.

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: Accessing variables in tool code:
  • Always set is_secured=True for credentials, API keys, tokens, and passwords.
  • Use $env.VAR_NAME to reference OS environment variables rather than hardcoding secrets.
  • Use a default namespace 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: Common icon names:

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:
  1. The user sends a request via the Platform interface.
  2. The Platform (MCP Client) calls the SDK Orchestrator (MCP Server).
  3. The SDK Orchestrator receives a MessageItem and returns a ToolCall.
  4. The Platform Agent executes based on the orchestrator’s routing.
  5. The Platform calls back to SDK tools, which use runtime services to process the request.
  6. Results flow back through the Platform to the user.
Available runtime services:

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.
Properties and methods:

EnvironmentVariables

Accessed via await ctx.get_environment_variables(). Provides attribute-style access to app variables configured at design-time using AppVariable. Access patterns:
Basic access:
Type conversion:
  • Call get_environment_variables() once per tool invocation and reuse the result.
  • Use env.get(name, default) for optional variables to avoid AttributeError.
  • Never log variables that contain key, secret, password, or token in their names. Redact them in output.

Memory

Accessed via ctx.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()): MemoryStoreManager (from ctx.get_memory_store_manager(name)): An async context manager for operations on a single store.
Basic CRUD with MemoryManager:
Store-specific operations with MemoryStoreManager:
Multi-store operations:
Projections — include and exclude fields:
  • Use projections to fetch only the fields you need. Avoid {} projections that return entire documents.
  • Always check result.success before accessing result.data.
  • Provide fallback values when memory is unavailable — don’t let memory failures break tool responses.
  • Use MemoryStoreManager as 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:
Log methods:
Basic logging:
With shared RequestContext:
Logger not capturing session context:
Missing log output:
Performance impact from logging:
  • Use descriptive logger names: Logger('UserAuthTool') not Logger('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: Decorator:
Span naming convention: Automatically captured context: The tracer captures user ID, session ID, app ID, request ID, function arguments, return values, execution time, and exception details — without any additional code.
Tracing a tool:
Tracing an orchestrator:
With metadata:
Tracing not working:
Missing context in spans:
  • Ensure tracing occurs within an MCP request context, not at module level.
  • Verify .env files are loaded before the tracer initializes.
Performance issues:
  • Reduce span volume — only trace business-critical operations.
  • Avoid large objects in metadata.
  • Trace tools, agents, and orchestrators. Skip utility functions.
  • Use descriptive span_name values — Tool:validate_credit_card not tool1.
  • Add metadata that helps diagnose failures — operation type, service name, feature flags.
  • Let the tracer capture exceptions automatically by re-raising them rather than swallowing.