The open full-stack Python framework for AI apps
Just. Write. Python.
Yera is designed to be familiar, clear and expressive. A warm soothing bath for your weary dev's brain.
Low abstraction
Yera is a natural extension of what you already know. Build up sophisticated app logic from if, for, with and other familiar Python primitives, plus new ones from Yera.
import yera as yr
One import is all you need. Get right to the functions for invoking LLMs, orchestrating UI elements, and decorators for turning code into apps and tools. Your configured models and connected MCP tools are there too, under yr.llm and yr.mcp.
Easy integration
Call your Python code from your Yera app, and call your Yera apps from your Python code. Apps are just functions: run as a script, in Jupyter or serve it in your browser via yera run.
Explore a real example.
Here's a real app for exploring the iris dataset. Step through the session to see it in the chat UI, and hover over the underlined code to see what each part does.
import sqlite3
import pandas as pd
import yera as yr
from sklearn.datasets import load_iris
class Scatter(yr.Struct):
x: str
y: str
c: str | None
title: str
@yr.tool
def query(sql: str) -> pd.DataFrame:
data = load_iris(as_frame=True)
iris = data.frame
iris["species"] = data.target_names[data.target]
with sqlite3.connect(":memory:") as db:
iris.to_sql("iris", db, index=False)
return pd.read_sql(sql, db)
SCHEMA = """Table "iris", one row per flower:
- "sepal length (cm)", "sepal width (cm)"
- "petal length (cm)", "petal width (cm)"
- species: setosa, versicolor or virginica
- SQLite: no CORR, STDEV or MEDIAN functions"""
@yr.app(name="Fisher's Irises", sys_prompt=SCHEMA)
def ask_your_data() -> None:
for i, message in enumerate(yr.chat()):
if i == 0:
yr.session_title(message)
yr.insert(message)
df = query.invoke("Write one SQLite SELECT.")
yr.table(df.round(3))
yr.gen(instruction="Reply in a short sentence.")
numeric = list(df.select_dtypes("number"))
if len(numeric) > 1 and yr.confirm("Plot it?"):
scatter = Scatter.fill()
ax = df.plot.scatter(**scatter.model_dump())
ax.figure.show()
- System prompt›
Table "iris", one row per flower:
- "sepal length (cm)", "sepal width (cm)"
- "petal length (cm)", "petal width (cm)"
- species: setosa, versicolor or virginica
- SQLite: no CORR, STDEV or MEDIAN functions
How do petal length and width correlate for each species?
- queryworking›queryFilling query1.5s›Sql
SELECT species, (COUNT() * SUM(1.0 * "petal length (cm)" * "petal width (cm)") - SUM(1.0 * "petal length (cm)") * SUM(1.0 * "petal width (cm)")) / (SQRT(COUNT() * SUM(1.0 * "petal length (cm)" * "petal length (cm)") - SUM(1.0 * "petal length (cm)") * SUM(1.0 * "petal length (cm)")) * SQRT(COUNT(*) * SUM(1.0 * "petal width (cm)" * "petal width (cm)") - SUM(1.0 * "petal width (cm)") * SUM(1.0 * "petal width (cm)"))) AS correlation FROM iris GROUP BY species;
{ "sql": "SELECT species, (COUNT(*) * SUM(1.0 * \"petal length (cm)\" * \"petal width (cm)\") - SUM(1.0 * \"petal length (cm)\") * SUM(1.0 * \"petal width (cm)\")) / (SQRT(COUNT(*) * SUM(1.0 * \"petal length (cm)\" * \"petal length (cm)\") - SUM(1.0 * \"petal length (cm)\") * SUM(1.0 * \"petal length (cm)\")) * SQRT(COUNT(*) * SUM(1.0 * \"petal width (cm)\" * \"petal width (cm)\") - SUM(1.0 * \"petal width (cm)\") * SUM(1.0 * \"petal width (cm)\"))) AS correlation FROM iris GROUP BY species;" }query call complete0.0sResult›ResultSpeciesCorrelationsetosa0.3316300408versicolor0.7866680885virginica0.3221082159{ "__yera__": "DataFrame", "table": "{\"schema\":{\"fields\":[{\"name\":\"index\",\"type\":\"integer\"},{\"name\":\"species\",\"type\":\"string\",\"extDtype\":\"str\"},{\"name\":\"correlation\",\"type\":\"number\"}],\"primaryKey\":[\"index\"],\"pandas_version\":\"1.4.0\"},\"data\":[{\"index\":0,\"species\":\"setosa\",\"correlation\":0.3316300408},{\"index\":1,\"species\":\"versicolor\",\"correlation\":0.7866680885},{\"index\":2,\"species\":\"virginica\",\"correlation\":0.3221082159}]}" } species correlation setosa 0.332 versicolor 0.787 virginica 0.322 Petal length and width correlate most strongly for versicolor (r ≈ 0.79), compared with setosa (0.33) and virginica (0.32).
Show me every flower's petal length and width, by species.
- queryworking›queryFilling query0.3s›Sql
SELECT species, "petal length (cm)" AS petal_length_cm, "petal width (cm)" AS petal_width_cm FROM iris ORDER BY species, "petal length (cm)", "petal width (cm)";
{ "sql": "SELECT species, \"petal length (cm)\" AS petal_length_cm, \"petal width (cm)\" AS petal_width_cm FROM iris ORDER BY species, \"petal length (cm)\", \"petal width (cm)\";" }query call complete0.0sResult›ResultSpeciesPetal length cmPetal width cmsetosa10.2setosa1.10.1setosa1.20.2setosa1.20.2setosa1.30.2140 rows omittedvirginica6.42virginica6.62.1virginica6.72virginica6.72.2virginica6.92.3{ "__yera__": "DataFrame", "table": "{\"schema\":{\"fields\":[{\"name\":\"index\",\"type\":\"integer\"},{\"name\":\"species\",\"type\":\"string\",\"extDtype\":\"str\"},{\"name\":\"petal_length_cm\",\"type\":\"number\"},{\"name\":\"petal_width_cm\",\"type\":\"number\"}],\"primaryKey\":[\"index\"],\"pandas_version\":\"1.4.0\"},\"data\":[{\"index\":0,\"species\":\"setosa\",\"petal_length_cm\":1.0,\"petal_width_cm\":0.2},{\"index\":1,\"species\":\"setosa\",\"petal_length_cm\":1.1,\"petal_width_cm\":0.1},{\"index\":2,\"species\":\"setosa\",\"petal_length_cm\":1.2,\"petal_width_cm\":0.2},{\"index\":3,\"species\":\"setosa\",\"petal_length_cm\":1.2,\"petal_width_cm\":0.2},{\"index\":4,\"species\":\"setosa\",\"petal_length_cm\":1.3,\"petal_width_cm\":0.2},{\"index\":5,\"species\":\"setosa\",\"petal_length_cm\":1.3,\"petal_width_cm\":0.2},{\"index\":6,\"species\":\"setosa\",\"petal_length_cm\":1.3,\"petal_width_cm\":0.2},{\"index\":7,\"species\":\"setosa\",\"petal_length_cm\":1.3,\"petal_width_cm\":0.2},{\"index\":8,\"species\":\"setosa\",\"petal_length_cm\":1.3,\"petal_width_cm\":0.3},{\"index\":9,\"species\":\"setosa\",\"petal_length_cm\":1.3,\"petal_width_cm\":0.3},{\"index\":10,\"species\":\"setosa\",\"petal_length_cm\":1.3,\"petal_width_cm\":0.4},{\"index\":11,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.1},{\"index\":12,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.1},{\"index\":13,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.2},{\"index\":14,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.2},{\"index\":15,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.2},{\"index\":16,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.2},{\"index\":17,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.2},{\"index\":18,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.2},{\"index\":19,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.2},{\"index\":20,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.2},{\"index\":21,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.3},{\"index\":22,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.3},{\"index\":23,\"species\":\"setosa\",\"petal_length_cm\":1.4,\"petal_width_cm\":0.3},{\"index\":24,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.1},{\"index\":25,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.1},{\"index\":26,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.2},{\"index\":27,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.2},{\"index\":28,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.2},{\"index\":29,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.2},{\"index\":30,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.2},{\"index\":31,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.2},{\"index\":32,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.2},{\"index\":33,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.3},{\"index\":34,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.4},{\"index\":35,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.4},{\"index\":36,\"species\":\"setosa\",\"petal_length_cm\":1.5,\"petal_width_cm\":0.4},{\"index\":37,\"species\":\"setosa\",\"petal_length_cm\":1.6,\"petal_width_cm\":0.2},{\"index\":38,\"species\":\"setosa\",\"petal_length_cm\":1.6,\"petal_width_cm\":0.2},{\"index\":39,\"species\":\"setosa\",\"petal_length_cm\":1.6,\"petal_width_cm\":0.2},{\"index\":40,\"species\":\"setosa\",\"petal_length_cm\":1.6,\"petal_width_cm\":0.2},{\"index\":41,\"species\":\"setosa\",\"petal_length_cm\":1.6,\"petal_width_cm\":0.2},{\"index\":42,\"species\":\"setosa\",\"petal_length_cm\":1.6,\"petal_width_cm\":0.4},{\"index\":43,\"species\":\"setosa\",\"petal_length_cm\":1.6,\"petal_width_cm\":0.6},{\"index\":44,\"species\":\"setosa\",\"petal_length_cm\":1.7,\"petal_width_cm\":0.2},{\"index\":45,\"species\":\"setosa\",\"petal_length_cm\":1.7,\"petal_width_cm\":0.3},{\"index\":46,\"species\":\"setosa\",\"petal_length_cm\":1.7,\"petal_width_cm\":0.4},{\"index\":47,\"species\":\"setosa\",\"petal_length_cm\":1.7,\"petal_width_cm\":0.5},{\"index\":48,\"species\":\"setosa\",\"petal_length_cm\":1.9,\"petal_width_cm\":0.2},{\"index\":49,\"species\":\"setosa\",\"petal_length_cm\":1.9,\"petal_width_cm\":0.4},{\"index\":50,\"species\":\"versicolor\",\"petal_length_cm\":3.0,\"petal_width_cm\":1.1},{\"index\":51,\"species\":\"versicolor\",\"petal_length_cm\":3.3,\"petal_width_cm\":1.0},{\"index\":52,\"species\":\"versicolor\",\"petal_length_cm\":3.3,\"petal_width_cm\":1.0},{\"index\":53,\"species\":\"versicolor\",\"petal_length_cm\":3.5,\"petal_width_cm\":1.0},{\"index\":54,\"species\":\"versicolor\",\"petal_length_cm\":3.5,\"petal_width_cm\":1.0},{\"index\":55,\"species\":\"versicolor\",\"petal_length_cm\":3.6,\"petal_width_cm\":1.3},{\"index\":56,\"species\":\"versicolor\",\"petal_length_cm\":3.7,\"petal_width_cm\":1.0},{\"index\":57,\"species\":\"versicolor\",\"petal_length_cm\":3.8,\"petal_width_cm\":1.1},{\"index\":58,\"species\":\"versicolor\",\"petal_length_cm\":3.9,\"petal_width_cm\":1.1},{\"index\":59,\"species\":\"versicolor\",\"petal_length_cm\":3.9,\"petal_width_cm\":1.2},{\"index\":60,\"species\":\"versicolor\",\"petal_length_cm\":3.9,\"petal_width_cm\":1.4},{\"index\":61,\"species\":\"versicolor\",\"petal_length_cm\":4.0,\"petal_width_cm\":1.0},{\"index\":62,\"species\":\"versicolor\",\"petal_length_cm\":4.0,\"petal_width_cm\":1.2},{\"index\":63,\"species\":\"versicolor\",\"petal_length_cm\":4.0,\"petal_width_cm\":1.3},{\"index\":64,\"species\":\"versicolor\",\"petal_length_cm\":4.0,\"petal_width_cm\":1.3},{\"index\":65,\"species\":\"versicolor\",\"petal_length_cm\":4.0,\"petal_width_cm\":1.3},{\"index\":66,\"species\":\"versicolor\",\"petal_length_cm\":4.1,\"petal_width_cm\":1.0},{\"index\":67,\"species\":\"versicolor\",\"petal_length_cm\":4.1,\"petal_width_cm\":1.3},{\"index\":68,\"species\":\"versicolor\",\"petal_length_cm\":4.1,\"petal_width_cm\":1.3},{\"index\":69,\"species\":\"versicolor\",\"petal_length_cm\":4.2,\"petal_width_cm\":1.2},{\"index\":70,\"species\":\"versicolor\",\"petal_length_cm\":4.2,\"petal_width_cm\":1.3},{\"index\":71,\"species\":\"versicolor\",\"petal_length_cm\":4.2,\"petal_width_cm\":1.3},{\"index\":72,\"species\":\"versicolor\",\"petal_length_cm\":4.2,\"petal_width_cm\":1.5},{\"index\":73,\"species\":\"versicolor\",\"petal_length_cm\":4.3,\"petal_width_cm\":1.3},{\"index\":74,\"species\":\"versicolor\",\"petal_length_cm\":4.3,\"petal_width_cm\":1.3},{\"index\":75,\"species\":\"versicolor\",\"petal_length_cm\":4.4,\"petal_width_cm\":1.2},{\"index\":76,\"species\":\"versicolor\",\"petal_length_cm\":4.4,\"petal_width_cm\":1.3},{\"index\":77,\"species\":\"versicolor\",\"petal_length_cm\":4.4,\"petal_width_cm\":1.4},{\"index\":78,\"species\":\"versicolor\",\"petal_length_cm\":4.4,\"petal_width_cm\":1.4},{\"index\":79,\"species\":\"versicolor\",\"petal_length_cm\":4.5,\"petal_width_cm\":1.3},{\"index\":80,\"species\":\"versicolor\",\"petal_length_cm\":4.5,\"petal_width_cm\":1.5},{\"index\":81,\"species\":\"versicolor\",\"petal_length_cm\":4.5,\"petal_width_cm\":1.5},{\"index\":82,\"species\":\"versicolor\",\"petal_length_cm\":4.5,\"petal_width_cm\":1.5},{\"index\":83,\"species\":\"versicolor\",\"petal_length_cm\":4.5,\"petal_width_cm\":1.5},{\"index\":84,\"species\":\"versicolor\",\"petal_length_cm\":4.5,\"petal_width_cm\":1.5},{\"index\":85,\"species\":\"versicolor\",\"petal_length_cm\":4.5,\"petal_width_cm\":1.6},{\"index\":86,\"species\":\"versicolor\",\"petal_length_cm\":4.6,\"petal_width_cm\":1.3},{\"index\":87,\"species\":\"versicolor\",\"petal_length_cm\":4.6,\"petal_width_cm\":1.4},{\"index\":88,\"species\":\"versicolor\",\"petal_length_cm\":4.6,\"petal_width_cm\":1.5},{\"index\":89,\"species\":\"versicolor\",\"petal_length_cm\":4.7,\"petal_width_cm\":1.2},{\"index\":90,\"species\":\"versicolor\",\"petal_length_cm\":4.7,\"petal_width_cm\":1.4},{\"index\":91,\"species\":\"versicolor\",\"petal_length_cm\":4.7,\"petal_width_cm\":1.4},{\"index\":92,\"species\":\"versicolor\",\"petal_length_cm\":4.7,\"petal_width_cm\":1.5},{\"index\":93,\"species\":\"versicolor\",\"petal_length_cm\":4.7,\"petal_width_cm\":1.6},{\"index\":94,\"species\":\"versicolor\",\"petal_length_cm\":4.8,\"petal_width_cm\":1.4},{\"index\":95,\"species\":\"versicolor\",\"petal_length_cm\":4.8,\"petal_width_cm\":1.8},{\"index\":96,\"species\":\"versicolor\",\"petal_length_cm\":4.9,\"petal_width_cm\":1.5},{\"index\":97,\"species\":\"versicolor\",\"petal_length_cm\":4.9,\"petal_width_cm\":1.5},{\"index\":98,\"species\":\"versicolor\",\"petal_length_cm\":5.0,\"petal_width_cm\":1.7},{\"index\":99,\"species\":\"versicolor\",\"petal_length_cm\":5.1,\"petal_width_cm\":1.6},{\"index\":100,\"species\":\"virginica\",\"petal_length_cm\":4.5,\"petal_width_cm\":1.7},{\"index\":101,\"species\":\"virginica\",\"petal_length_cm\":4.8,\"petal_width_cm\":1.8},{\"index\":102,\"species\":\"virginica\",\"petal_length_cm\":4.8,\"petal_width_cm\":1.8},{\"index\":103,\"species\":\"virginica\",\"petal_length_cm\":4.9,\"petal_width_cm\":1.8},{\"index\":104,\"species\":\"virginica\",\"petal_length_cm\":4.9,\"petal_width_cm\":1.8},{\"index\":105,\"species\":\"virginica\",\"petal_length_cm\":4.9,\"petal_width_cm\":2.0},{\"index\":106,\"species\":\"virginica\",\"petal_length_cm\":5.0,\"petal_width_cm\":1.5},{\"index\":107,\"species\":\"virginica\",\"petal_length_cm\":5.0,\"petal_width_cm\":1.9},{\"index\":108,\"species\":\"virginica\",\"petal_length_cm\":5.0,\"petal_width_cm\":2.0},{\"index\":109,\"species\":\"virginica\",\"petal_length_cm\":5.1,\"petal_width_cm\":1.5},{\"index\":110,\"species\":\"virginica\",\"petal_length_cm\":5.1,\"petal_width_cm\":1.8},{\"index\":111,\"species\":\"virginica\",\"petal_length_cm\":5.1,\"petal_width_cm\":1.9},{\"index\":112,\"species\":\"virginica\",\"petal_length_cm\":5.1,\"petal_width_cm\":1.9},{\"index\":113,\"species\":\"virginica\",\"petal_length_cm\":5.1,\"petal_width_cm\":2.0},{\"index\":114,\"species\":\"virginica\",\"petal_length_cm\":5.1,\"petal_width_cm\":2.3},{\"index\":115,\"species\":\"virginica\",\"petal_length_cm\":5.1,\"petal_width_cm\":2.4},{\"index\":116,\"species\":\"virginica\",\"petal_length_cm\":5.2,\"petal_width_cm\":2.0},{\"index\":117,\"species\":\"virginica\",\"petal_length_cm\":5.2,\"petal_width_cm\":2.3},{\"index\":118,\"species\":\"virginica\",\"petal_length_cm\":5.3,\"petal_width_cm\":1.9},{\"index\":119,\"species\":\"virginica\",\"petal_length_cm\":5.3,\"petal_width_cm\":2.3},{\"index\":120,\"species\":\"virginica\",\"petal_length_cm\":5.4,\"petal_width_cm\":2.1},{\"index\":121,\"species\":\"virginica\",\"petal_length_cm\":5.4,\"petal_width_cm\":2.3},{\"index\":122,\"species\":\"virginica\",\"petal_length_cm\":5.5,\"petal_width_cm\":1.8},{\"index\":123,\"species\":\"virginica\",\"petal_length_cm\":5.5,\"petal_width_cm\":1.8},{\"index\":124,\"species\":\"virginica\",\"petal_length_cm\":5.5,\"petal_width_cm\":2.1},{\"index\":125,\"species\":\"virginica\",\"petal_length_cm\":5.6,\"petal_width_cm\":1.4},{\"index\":126,\"species\":\"virginica\",\"petal_length_cm\":5.6,\"petal_width_cm\":1.8},{\"index\":127,\"species\":\"virginica\",\"petal_length_cm\":5.6,\"petal_width_cm\":2.1},{\"index\":128,\"species\":\"virginica\",\"petal_length_cm\":5.6,\"petal_width_cm\":2.2},{\"index\":129,\"species\":\"virginica\",\"petal_length_cm\":5.6,\"petal_width_cm\":2.4},{\"index\":130,\"species\":\"virginica\",\"petal_length_cm\":5.6,\"petal_width_cm\":2.4},{\"index\":131,\"species\":\"virginica\",\"petal_length_cm\":5.7,\"petal_width_cm\":2.1},{\"index\":132,\"species\":\"virginica\",\"petal_length_cm\":5.7,\"petal_width_cm\":2.3},{\"index\":133,\"species\":\"virginica\",\"petal_length_cm\":5.7,\"petal_width_cm\":2.5},{\"index\":134,\"species\":\"virginica\",\"petal_length_cm\":5.8,\"petal_width_cm\":1.6},{\"index\":135,\"species\":\"virginica\",\"petal_length_cm\":5.8,\"petal_width_cm\":1.8},{\"index\":136,\"species\":\"virginica\",\"petal_length_cm\":5.8,\"petal_width_cm\":2.2},{\"index\":137,\"species\":\"virginica\",\"petal_length_cm\":5.9,\"petal_width_cm\":2.1},{\"index\":138,\"species\":\"virginica\",\"petal_length_cm\":5.9,\"petal_width_cm\":2.3},{\"index\":139,\"species\":\"virginica\",\"petal_length_cm\":6.0,\"petal_width_cm\":1.8},{\"index\":140,\"species\":\"virginica\",\"petal_length_cm\":6.0,\"petal_width_cm\":2.5},{\"index\":141,\"species\":\"virginica\",\"petal_length_cm\":6.1,\"petal_width_cm\":1.9},{\"index\":142,\"species\":\"virginica\",\"petal_length_cm\":6.1,\"petal_width_cm\":2.3},{\"index\":143,\"species\":\"virginica\",\"petal_length_cm\":6.1,\"petal_width_cm\":2.5},{\"index\":144,\"species\":\"virginica\",\"petal_length_cm\":6.3,\"petal_width_cm\":1.8},{\"index\":145,\"species\":\"virginica\",\"petal_length_cm\":6.4,\"petal_width_cm\":2.0},{\"index\":146,\"species\":\"virginica\",\"petal_length_cm\":6.6,\"petal_width_cm\":2.1},{\"index\":147,\"species\":\"virginica\",\"petal_length_cm\":6.7,\"petal_width_cm\":2.0},{\"index\":148,\"species\":\"virginica\",\"petal_length_cm\":6.7,\"petal_width_cm\":2.2},{\"index\":149,\"species\":\"virginica\",\"petal_length_cm\":6.9,\"petal_width_cm\":2.3}]}" } species petal_length_cm petal_width_cm setosa 1.0 0.2 setosa 1.1 0.1 setosa 1.2 0.2 setosa 1.2 0.2 setosa 1.3 0.2 ⋮ virginica 6.4 2.0 virginica 6.6 2.1 virginica 6.7 2.0 virginica 6.7 2.2 virginica 6.9 2.3 140 rows omittedThe table above lists all 150 flowers’ petal lengths and widths, grouped by species.
- scatterFilling scatter0.2s›Xpetal_length_cm▍Ypetal_width_cm▍Cspecies▍TitlePetal length vs. width by species▍{ "x": "petal_length_cm", "y": "petal_width_cm", "c": "species", "title": "Petal length vs. width by species" }

