Give AI a pattern to follow
Agents, LLMs, RAG, Skills — wired together, no glue code.
lexigram-ai is the AI layer of the lexigram framework: a thin coordinator that wires the lexigram-ai family — agents, LLMs, RAG, memory, skills, MCP, session, workers, observability, feedback, guard, governance, evaluation, prompt, relay — into the container through entry-point discovery. one install, one Application.boot, and the whole family is resolvable by contract. every backend is swappable: run it on your own infra or point it at an API.
- wired, not glued. agents, llms, rag, memory — one container, one boot call.
- async, end to end. the container, the modules, the controllers — concurrency-safe by construction.
- contracts everywhere. every package talks through protocols, so swapping an implementation never ripples.
- local-first. defaults point at any OpenAI-compatible server — Ollama, LM Studio, vLLM — hosted providers are a config change away.
→ full docs at docs.lexigram.dev
install
uv add "lexigram[ai,web]" # framework + web + ai + server (what the example below uses)
uv add lexigram-ai # just the coordinator
pip install "lexigram[ai,web]"
60 seconds, end to end
from lexigram import Application
from lexigram.web import Controller, get, WebModule
from lexigram.web.server import run_server
from lexigram.ai.llm import LLMModule, ClientConfig
from lexigram.contracts.ai import LLMClientProtocol, ChatMessage, Role
class ChatController(Controller):
def __init__(self, llm: LLMClientProtocol):
self.llm = llm
@get("/chat")
async def chat(self, q: str) -> dict:
messages = [ChatMessage(role=Role.USER, content=q)]
result = await self.llm.complete(messages)
return {"reply": result.unwrap().content}
app = Application()
app.add_modules(
[
# Local-first. To talk to a hosted provider instead, set
# `provider="openai"` (or "anthropic", "groq", ...) and supply
# the matching API key.
LLMModule.configure(
ClientConfig(
provider="ollama",
model="llama3.2",
api_base="http://localhost:11434",
api_key="ollama",
)
),
WebModule.configure(controllers=[ChatController]),
]
)
run_server(app, port=8000)
→ http://localhost:8000/chat?q=hello
No API key needed if you're pointing at a local model. To talk to a hosted provider instead, set
provider="openai"(or"anthropic","groq", …), dropapi_base, and supply the matching API key — or letLLMModule.configure()read the whole block fromLEX_AI_LLM__*env vars.
what just happened?
Application.bootassembled two modules — an LLM client and a web server — into one container and started them together.LLMModule.configure(...)declared a provider, a model, and an endpoint. No SDK, no per-provider code.ChatControllerresolvedLLMClientProtocolby type from the container. Swap the provider; the controller never changes.
lexigram-ai
├── umbrella entry point · discovers subsystems
├── llm provider-agnostic clients
├── agents tools, react, and beyond
├── rag chunkers, embedders, retrieval pipelines
├── memory working, episodic, semantic stores
├── skills versioned agent capabilities
├── session conversation state and resumption
├── mcp model-context-protocol clients
├── workers background AI jobs
├── observability tracing and metrics
├── feedback quality loops
├── guard input/output safety gates
├── governance policy, audit, budgets
├── evaluation evals and quality gates
├── prompt versioned prompt templates
├── relay protocol conversion engine
└── relay-gateway HTTP gateway for relay
what's in the box
the whole family lives in this repository under experimental/ai/ — experimental tier, API stability is not guaranteed between releases. same container, same contracts, same rules as the stable core.
lexigram-ai— the coordinator (this package)lexigram-ai-llm— provider-agnostic clients for Ollama, OpenAI, Anthropic, Groq, Mistral, and morelexigram-ai-agents— tools, react, and beyondlexigram-ai-rag— chunkers, embedders, retrieval pipelineslexigram-ai-memory— working, episodic, semantic storeslexigram-ai-skills— versioned agent capabilitieslexigram-ai-session— conversation state and resumptionlexigram-ai-mcp— model-context-protocol clientslexigram-ai-workers— background AI jobslexigram-ai-observability— tracing and metricslexigram-ai-feedback— quality loopslexigram-ai-guard— input/output safety gateslexigram-ai-governance— policy, audit, budgetslexigram-ai-evaluation— evals and quality gateslexigram-ai-prompt— versioned prompt templateslexigram-ai-relay— protocol conversion enginelexigram-ai-relay-gateway— HTTP gateway for relay
early on purpose
The AI layer is in 0.1 — which means you can still change it. APIs may shift before 1.0, so pin your versions, and tell us what feels wrong. Shaping a framework is more fun when it's still soft.
pointers
- full docs → docs.lexigram.dev
- the stable core → lexigram
- the AI family → experimental/ai in this repository
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lexigram_ai-0.1.4.tar.gz.
File metadata
- Download URL: lexigram_ai-0.1.4.tar.gz
- Upload date:
- Size: 3.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e7baf635f756b99703dd2b66492a1cf0f2faee69aa138180d2961dcfe1afc25
|
|
| MD5 |
57fb28215f0e16eae50bf97bc2261a1f
|
|
| BLAKE2b-256 |
937f3f3bcce8d69891b603e86c66ddbc034f123d64527e473d2593bb97c0f319
|
File details
Details for the file lexigram_ai-0.1.4-py3-none-any.whl.
File metadata
- Download URL: lexigram_ai-0.1.4-py3-none-any.whl
- Upload date:
- Size: 25.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
693b39cddb2d8158d0de4a20a473907c74817abd4eade5f38d5d2d828e2336c5
|
|
| MD5 |
8d5b44bee994294b7b329df4860c8530
|
|
| BLAKE2b-256 |
90b616414398dc9df87fe06d0b3981ee46df6c847ce70aadf968f800a02c975c
|