Skip to main content

Production-ready toolkit for building FastAPI and LLM applications

Project description

AgStack

Production-ready toolkit for building FastAPI and LLM applications

Python License Version

๐Ÿ“– 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 BaseSchema for Pydantic models
  • Use ruff and pyright for 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

๐Ÿ”— 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


Download files

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

Source Distribution

agstack-1.7.0.tar.gz (52.8 kB view details)

Uploaded Source

Built Distribution

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

agstack-1.7.0-py3-none-any.whl (64.8 kB view details)

Uploaded Python 3

File details

Details for the file agstack-1.7.0.tar.gz.

File metadata

  • Download URL: agstack-1.7.0.tar.gz
  • Upload date:
  • Size: 52.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for agstack-1.7.0.tar.gz
Algorithm Hash digest
SHA256 d0dfdcc97b76fe526463782075c672566853be52f18f87a781616ca7546f3f86
MD5 9ad4c0dcc3fb1c0144e2c466140dc713
BLAKE2b-256 4e89576c5d5699048f9f38f47d83ee6fc0b563f4ac278b167c29777c020c973d

See more details on using hashes here.

File details

Details for the file agstack-1.7.0-py3-none-any.whl.

File metadata

  • Download URL: agstack-1.7.0-py3-none-any.whl
  • Upload date:
  • Size: 64.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for agstack-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a352de9a88af51e2fddf96eacfd701bbaaff9394c0298c5c131d777333d3538
MD5 454b0b7f1efc5662494e252c64e38d95
BLAKE2b-256 5c335ced30d4897e4d99ad2258f0c9874c60a457e92e17c1ed143b96581cd228

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