Plot it?
This code was run with Yera 0.5.0 and GPT-6 Luna, and the session recorded to make the click-through example.
Chop-chop.
Get going in two commands. Install from PyPI and onboard yourself with our easy guided setup. Import your available providers, models and MCPs.
pip install yera
yera hello
The basics.
01Decorate
@yr.appturns a function into a Yera app. They behave just like Python functions: they are called with(), take args, and return values. Build multi-agent systems by simply nesting calls.- Each app defines a context that contains the models you can call on. Use your defaults or override it with
@yr.app(llm=...). @yr.toolturns functions into tools your apps can use. Your LLM fills in the arguments, and the call appears in the UI folded away, with its inputs and result one click from view.
@yr.app(name="Fisher's Irises", sys_prompt=SCHEMA)
def ask_your_data() -> None:
...
@yr.app
def agent_1():
agent_2()
@yr.tool
def query(sql: str) -> pd.DataFrame:
...
02Model Contexts
- There's always an active model context: it decides which model handles calls like
yr.genandyr.response. If you don't choose one, your configured default is used. - Your configured LLMs live under
yr.llm. Pass one to@yr.app(llm=...)for the whole app, or open it as awithblock for part of it. - Contexts stack: entering a
withblock switches models, and leaving it switches back.
The same pattern will cover other kinds of model too: speech-to-text, text-to-speech and more, each its own context.
@yr.app
def demo():
yr.response("What's the capital of France?")
@yr.app(llm=yr.llm.model1())
def demo():
yr.response("prompt 1") # goes to model1
with yr.llm.model2():
yr.response("prompt 2") # goes to model2
yr.response("prompt 3") # goes to model1
03Struct Data
- Define your data shape as a class with
yr.Struct. fill()has the active model fill in a new instance from the current context, typed and validated.invoke()does the same for tools: it builds the inputs from the function's signature, has the model fill them, and calls it.
class Scatter(yr.Struct):
x: str
y: str
scatter = Scatter.fill()
@yr.tool
def adder(x: int, y: int) -> int:
return x + y
# context: "Add five and four."
total = adder.invoke() # 9
04Control Flow
- Standard Python control flow, with a few model-powered functions from Yera so you can branch on natural language conditions.
yr.selectuses the active model to choose from a collection of options.yr.conditionhas the active model judge a plain-language statement, returningTrueorFalse.
match yr.select("billing", "tech", "sales"):
case "billing":
refund.invoke()
case "tech":
diagnose.invoke()
case "sales":
yr.gen()
if yr.condition("The user is asking about the weather."):
forecast.invoke()
else:
yr.gen()
05Rich UI
- Display Markdown, images, Mermaid diagrams, Matplotlib charts and more.
- Use beautiful input widgets: buttons, date pickers, sliders and more.
- Finally, build complex input forms with many widgets using structs. Just define your class and call
.form().
yr.markdown("## Petal length vs width\nOne point per flower:")
df.plot.scatter(x="petal length (cm)", y="petal width (cm)")
plt.show() # shown in the chat UI
choice = yr.buttons(["Approve", "Reject"], label="Ship it?")
go_live = yr.date_picker("Go-live date")
replicas = yr.slider(1, 10, "Replicas")
class Deploy(yr.Struct):
service: str
region: Literal["us-east-1", "eu-west-1"]
go_live: date | None
autoscale: bool = False
config = Deploy.form("Deploy which service?")
See what your app did.
Every Yera browser session includes an activity trace showing what ran, how operations were nested, and where time or failures occurred. It records safe operational metadata and remains with the local session.
Follow the execution
See app, model, tool and user-input activity as a nested timeline, with the relationships between each operation kept intact.
Find failures quickly
Inspect status, timing and safe error classifications without digging through console output or exposing the contents of the session.
Built for accountability
Structured session records provide useful visibility today and a foundation for the audit and policy controls still to come.
Session active
-
RuntimeSessionCompleted 18.42 s▸ Details-
RuntimeRuntimeCompleted 18.40 s-
AppApp invocationCompleted 18.36 s▸ Details-
UserUser inputCompleted 9.37 s-
ModelModel requestCompleted 3.18 s▸ Details-
ToolTool callCompleted 948 ms▸ Details
-
-
-
-
-
Yera Labs, Yera, and Open Core
Yera Labs' mission is to build the AI stack that is safe, reliable and open. To build applications that put people and their needs at the centre, and help others do the same.
- Open Core Yera is at the core of what we are building. It will remain free and open source under Apache 2.0 forever.
- Sustainable Business We're a for-profit company with an open-core business plan. We earn from paid extensions and hosting for teams or enterprise. The boundary between open and commercial code will be clear and fixed.
- No Surprises We will plan and build in the open, with a public roadmap and policy handbook. We are dedicated to clear and open communication.
- People First We are human centred in all designs, decisions and policy. We want all our stakeholders and our community to flourish.
Just getting started.
We will expand what Yera and your apps can do, how people can use them, and how they can be governed as a service.