Framework adapters for routing LLM requests through Majordomo Gateway
Project description
majordomo-frameworks
Framework adapters for routing LLM requests through Majordomo Gateway with centralized logging and cost tracking.
Installation
# Core package (no framework dependencies)
pip install majordomo-frameworks
# With Agno support
pip install majordomo-frameworks[agno]
# With Pydantic AI support
pip install majordomo-frameworks[pydantic-ai]
Quick Start
Shared utilities (zero dependencies)
from majordomo_frameworks import build_headers, check_environment, Provider
# Check required env vars are set
missing = check_environment("openai")
# Build gateway headers
headers = build_headers(feature="my-feature", step="inference", user_id="alice")
Agno
from majordomo_frameworks.agno import create_model
model = create_model("openai", feature="support-agent", user_id="alice")
Pydantic AI
from majordomo_frameworks.pydantic_ai import create_model, build_extra_headers
from pydantic_ai.settings import AnthropicModelSettings
# Create model routed through the gateway
model = create_model("anthropic")
# Build headers for model settings
headers = build_extra_headers(feature="research-agent", step="synthesis")
# Use with Pydantic AI model settings
settings = AnthropicModelSettings(
extra_headers=headers,
# ... other settings like anthropic_thinking, etc.
)
Supported Providers
| Provider | Agno | Pydantic AI |
|---|---|---|
| OpenAI | OpenAIChat |
OpenAIModel |
| Anthropic | OpenAILike |
AnthropicModel |
| Gemini | OpenAILike |
OpenAIModel |
Environment Variables
| Variable | Required | Description |
|---|---|---|
MAJORDOMO_GATEWAY_URL |
No | Gateway URL (default: http://localhost:7680) |
MAJORDOMO_API_KEY |
Yes | Your Majordomo API key |
OPENAI_API_KEY |
Per provider | OpenAI API key |
ANTHROPIC_API_KEY |
Per provider | Anthropic API key |
GEMINI_API_KEY |
Per provider | Gemini API key |
Documentation
- Pydantic AI Guide - Complete guide with migration instructions, advanced usage, and examples
Examples
- Agno Support Agent - Multi-turn conversations with per-user cost tracking
- Pydantic AI Research Agent - Multi-step research workflow with structured outputs
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
majordomo_frameworks-0.2.0.tar.gz
(343.6 kB
view details)
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 majordomo_frameworks-0.2.0.tar.gz.
File metadata
- Download URL: majordomo_frameworks-0.2.0.tar.gz
- Upload date:
- Size: 343.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb1b2f3442529deeab0afa85849277101df4eb1d3f44d99b6b5dce2a86b7f1b1
|
|
| MD5 |
b89afabccfee8f0b428f602113a2bdc5
|
|
| BLAKE2b-256 |
655c95ce96f755414304083bbd117fbc039268e9575e18484555e80882499736
|
File details
Details for the file majordomo_frameworks-0.2.0-py3-none-any.whl.
File metadata
- Download URL: majordomo_frameworks-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aed7baba1d50ede7c6f7ac95f1e6d4b804a0ecb06033a309e4dab6022b0a4e21
|
|
| MD5 |
1c94857433de3cc91593c38108ef3198
|
|
| BLAKE2b-256 |
42c746fa11e821c4483cc4afce4c0f4366c1f9475691c2bd5c364ea2dcc97951
|