Production-ready toolkit for building FastAPI and LLM applications
Project description
AgStack
Production-ready toolkit for building FastAPI and LLM applications
๐ Overview
AgStack is a comprehensive Python framework designed for building production-ready FastAPI applications with integrated LLM capabilities. It provides:
- ๐ FastAPI Integration - Production-ready web framework setup
- ๐ค LLM Flow System - Orchestrate Agents, Tools, and Flows
- ๐ฆ Component Registry - Unified registration and factory pattern
- ๐ Security - Built-in authentication and authorization (Casbin)
- ๐๏ธ Infrastructure - Database, Elasticsearch, and Message Queue support
- ๐ Schema System - Unified Pydantic models with enhanced serialization
๐ Quick Start
Installation
pip install agstack
Basic Usage
from agstack.llm.flow import (
Tool,
FlowContext,
registry,
create_tool
)
# Define a tool
class MyTool(Tool):
def __init__(self):
super().__init__(
name="my_tool",
description="My custom tool",
function=self.execute
)
async def execute(self, context: FlowContext):
return "Tool result"
# Register the tool
registry.register_tool("my_tool", MyTool)
# Use the tool
context = FlowContext(session_id="test")
tool = create_tool("my_tool")
result = await tool.run(context)
๐ Documentation
- Usage Guide - Learn how to use AgStack in your projects
- Development Rules - Guidelines for contributing to AgStack
- API Reference - Coming soon
- Examples - Coming soon
๐๏ธ Architecture
Project Structure
agstack/
โโโ schema.py # Base Pydantic models
โโโ registry.py # Global component registry
โโโ exceptions.py # Exception hierarchy
โโโ llm/ # LLM and AI features
โ โโโ client.py # LLM client
โ โโโ flow/ # Flow execution framework
โ โโโ agent.py # Agent definition
โ โโโ tool.py # Tool definition
โ โโโ flow.py # Flow orchestration
โ โโโ ...
โโโ fastapi/ # FastAPI integration
โโโ infra/ # Infrastructure components
โ โโโ db/ # Database
โ โโโ es/ # Elasticsearch
โ โโโ mq/ # Message Queue
โโโ security/ # Security features
Core Concepts
- Agent - LLM-powered intelligent agents
- Tool - Functions that can be called by agents
- Flow - Orchestration of multiple agents and tools
- Registry - Centralized component management
- BaseSchema - Enhanced Pydantic models with unified configuration
๐ ๏ธ Development
Requirements
- Python >= 3.12
- Dependencies listed in
pyproject.toml
Setup
# Clone the repository
git clone https://github.com/xtravisions/agstack.git
cd agstack
# Install dependencies
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install
Code Quality
# Format code
ruff format .
# Lint
ruff check .
# Type check
pyright
Contributing
Please read DEVELOPMENT_RULES.md for development guidelines and coding standards.
๐ฆ Features
LLM Flow System
- Agent System - Create and manage LLM-powered agents
- Tool System - Define reusable tools for agents
- Flow Orchestration - Chain multiple agents and tools
- Context Management - Maintain state across execution
- Event System - AG-UI protocol support
FastAPI Integration
- Production-ready setup
- Middleware support
- Exception handling
- Request/Response schemas
Infrastructure
- Database - PostgreSQL with async support (asyncpg)
- Elasticsearch - Full-text search integration
- Message Queue - Async message processing (aio-pika)
Security
- JWT authentication
- Casbin authorization
- Password hashing (bcrypt)
๐ค Contributing
We welcome contributions! Please see our Development Rules for guidelines.
Key Guidelines
- Use relative imports (not
from agstack...) - Inherit from
BaseSchemafor Pydantic models - Use
ruffandpyrightfor code quality - Follow Python 3.12+ standards
- Write tests for new features
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ฅ Authors
- XtraVisions - gitadmin@xtravisions.com
- Chen Hao - chenhao@xtravisions.com
๐ Links
- Documentation: docs/
- GitHub: (TBD)
- Issues: (TBD)
- PyPI: (TBD)
๐ Changelog
See CHANGELOG.md for release history.
Note: AgStack is under active development. APIs may change before the 1.0 stable release.
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 agstack-1.10.2.tar.gz.
File metadata
- Download URL: agstack-1.10.2.tar.gz
- Upload date:
- Size: 56.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
697cd6acaee62cc4bd5b1ebe83596cf2c90c4046c8f1bd852c37c57d823ae50d
|
|
| MD5 |
879af181b78da060b6414773a04597cb
|
|
| BLAKE2b-256 |
c7ab8cdc273cb2a9278028ce2373ff3d3371578991eda7d3435ad59ee9bb960f
|
File details
Details for the file agstack-1.10.2-py3-none-any.whl.
File metadata
- Download URL: agstack-1.10.2-py3-none-any.whl
- Upload date:
- Size: 66.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c565e2cf36469d5d87e8fdb2f0d03865cd731fd7cc63b15cf27b1169cc73697b
|
|
| MD5 |
975d312aed2d8bbb4cbabe1b15fe9340
|
|
| BLAKE2b-256 |
7adcd8e5bc9e7113deaaa1f743366a3a5943d6e04c45fd0f78dbd2ce2471f10c
|