Skip to main content

A modern Python ADK - Agent Development Kit for building AI agents with LangGraph and LangChain. This library provides a comprehensive, type-safe framework for developing intelligent agents with chat, workflow, memory, and knowledge management capabilities.

Project description

AIGility

License: MIT

A modern Python ADK - Agent Development Kit for building AI agents with LangGraph and LangChain. This library provides a comprehensive, type-safe framework for developing intelligent agents with chat, workflow, memory, and knowledge management capabilities.

โœจ Features

  • Complete Agent Framework: Chat, ChatFlow, Workflow, Knowledge, and Memory management modules
  • Builder Pattern: Fluent, chainable interface for constructing agents and workflows
  • Sync & Async Support: Both synchronous and asynchronous operations
  • Type Safety: Comprehensive type hints with Pydantic 2.x validation
  • Memory Management: Intelligent memory storage and retrieval with semantic search
  • Knowledge Base: RAG (Retrieval Augmented Generation) capabilities
  • Workflow Engine: State-based workflow orchestration with LangGraph
  • Modern HTTP Client: Built on httpx with connection pooling, circuit breaker, and retry mechanisms
  • Connection Pool Optimization: Efficient TCP connection reuse to reduce resource overhead

๐Ÿ“ฆ Installation

pip install aigility

Requirements: Python 3.8+

Core Dependencies:

  • pydantic (^2) - Data validation and settings management with type safety
  • httpx (^0.24) - Modern async HTTP client
  • langchain (^0.1) - LLM framework for building applications
  • langgraph (^0.0.20) - Workflow orchestration framework

Development Dependencies:

  • pytest (^7) - Testing framework
  • black (^22) - Code formatter
  • isort (^5) - Import sorter
  • flake8 (^5) - Linter
  • mypy (^1) - Static type checking

๐Ÿ› ๏ธ Technology Stack

  • Language: Python 3.8+
  • HTTP Client: httpx with connection pooling, circuit breaker, and retry optimization
  • Type System: Pydantic 2.x with comprehensive type validation
  • Architecture: Builder pattern with fluent API design + Service layer pattern
  • Async Support: Full async/await support
  • Agent Framework: LangChain for chat, LangGraph for workflows
  • Code Quality: Black + isort (formatting) + Flake8 (linting) + MyPy (type checking)
  • Testing: pytest with async support
  • Packaging: Modern Python packaging with pyproject.toml

๐Ÿš€ Quick Start

Basic Usage

from adk import create_client

# Initialize client with builder pattern
client = create_client(
    llm_provider="openai",
    llm_api_key="your-api-key",
    memory_api_key="your-memory-api-key",
    memory_base_url="http://localhost:8001"
)

# Use memory management
memory = client.memory
result = await memory.add(
    messages=[
        {"role": "user", "content": "Hello"},
        {"role": "assistant", "content": "Hi! How can I help you?"}
    ],
    user_id="user-123",
    character_id="assistant"
)

# Search memories
results = await memory.search(
    query="user preferences",
    user_id="user-123",
    limit=5
)

Builder Pattern

from adk import ADKClientBuilder

# Create client with builder pattern
client = (
    ADKClientBuilder()
    .with_llm(provider="openai", model="gpt-4", api_key="your-key")
    .with_memory(api_key="your-memory-key", base_url="http://localhost:8001")
    .with_knowledge(store_type="vector")
    .with_http(timeout=60.0, max_retries=3)
    .with_debug(enabled=True)
    .build()
)

๐Ÿ”ง Core Modules

Core Module

  • Base Classes: BaseAgent, BaseTool, BaseMemory - Abstract base classes for extensibility
  • Type System: State, Message, AgentResponse - Type-safe data structures
  • Configuration: ADKConfig, AgentConfig, ToolConfig - Comprehensive configuration management

HTTP Transport Layer

  • Connection Pool: Efficient connection reuse with health checks
  • Circuit Breaker: Automatic failure detection and recovery
  • Retry Mechanism: Configurable retry with exponential backoff

