The Modern Python Framework

Structure
before

you need it

Lexigram is an async-first Python framework built around a powerful Dependency Injection container. Stop wrestling with global state and start building robust, modular backends that scale gracefully.

$ pip install lexigram
app.py
from lexigram import Application
from lexigram.web import WebProvider
from lexigram.ai import AIProvider

app = Application(name="my-app")
app.add_providers([
    WebProvider(), AIProvider()
])

↑ A fully wired async app — zero global state

Built for Scale

A unified ecosystem with type safety, zero globals, and an async-first foundation.

Type Safety at Scale

End-to-end type safety with full container inference. Your IDE knows what exists — no guessing, no surprises.

IDE Auto-completion active

Async by Default

Built for modern Python. Async isn't an add-on — it's the foundation of every layer.

Lifecycle You Trust

Services start in order, shut down cleanly, and never leak resources.

One Unified Ecosystem

Web, AI, SQL, events, tasks, auth, cache, search — everything works together, not against each other. Plug and play modules.

Stop wiring dependencies by hand.

Most Python frameworks feel great at the start — then complexity quietly takes over. Lexigram enforces the structure before you need it.

The Problem

Manual wiring creates hidden coupling.

service = UserService(
    PostgresRepo(),
    RedisCache(),
    EmailClient(
        smtp_host="localhost"
    )
) # ❌ Brittle at scale
  • Dependencies spread across codebase
  • Hidden coupling between components
  • Changes in one place break elsewhere

The Lexigram Way

Declare what you need. Container resolves it.

class UserService:
def __init__(
self,
repo: UserRepository,
cache: Cache
): ...

# ✅ Container resolves it
service = await container.resolve(UserService)
  • Contracts never pull in implementations
  • End-to-end type safety
  • Swapping implementations is trivial

Core Concepts

Lexigram is built around a powerful Dependency Injection container. Discover the building blocks.

example.py

Encapsulate registration

class DatabaseProvider(Provider):
    name = "database"
    priority = ProviderPriority.INFRASTRUCTURE

    async def register(self, container: ContainerRegistrarProtocol) -> None:
        container.singleton(DatabaseProtocol, PostgresDatabase)

    async def boot(self, container: BootContainerProtocol) -> None:
        db = await container.resolve(DatabaseProtocol)
        await db.connect()
lexigram-ai-agents

Agents, wired
through DI.

Define agents, register tools, pick a strategy, and let the container resolve session scopes and injectable dependencies automatically.

Base Classes

Define agents with tools and prompts.

Execution Strategies

ReAct, Plan-and-Execute, Supervisor.

@tool Decorator

Register functions as tools easily.

Full DI Integration

Inject vector DBs or services.

Strategy

ReAct Executor

Agent Core

Data Analyst Agent

Injected Tool

Postgres Query Engine

The Lexigram Ecosystem

A rich collection of official extensions. Built on the same contracts, fully compatible out of the box.

lexigram-web

FastAPI integration with DI controllers.

lexigram-ai

LLM providers, embeddings, and agents.

lexigram-sql

SQLAlchemy sessions and UnitOfWork.

lexigram-search

Elasticsearch and vector stores.

lexigram-auth

JWT, OAuth, and RBAC policies.

lexigram-events

Kafka, RabbitMQ, and Redis pub/sub.

Zero to Running.

No massive boilerplates. Start small, scale indefinitely.

$ pip install lexigram lexigram-web
main.py
from lexigram import Application
from lexigram.web import WebProvider

app = Application(name="hello")
app.add_provider(WebProvider())

@app.controller()
class HelloController:
@get("/hello")
async def hello(self) -> dict:
return {"message": "Hello, Lexigram"}

if __name__ == "__main__":
app.run()
Join the Community

Build with
Lexigram

Whether you're migrating a legacy Django monolith or starting a fresh async project, we'd love to hear from you. Sign up for early access, framework updates, or enterprise support.

Email
hello@lexigram.dev
Location
Building globally

We typically respond within 24 hours.