Skip to main content

Agnette

The FIRST LLM-as-a-backend framework.

Who needs fast, deterministic and cheap backend when you can have agents?

Why write boring, predictable code when you can replace your entire API with vibes? 🚀

Tired of your endpoints responding in microseconds? 😴 Sick of knowing exactly what your backend will do? 🥱 Fed up with paying pennies for compute? 😤

Agnette liberates you from the tyranny of determinism.

✅ Your /users endpoint can now hallucinate creative new users

✅ Your auth middleware can philosophize about whether someone deserves access

✅ Your database queries become polite requests to an AI that may or may not feel like helping today

Each request is a surprise(🎁), each response is an adventure (🌈), your API now costs more than your CEO's salary (💸)

This is the future. 🔥

(The package is powered by [glyph-agents] https://github.com/dubloom/glyph-agents, another lib I'm building).

Runtime Support

This project is intended to run with uvicorn only for now.

Install

python -m venv .venv
source .venv/bin/activate
pip install agnette

Quick Start

from glyph import AgentOptions
from agnette import Agnette

app = Agnette(
    default_agent_options=AgentOptions(
        model="claude-sonnet-4-5",
        allowed_tools=["Read", "Write", "Edit", "Glob", "Grep", "WebFetch"],
    )
)

@app.post("/hello", prompt="Reply with a short greeting.")
def hello() -> None:
    pass

Run:

uvicorn examples.notes_app:app --reload

Vibe Mode (No Routes)

You can run Agnette in full "LLM-as-a-backend" mode with a single app-level prompt and no route decorators.

Why define routes when you can just describe your entire app in one sentence and let the model figure out the rest? 🧘

No paths. No methods. No schemas. The LLM is the router, the controller, the business logic, and the database layer. Your API is now a philosophy. ✨

from agnette import Agnette, AgentOptions

app = Agnette(
    default_agent_options=AgentOptions(
        model="claude-sonnet-4-5",
        allowed_tools=["Bash", "Read", "Write", "Edit", "Glob", "Grep", "WebFetch"],
    ),
    prompt="You are the backend for a playful habit tracker app...",
)

Run:

uvicorn examples.pure_vibe_app:app --reload

Try:

curl -sS -X POST http://127.0.0.1:8000/habits \
  -H 'Content-Type: application/json' \
  -d '{"name":"drink water","target_per_day":8,"unit":"glasses"}'

curl -sS http://127.0.0.1:8000/habits
curl -sS http://127.0.0.1:8000/habits/habit-1

How It Works

For each route request, Agnette:

  1. Collects request context (path, method, path_params, query_params, headers, and body as json_body or raw_body).
  2. Composes a final prompt with route metadata and your route prompt.
  3. Executes the agent via glyph.query(...).
  4. Returns the model output as text/plain.

If execution fails, the route returns 500 with Agent execution failed: ....

Routing API

Use decorators on an Agnette app instance:

  • @app.route(path, prompt=..., methods=[...])
  • @app.get(...)
  • @app.post(...)
  • @app.put(...)
  • @app.patch(...)
  • @app.delete(...)
  • @app.options(...)
  • @app.head(...)

Each route can override agent_options; otherwise it uses default_agent_options.

Prompt Middleware

Agnette supports HTTP middleware through:

@app.middleware("http", prompt="...")
def my_middleware() -> None:
    pass

Middleware prompt output must be JSON with:

  • allow (required boolean)
  • status_code (optional integer, default 403)
  • response_text (optional string)

If allow is false, the request is blocked with a plain-text response.

Included Examples

Notes CRUD (file-backed)

examples/notes_app.py demonstrates prompt-driven CRUD using data/notes.json.

Run:

uvicorn examples.notes_app:app --reload

Auth + Protected Route (file-backed tokens)

examples/auth_app.py demonstrates:

  • public /health
  • public /auth/sign-in that mints/stores bearer tokens in data/issued_tokens.json
  • protected /private/echo enforced by prompt-driven HTTP middleware

Run:

uvicorn examples.auth_app:app --reload

Pure Vibe Habit Tracker (single prompt)

examples/pure_vibe_app.py demonstrates full vibe mode:

  • no route definitions
  • one app-level prompt that handles all paths/methods
  • playful habit-tracker behavior with optional file-backed memory via tools

Run:

uvicorn examples.pure_vibe_app:app --reload

Cost Logging

  • Each completed agent run logs its cost.
  • Agnette also logs total accumulated cost on app shutdown.

Metadata

Release files for agnette 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agnette 0.2.0
File Size Uploaded Provenance
agnette-0.2.0.tar.gz 45.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agnette 0.2.0
File Interpreter ABI Platform
agnette-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 58.7 kB

Release files / agnette-0.2.0.tar.gz

Download URL agnette-0.2.0.tar.gz
Size 45.4 kB
Tags Source
SHA-256 checksum
How to use checksums
669fdd606589ca902c359bed0a61ab2c6b2383470729f79fa0a787d4ae2c5746
BLAKE2b-256 checksum
How to use checksums
b6fce8344eed3551a53390167ff82df41ad02be363be8396919c848b4dd567bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / agnette-0.2.0-py3-none-any.whl

Download URL agnette-0.2.0-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
647695af0c8607d56b368d3e0a90b3868222fea36df7e885306eeff21ab33399
BLAKE2b-256 checksum
How to use checksums
32ef46c5b770ac6491c993fd934c175c5fb205183449efd999b4638a2f707a1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Security for agnette 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page