Memory Module

  • Memory Management: Add, search, and manage memories with semantic search
  • Layered Memory: Support for L1-L5 memory layers
  • User Context: User-specific memory storage and retrieval

Chat Module (Based on LangChain)

  • Chat Agents: Build conversational agents with LangChain
  • Tool Integration: Seamless tool integration for agent capabilities
  • Memory Integration: Automatic memory integration for context retention

ChatFlow Module (Based on LangGraph)

  • Conversation Flow: Multi-agent conversation orchestration
  • State Management: State-based flow control
  • Event Streaming: Real-time event streaming support

Workflow Module (Based on LangGraph)

  • Workflow Engine: State-based workflow orchestration
  • Graph Builder: Visual workflow graph construction
  • Node Management: Flexible node definition and execution

Knowledge Module (RAG)

  • Retriever: Abstract retriever interface for various backends
  • Knowledge Store: Vector, graph, and hybrid storage support
  • RAG Pipeline: Complete RAG pipeline builder

Model Module

  • LLM Provider: Unified interface for multiple LLM providers (OpenAI, Anthropic, etc.)
  • Embeddings Provider: Embedding model integration

๐Ÿ’ก Examples

Memory Management

from adk import create_client

client = create_client(memory_api_key="your-key")

# Add memory
result = await client.memory.add(
    messages=[{"role": "user", "content": "I love Python"}],
    user_id="user-123",
    character_id="assistant"
)

# Search memories
results = await client.memory.search(
    query="programming preferences",
    user_id="user-123",
    limit=5
)

Creating Chat Agents

from adk import create_client
from adk.core.config import AgentConfig

client = create_client(llm_provider="openai", llm_api_key="your-key")

# Create chat agent
agent = client.create_chat_agent(
    name="my_agent",
    config=AgentConfig(
        name="my_agent",
        description="A helpful assistant",
        prompt_template="You are a helpful assistant.",
        tools=["search", "calculator"]
    )
)

Workflow Creation

from adk.workflow import WorkflowGraphBuilder
from adk.core.types import State

# Build workflow
builder = WorkflowGraphBuilder()
builder.add_node("start", start_node_func)
builder.add_node("process", process_node_func)
builder.add_edge("start", "process")
builder.set_start("start")

# Create and run workflow
workflow = builder.build()
result = await workflow.invoke(initial_state=State())

๐Ÿ› ๏ธ Development

Prerequisites

  • Python 3.8+
  • pip or poetry (for dependency management)
  • Git (for version control)

Setup

# Clone repository
git clone https://github.com/AIGility-Cloud-Innovation/aigility.git
cd aigility

# Install in development mode
pip install -e ".[dev]"

# Or with poetry
poetry install

Code Quality Tools

# Format code
make format

# Lint code
make lint

# Run type checking
make type-check

# Run all checks
make check

Testing

# Run tests
make test

# Run tests with coverage
make test-cov

# Run specific test module
pytest tests/memory/ -v

Build & Publish

# Build package
make build

# Publish to PyPI
make publish

๐Ÿ“ Project Structure

