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.5.tar.gz (39.9 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.5-py3-none-any.whl (49.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agstack-1.0.5.tar.gz
Algorithm Hash digest
SHA256 ca5c3f97a308ede39b454598a293f3bd780156c0e271b09628ed2febd97e9fa6
MD5 d342a997cf0cdd862744e233707035cc
BLAKE2b-256 4c11f47578592fd4aaad7c2a783dd3e67bc059f55398b06077a0576cf089ba3c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for agstack-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 80b861bb8cce090dda08b2d66cf816fb6d3a311cce0e05a4b80bf73941f7595d
MD5 f4aa63b34722aee3920d6d82b6d0d71e
BLAKE2b-256 4f1be8572f7b80881034ac4eb49fb2e56c5f90e00f51920dac39649bc5e25a84

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