Skip to main content

SDK for building AI agent 2.0.

Project description

Agentic AI SDK

A production-ready SDK for building AI agents with planning, workspace management, and observability.

Installation

# Basic installation
pip install agentic-ai-sdk

# With AG-UI protocol support
pip install agentic-ai-sdk[ag-ui]

# With observability (OpenTelemetry)
pip install agentic-ai-sdk[observability]

# All features
pip install agentic-ai-sdk[all]

Quick Start

1. Basic Agent

from agentic_ai import (
    DeepAgentSession,
    build_agent,
    create_workspace,
    LLMClientFactory,
)

# Create workspace
workspace = create_workspace(".ws/my_agent")

# Create LLM factory
llm_factory = LLMClientFactory.from_config({
    "default": {
        "provider": "azure_openai",
        "model": "gpt-4o",
        "endpoint": "https://your-endpoint.openai.azure.com",
    }
})

# Build agent session
session = build_agent(
    chat_client=llm_factory.get_client("default"),
    workspace=workspace,
    agent_id="my_agent",
    tools=[your_tool_1, your_tool_2],
    instructions="You are a helpful assistant.",
)

# Run the agent
response = await session.run("Hello, what can you do?")
print(response.text)

2. Using Configuration Files

Create a env.yaml:

llm_profiles:
  - name: default
    provider: azure_openai
    model: gpt-4o
    endpoint: ${AZURE_OPENAI_ENDPOINT}
    api_key: ${AZURE_OPENAI_API_KEY}

agents:
  - id: analyst
    llm_profile_name: default
    system_prompt_file: manifest/prompts/analyst.md
    planning_enabled: true
    max_tool_iterations: 30

Then load and use it:

from agentic_ai import (
    BaseAppContext,
    build_app_context,
    build_agent_from_store,
    create_workspace,
)

# Load configuration
ctx = build_app_context("env.yaml")

# Create workspace
workspace = create_workspace(".ws/analyst")

# Build agent from config store
session = build_agent_from_store(
    agent_store=ctx.agent_store,
    llm_factory=ctx.llm_factory,
    agent_id="analyst",
    workspace=workspace,
    tools=[...],
)

response = await session.run("Analyze the sales data")

3. Streaming Responses

async for update in session.run_stream("Generate a report"):
    if update.text:
        print(update.text, end="", flush=True)

4. With AG-UI Protocol

from agentic_ai import build_ag_ui_agent, DeepAgentProtocolAdapter

# Wrap session for AG-UI
adapter = DeepAgentProtocolAdapter(session)

# Or use the convenience function
agent = build_ag_ui_agent(
    agent_store=ctx.agent_store,
    llm_factory=ctx.llm_factory,
    agent_id="analyst",
    workspace=workspace,
    tools=[...],
)

Core Concepts

DeepAgentSession

The main entry point for interacting with an agent. It wraps a ChatAgent and provides:

  • Workspace Management: Persistent storage for artifacts and state
  • Planning: Built-in planning tool for complex tasks
  • Context Compaction: Automatic history management for long conversations
  • Observability: Logging and tracing integration

Configuration

The SDK uses a hierarchical configuration system:

  • LLMConfig: LLM provider settings (model, endpoint, temperature, etc.)
  • AgentConfig: Agent-specific settings (prompt, tools, planning, etc.)
  • BaseAppConfig: Application-wide configuration

Tools Manifest & Config Injection

Tools can be declared in manifest/tools.yaml with two config layers:

  • config_section: Injects a runtime config section (from env.yaml)
  • config: Declarative per-tool overrides in tools.yaml

Inside tools, use get_effective_tool_config() to read both:

from agentic_ai.tool_runtime import get_effective_tool_config

tool_cfg = get_effective_tool_config("openmetadata")
section = tool_cfg["section"]
overrides = tool_cfg["config"]

Recommended precedence: tool overrides > injected section values > runtime defaults.

Workspace

Each agent session has a workspace for storing:

  • Artifacts: Tool outputs, generated files
  • Plans: Task plans and progress tracking
  • State: Session state and context

Middleware

Extend agent behavior with middleware:

from agentic_ai import ToolResultPersistenceMiddleware

# Auto-persist tool results to workspace
middleware = ToolResultPersistenceMiddleware(auto_persist=True)

session = build_agent(
    ...,
    function_middlewares=[middleware],
)

API Reference

Agent Builders

Function Description
build_agent() Create session with chat client
build_agent_with_llm() Create session with LLM factory
build_agent_from_config() Create session from AgentConfig
build_agent_from_store() Create session from config store
build_agent_session() Low-level session builder

Configuration

Class Description
AgentConfig Agent configuration schema
LLMConfig LLM provider configuration
BaseAppConfig Base application config
AgentConfigStore Store for multiple agent configs
LLMClientFactory Factory for creating LLM clients

Workspace & Artifacts

Class/Function Description
WorkspaceHandle Handle to a workspace directory
WorkspaceManager Manages multiple workspaces
create_workspace() Create a new workspace
ArtifactStore Store for tool artifacts
persist_artifact() Save artifact to workspace

Planning

Class Description
PlanStore Stores task plans
PlanRecord A plan with steps
PlanStep A single step in a plan
build_update_plan_tool() Creates the update_plan tool

Observability

Function Description
setup_logging() Configure logging
enable_observability() Enable tracing
get_tracer() Get OpenTelemetry tracer

Examples

See the examples/ directory for complete examples:

  • basic_agent.py - Simple agent setup
  • config_based_agent.py - Configuration-driven agent
  • streaming_agent.py - Streaming responses
  • multi_agent.py - Multiple coordinated agents

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentic_ai_sdk-0.1.1.tar.gz (86.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentic_ai_sdk-0.1.1-py3-none-any.whl (112.0 kB view details)

Uploaded Python 3

File details

Details for the file agentic_ai_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: agentic_ai_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 86.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.3

File hashes

Hashes for agentic_ai_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c84f0ef0a8c1f9084524d413bcae7e0e1272a3800f2a8afd322d021aac98c095
MD5 2e386a203fd8b61b0b16fef19042e692
BLAKE2b-256 e75a401b71fc8771d3b258037a2ac8ee7c953ef65d5e1c5e78a4bcc0aa6427dc

See more details on using hashes here.

File details

Details for the file agentic_ai_sdk-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for agentic_ai_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d528a893966b2b8d6499f4d0dce7b442f84b83dc86a462f426d83e965e7a2d44
MD5 7ff8db9553c7db915f93b5e8ac17e7f3
BLAKE2b-256 50fcc515415ce8538a5748f2fae045f8caa4eb637ccba21b4e115f49f399bd42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page