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.3.0.tar.gz (43.1 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.3.0-py3-none-any.whl (53.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agstack-1.3.0.tar.gz
Algorithm Hash digest
SHA256 86793aacbb84b3ad7a36824b2c95f361a0e44f27bbc70eaf80684bda76a77dec
MD5 095a9cba08fb2f5f9d15b833c14f88de
BLAKE2b-256 5985f3a8dc0c4db62669cdeb43f8335173618ac804d54d7b1ed2e98bff43d9bd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for agstack-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 100210ec3db5f2cd61e72589cbe1f6d67a08be55f4901ef73d4f418dd4176ab7
MD5 cff912da3b08ca71634bc4713bb33475
BLAKE2b-256 5d5eae4c1a0eee8798983a453dfb79d398e18bbbc6c7bdc16a72a42160682590

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