Skip to content

AgentKit SDK Overview

AgentKit SDK is a Python development toolkit for rapidly building Agent applications that comply with AgentKit Platform standards. The SDK provides a concise set of decorators and client interfaces, allowing developers to focus on implementing Agent business logic.

Core Architecture

AgentKit SDK adopts a modular design, consisting of the following primary modules:

1. Runtime Application Framework

Provides multiple application patterns, encapsulating user code into HTTP services that comply with Platform standards:

AgentkitSimpleApp

The most commonly used application framework, suitable for standard Agent applications.

Core Decorators:

  • @app.entrypoint - Defines the main entry function for the Agent
  • @app.ping - Defines the health check function
  • @app.async_task - Defines asynchronous tasks (planned)

Standard Routes:

  • /invoke - Agent invocation endpoint
  • /ping - Health check
  • /health, /readiness, /liveness - Kubernetes readiness probes

AgentkitMCPApp

An application framework based on the MCP (Model Context Protocol) protocol, used to encapsulate tools as MCP services.

Core Decorators:

  • @app.tool - Registers a function as an MCP tool
  • @app.agent_as_a_tool - Encapsulates an Agent as an MCP tool

AgentkitA2aApp

An application framework based on the A2A (Agent-to-Agent) protocol, used to build Agents that can communicate with each other.

Core Decorators:

  • @app.agent_executor - Registers an Agent executor
  • @app.task_store - Registers task storage (optional)

2. Platform Service Clients

Provides convenient client interfaces for accessing various services of the AgentKit Platform.

AgentkitMemory

Memory service client for managing long-term and short-term memory of Agents.

Main Functions:

  • create_memory_collection() - Creates a memory collection
  • list_memory_collections() - Lists memory collections
  • get_memory_collection() - Gets memory collection details
  • update_memory_collection() - Updates memory collection configuration
  • delete_memory_collection() - Deletes a memory collection
  • get_memory_connection_info() - Gets connection information

Design Philosophy: Decoupling of control plane and data plane

  • Control Plane (provided by SDK): Manages creation, configuration, and retrieval of connection information for memory collections
  • Data Plane (implemented by ADK): Performs actual memory read/write operations through MemoryBase or Mem0 protocols

AgentkitKnowledge

Knowledge base service client for managing vectorized knowledge bases of Agents.

Main Functions:

  • list_knowledge_bases() - Lists knowledge bases
  • add_knowledge_base() - Adds a knowledge base
  • get_knowledge_connection_info() - Gets knowledge base connection information
  • delete_knowledge_base() - Deletes a knowledge base

Use Cases:

  • RAG (Retrieval-Augmented Generation) applications
  • Document Q&A systems
  • Knowledge graph integration

AgentkitMCP

MCP Gateway client for managing and routing a large number of MCP tools.

Main Functions:

  • Registers and manages MCP services
  • Tool aggregation and intelligent routing
  • Reduces tool integration complexity

AgentkitRuntime

Runtime management client for managing Agent runtime environments.

Main Functions:

  • Creates and manages Runtime instances
  • Queries Runtime status
  • Configures environment variables and resources

3. Infrastructure Modules

BaseAgentkitClient

Base class for all clients, providing unified configuration and HTTP request capabilities.

Configuration Items:

  • API endpoint configuration
  • Authentication credential management
  • Request retry and timeout
  • Logging and monitoring

Context Management

Uses contextvars to manage context information for each request, including:

  • User identity
  • Session ID
  • Request metadata
  • Tracing information

Module Dependencies

AgentKit SDK

├── Runtime Apps (Application Framework Layer)
│   ├── AgentkitSimpleApp
│   ├── AgentkitMCPApp
│   ├── AgentkitA2aApp
│   └── AgentkitAgentServerApp

├── Platform Clients (Service Client Layer)
│   ├── AgentkitMemory
│   ├── AgentkitKnowledge
│   ├── AgentkitMCP
│   └── AgentkitRuntime

└── Infrastructure (Infrastructure Layer)
    ├── BaseAgentkitClient
    ├── Context
    └── Telemetry (Observability)

Key Features

1. Decorator-Driven

Uses Python decorators to simplify application development; developers only need to focus on business logic:

python
from agentkit.apps import AgentkitSimpleApp

app = AgentkitSimpleApp()

@app.entrypoint
async def run(payload: dict, headers: dict) -> str:
    # Business logic
    return response

2. Framework-Agnostic

The SDK does not restrict the use of specific Agent frameworks; it supports:

  • Volcengine ADK (veadk)
  • Google ADK (gadk)
  • LangChain
  • Custom frameworks

3. Automated Observability

Built-in OpenTelemetry support, automatically collects:

  • Traces
  • Metrics
  • Logging

4. Production-Ready

Provides complete production environment support:

  • Health check endpoints
  • Graceful shutdown
  • Error handling
  • Request retry

5. Type Safety

Full Python type annotations provide:

  • IDE autocomplete
  • Type checking
  • Better code maintainability

Quick Start

Installation

bash
pip install agentkit-sdk-python

Create a Simple Agent

python
from agentkit.apps import AgentkitSimpleApp
from veadk import Agent, Runner
from veadk.tools.demo_tools import get_city_weather

app = AgentkitSimpleApp()
agent = Agent(tools=[get_city_weather])
runner = Runner(agent=agent)

@app.entrypoint
async def run(payload: dict, headers: dict) -> str:
    prompt = payload["prompt"]
    user_id = headers["user_id"]
    session_id = headers["session_id"]
    
    response = await runner.run(
        messages=prompt,
        user_id=user_id,
        session_id=session_id
    )
    return response

@app.ping
def ping() -> str:
    return "pong!"

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8000)

Use Platform Services

python
from agentkit.sdk.memory import AgentkitMemory
from agentkit.base_client import ApiConfig

# Initialize client
config = ApiConfig(
    access_key="your_ak",
    secret_key="your_sk"
)
memory_client = AgentkitMemory(config)

# Create memory collection
response = memory_client.create_memory_collection(
    name="my-memory",
    short_term_configuration={...},
    long_term_configuration={...}
)
print(f"Memory ID: {response.id}")

Next Steps

  • Check the Annotation Usage Guide for detailed usage of various decorators
  • Refer to complete examples in the samples/ directory
  • Read the API documentation for Platform service clients

Released under the Apache-2.0 License.