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.0.7.tar.gz (40.0 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.0.7-py3-none-any.whl (49.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agstack-1.0.7.tar.gz
Algorithm Hash digest
SHA256 38a000b6aef96c451f31500982eebd476c01f674e51102c77cd6dc02ca41c72b
MD5 b426de71ef9e1d3d317d87cf85652c69
BLAKE2b-256 251947f0e7df6a3d06b97ad164e70561e0dd611ddd289985d30d92e9453a791f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for agstack-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8a2356a36e2453c441fed882ec511e46ae60afe6da7f5ec519ca04137d85afc4
MD5 757e80491993621fe3be5f6aa855595f
BLAKE2b-256 59f87c036389cd3f1c98f118ffb494af1cc79bc98cd43d6ae4b0f3147658fbd6

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