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 safetyhttpx (^0.24)- Modern async HTTP clientlangchain (^0.1)- LLM framework for building applicationslanggraph (^0.0.20)- Workflow orchestration framework
Development Dependencies:
pytest (^7)- Testing frameworkblack (^22)- Code formatterisort (^5)- Import sorterflake8 (^5)- Lintermypy (^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
- Development Guide - Setup, workflow, and contribution guidelines
- ADK README - Detailed module documentation
- Release Notes - Version history and changes
๐ค Contributing
Contributions are welcome! Please follow our development workflow:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes with comprehensive tests
- Ensure code quality passes (
make check) - Run the full test suite (
make test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Submit a pull request
Branch Strategy
main- Main development branchfeature/*- Feature branchesbugfix/*- Bug fix brancheshotfix/*- 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
- PyPI Package: https://pypi.org/project/aigility/
- Source Code: https://github.com/AIGility-Cloud-Innovation/aigility
- Documentation: https://aigility.readthedocs.io
Keywords: aigility, agent, langchain, langgraph, workflow, chat, rag, memory, ai, llm, python-sdk, async, type-safe, api-client
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ff75f41ddeb535b4d8e8b2b562de0c545e0db5a06ae1c5ce9b3bc280e5a093a
|
|
| MD5 |
a93b49a7704ce00d5a0c05a7252d19fe
|
|
| BLAKE2b-256 |
135c809c938b8f1fe07d1d63c80b2705c65c7bf56f97ecbfc7a0075107155337
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d02fafac83d26ab76f081d57cb5ba1f2ef44b76f65a7f797f54ba3c8395706e8
|
|
| MD5 |
6f08cb776f4dfd322d2f30b123ce5191
|
|
| BLAKE2b-256 |
99a96a1c579560102693cd24db9df0deb40da90b4415276aaa3413c1f741f9cc
|