The app decorator

In this tutorial you'll build your first Yera app. You'll learn about the @yr.app decorator and the yr.response function.

The app decorator

The app decorator turns a python function into a Yera app. All Yera API functions must be used within a function that has been decorated with yr.app.

You can use it without parameters like this

import yera as yr

@yr.app
def nothing():
    pass

Or give it inputs like so

import yera as yr

@yr.app(name="Does Nothing")
def nothing():
    pass

this is how you can set metadata, change the model it uses, set a system prompt etc. We will come back to this in later tutorials, but for now we'll keep it simple and just use the bare yr.app.

Your first app

Now let's build your first app. We're going to build something that tells us what the capital of France is. Before that, let's introduce a function: yr.response. This function invokes the active LLM with the prompt it receives as input.

response_text = yr.response(prompt)

Let's build the app. You're going to import yera, write a function that invokes yr.response and then decorate the lot with yr.app

import yera as yr

@yr.app
def capital():
    yr.response("What is the capital of France?")

Running it

If you're in Jupyter, just invoke it

capital()

if you're running a python script it'll need to be inside a main guard

if __name__ == "__main__":
  capital()

or you can save it to capital.py and just run it via the command line

yera run capital.py

You should see something like this

╭────────────────────────────── Startup ──────────────────────────────╮
│ Started: 2026-06-23 11:54:52                                        │
│ Top-level App: capital                                              │
╰─────────────────────────────────────────────────────────────────────╯

╭────────────────────────────── capital ──────────────────────────────╮
│ Identifier:  __main__.capital                                       │
╰─────────────────────────────────────────────────────────────────────╯

{
  "content": "What is the capital of France?"
}

The capital of France is **Paris**.

╭─────────────────────────────── Exit ────────────────────────────────╮
│ Completed successfully                                              │
│                                                                     │
│ Exit code:    0                                                     │
│ Reason:       Yera program completed successfully.                  │
│ Return value: None                                                  │
│                                                                     │
│ Run time: 1.60 s                                                    │
╰─────────────────────────────────────────────────────────────────────╯

Next

pass