Releasing Flama 2.0 #242
Pinned
migduroli
announced in
Announcements
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We are thrilled to announce Flama 2.0 🎉, the largest release in the history of the framework. This is not an incremental update: Flama 2.0 is a ground-up rethinking of the framework's foundations, performance characteristics, and scope. What started as a framework for productionising machine-learning models with minimal ceremony has grown into a complete platform for building production-ready APIs that span REST endpoints, predictive models, generative AI, and agent-ready tooling, all from a single codebase.
The headline changes: a Rust-powered core that compiles the framework's hot paths into native code, first-class LLM serving with multi-dialect compatibility, native Model Context Protocol (MCP) support for agentic workflows, a streaming-first HTTP stack, and a painless migration path from 1.x via automated codemods. Let's dive into everything that's new.
A Rust-powered core
Performance has always mattered for serving workloads, but in Flama 1.x, the framework's overhead (routing, JSON encoding, request parsing, compression) was pure Python. In 2.0, these hot paths have moved into a compiled Rust crate (
flama-core, exposed as_core), built with PyO3 and maturin:The Rust crate ships as native wheels per Python version (no abi3), so you get the speedups with a simple
pip install, no Rust toolchain required. Safety is enforced at the crate level withunsafe_code = forbid.What this means in practice: lower latency, higher throughput, and less CPU spent on framework overhead, leaving more headroom for your application logic and model inference.
First-class LLM serving
Flama 2.0 turns the framework into a serving layer for generative models. The same one-line philosophy that made predictive model serving trivial now extends to large language models:
Serving dialects
A single model can speak multiple wire protocols simultaneously, so your existing clients work without modification:
/query/,/stream/,/chat//openai/v1/chat/completions,/v1/completions,/v1/responses,/v1/models/anthropic/v1/messages,/v1/models/ollama/api/chat,/api/generate,/api/tagsThis means you can point any OpenAI SDK, Anthropic client, or Ollama-compatible tool at your Flama server and it will work without code changes.
Hardware backends
Flama integrates with two runtime backends, chosen automatically at load time based on what is available in your
environment:
The backend choice is not persisted in the model artifact. The same
.flmfile runs on vLLM in your Linux productioncluster and on MLX on your MacBook during development.
The CLI workflow
The complete workflow, from zero to a production API, is three commands:
Built-in chat interface
Every served model comes with a polished chat interface at
/chat/(part of the native dialect). It renders Markdown,LaTeX math via KaTeX, and Mermaid diagrams, with streaming token delivery over Server-Sent Events. No frontend code, no
build step, no external dependencies.
Transport and decoder
A dedicated transport layer handles three input shapes: raw (verbatim prompt), chat (single-turn with system instruction), and conversation (multi-turn message list). The decoder splits the model's output stream into typed events tagged by channel (
output,thought, tool calls), auto-detecting the right strategy per model.Model Context Protocol (MCP)
Serving a model is one half of the generative AI story; the other half is giving models access to your world. The Model Context Protocol is the open standard for exactly that, and Flama provides native, first-class support.
What Flama's MCP support offers
A quick example
Any MCP-capable client (Claude, Cursor, VS Code Copilot, custom agents) can discover and invoke these capabilities through the standard JSON-RPC interface. No bespoke integration code required.
Streaming-first HTTP
Flama 2.0 reorganises the HTTP layer into a foundational package (
flama.http) with new response types designed for modern, real-time workloads:The middleware layer has been similarly reorganised into its own foundational package (
flama.middleware), making it straightforward to compose request/response transformations.Chatbot template and UI
The built-in chat interface is produced from a proper frontend application, the chatbot template. In 2.0:
The result is a modern, component-based chat UI that ships with the framework and requires zero effort from you.
Developer experience and tooling
Automatic upgrade
Upgrading a major version should not hurt. The
flama upgradecommand rewrites your imports and renamed symbols via automated codemods:Symbols without an automatic replacement are flagged with a
# flama-upgrademarker and listed as manual follow-ups. Minutes, not days.Platform support
requires-python = ">=3.10,<3.15").Breaking changes
Flama 2.0 is a major release with intentional breaking changes:
flama.http.flama.middleware..flmfiles need re-packaging).torch.exportserialisation: Upgraded model export format for PyTorch-based models.Most import and symbol moves are handled automatically by
flama upgrade. See the migration guide for full details.We are incredibly excited about where Flama is headed. This release represents years of work and a fundamental expansion of what the framework can do. Whether you are serving predictive models, generative models, or building agent-ready tooling, Flama 2.0 has you covered.
Happy coding! 🚀
All reactions