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.8.2.tar.gz (52.3 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.8.2-py3-none-any.whl (63.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agstack-1.8.2.tar.gz
Algorithm Hash digest
SHA256 f90217b3e08fcac51dca1503b6827267e96103c7c12b47e9a970bd8169d2719f
MD5 1bede3687b260cbee5f48fefd6bfb5a3
BLAKE2b-256 77de0d8b3f84faacd78b2df973601ee87a0ec1a3c49e721a7ad21d02f52ce6ae

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for agstack-1.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0cd54cd137484aace0068cf221ed8794e918d1fe3ef15b6a066db00a8da1d424
MD5 08af002786298ab73393f9ca9cfa1b27
BLAKE2b-256 de34ab3642cf0a400a7d21eff61abcd7eae2b091de84b51e12ebc190ad3f1fa4

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