aigility/
โ”œโ”€โ”€ adk/                    # Main SDK package
โ”‚   โ”œโ”€โ”€ core/               # Core functionality
โ”‚   โ”‚   โ”œโ”€โ”€ base.py         # Base classes (BaseAgent, BaseTool, BaseMemory)
โ”‚   โ”‚   โ”œโ”€โ”€ config.py       # Configuration management
โ”‚   โ”‚   โ””โ”€โ”€ types.py        # Type definitions
โ”‚   โ”œโ”€โ”€ http/               # HTTP transport layer
โ”‚   โ”‚   โ”œโ”€โ”€ client.py       # HTTP client
โ”‚   โ”‚   โ”œโ”€โ”€ pool.py         # Connection pool
โ”‚   โ”‚   โ”œโ”€โ”€ circuit_breaker.py  # Circuit breaker
โ”‚   โ”‚   โ””โ”€โ”€ retry.py        # Retry mechanism
โ”‚   โ”œโ”€โ”€ model/              # Model layer
โ”‚   โ”‚   โ”œโ”€โ”€ llm.py          # LLM provider
โ”‚   โ”‚   โ””โ”€โ”€ embeddings.py   # Embeddings provider
โ”‚   โ”œโ”€โ”€ utils/              # Utility functions
โ”‚   โ”‚   โ”œโ”€โ”€ logger.py       # Logging utilities
โ”‚   โ”‚   โ””โ”€โ”€ workflow.py     # Workflow utilities
โ”‚   โ”œโ”€โ”€ memory/             # Memory management
โ”‚   โ”‚   โ”œโ”€โ”€ client.py       # Memory client
โ”‚   โ”‚   โ”œโ”€โ”€ memory.py       # Memory interface
โ”‚   โ”‚   โ””โ”€โ”€ types.py        # Memory types
โ”‚   โ”œโ”€โ”€ chat/               # Chat module (LangChain)
โ”‚   โ”‚   โ””โ”€โ”€ agent.py        # Chat agent
โ”‚   โ”œโ”€โ”€ chatflow/           # ChatFlow module (LangGraph)
โ”‚   โ”‚   โ””โ”€โ”€ flow.py         # ChatFlow
โ”‚   โ”œโ”€โ”€ workflow/           # Workflow module (LangGraph)
โ”‚   โ”‚   โ”œโ”€โ”€ engine.py       # Workflow engine
โ”‚   โ”‚   โ””โ”€โ”€ builder.py      # Workflow builder
โ”‚   โ”œโ”€โ”€ knowledge/          # Knowledge module (RAG)
โ”‚   โ”‚   โ”œโ”€โ”€ retriever.py    # Retriever interface
โ”‚   โ”‚   โ””โ”€โ”€ store.py        # Knowledge store
โ”‚   โ””โ”€โ”€ client.py           # Main client interface
โ”œโ”€โ”€ docs/                   # Documentation
โ”œโ”€โ”€ examples/               # Usage examples
โ”œโ”€โ”€ tests/                  # Test suite
โ”œโ”€โ”€ pyproject.toml          # Project configuration
โ”œโ”€โ”€ Makefile               # Development automation
โ””โ”€โ”€ DEVELOPMENT.md         # Development guide

๐Ÿ“– Documentation

๐Ÿค Contributing

Contributions are welcome! Please follow our development workflow:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes with comprehensive tests
  4. Ensure code quality passes (make check)
  5. Run the full test suite (make test)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Submit a pull request

Branch Strategy

  • main - Main development branch
  • feature/* - Feature branches
  • bugfix/* - Bug fix branches
  • hotfix/* - Urgent fixes

See DEVELOPMENT.md for detailed development guidelines.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ”— Links

Keywords: aigility, agent, langchain, langgraph, workflow, chat, rag, memory, ai, llm, python-sdk, async, type-safe, api-client

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

aigility-0.0.2.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

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

aigility-0.0.2-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file aigility-0.0.2.tar.gz.

File metadata

  • Download URL: aigility-0.0.2.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.5

File hashes

Hashes for aigility-0.0.2.tar.gz
Algorithm Hash digest
SHA256 9ff75f41ddeb535b4d8e8b2b562de0c545e0db5a06ae1c5ce9b3bc280e5a093a
MD5 a93b49a7704ce00d5a0c05a7252d19fe
BLAKE2b-256 135c809c938b8f1fe07d1d63c80b2705c65c7bf56f97ecbfc7a0075107155337

See more details on using hashes here.

File details

Details for the file aigility-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: aigility-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 29.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.5

File hashes

Hashes for aigility-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d02fafac83d26ab76f081d57cb5ba1f2ef44b76f65a7f797f54ba3c8395706e8
MD5 6f08cb776f4dfd322d2f30b123ce5191
BLAKE2b-256 99a96a1c579560102693cd24db9df0deb40da90b4415276aaa3413c1f741f9cc

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