lovia¶
A lightweight, elegant, provider-neutral Agent framework for Python. Start with one Agent and typed Tools. Add streaming, persistence, context management, plugins, a Workspace, or a Web UI only when the application needs them.
from lovia import Agent
agent = Agent(
name="assistant",
instructions="Explain complex science with vivid, everyday analogies.",
model="<model>",
)
result = agent.run_sync("Explain why the sky is blue in three sentences.")
print(result.output)
Build your first Agent → Try the Web UI →
Why lovia¶
-
A small, deliberate core
The core needs only an HTTP client and a data-validation library; integrations stay opt-in.
-
A loop you can follow
Model Turns, Tool calls, retries, and failures follow one explicit path. Typed events and the canonical Transcript show exactly what happened.
-
Context without rewritten history
Compaction changes only the next provider view. The complete record stays intact, while stable prompt prefixes keep provider caches useful.
-
One extension model
Skills, MCP, Todo, and Memory use the same Plugin seam available to your own capabilities, instead of growing separate integration systems.
Choose a path¶
| I want to… | Start here | Then add |
|---|---|---|
| Build my first Agent | Quickstart | Agents, Running agents |
| Connect a model or gateway | Quickstart | Providers & models |
| Give the model capabilities | Tools | Built-in tools, Workspace |
| Build a longer-running assistant | Plugins | Skills, Todo, Memory |
| Make Runs production-ready | Provider retries | Budgets, Sessions, Guardrails |
| Add a chat experience | Web UI | Web server, HTTP API |
| Test behavior | Testing | Evals, Observability |
Learn from runnable examples¶
The repository examples form a feature-by-feature learning path. Every script is small enough to copy and modify:
01_hello.py— one Agent, one answer02_tools.py— typed Tool calls03_streaming.py— typed events04_structured_output.py— validated output05_sessions.py— conversation history- Browse all examples
Documentation version
This site follows the current main branch. Compare it with your installed
version using python -c "import lovia; print(lovia.__version__)".
For contributors¶
The architecture notes document the module map, RunLoop, Transcript invariants, Plugins, persistence, and context compaction.
中文文档:docs/zh。