# tilolang > tilolang is a typed language for apps and extensions that people and AI agents write and use together. A package describes its data (types), the only ways that data changes (actions) and how it is shown (views). The compiler turns it into a small WebAssembly module that runs sandboxed, syncs between devices as CRDTs (every change keeps its author, history and undo), and renders as native UI on Linux, macOS, Windows, Android and the web. Use it when an agent should answer a person with live UI instead of text, when users or their agents should be able to write apps or extensions for your product without being trusted, or to write a collaborative app. ## Install ```sh curl -fsSL https://tilolang.dev/install | sh ``` This installs the `tilolang` command. ## Write a package A package is a directory of `.tl` files; exactly one starts with the app header (`app ""`). Every declaration may use any other, in any file. The compiler writes `app.ids` (stable ids for every declaration); keep it with the sources. - `type` declares a resource and its fields. Fields merge as CRDTs (`merge counter`, text, lists). - `action` is the only way state changes. People (buttons), agents and scripts call the same actions, under the same permissions. - `view` renders a resource with the shared components (`std.page`, `section`, `row`, `button(action(...))`, `ui.Text`). Apps never draw their own tabs, search fields or window chrome: the system provides those. - `scenario` stages sample data, for tests, previews and the browser. - A package that talks to hosts outside declares them in its header: `(web: ["example.com"])`. Anything else is refused. The whole Counter app (tilo's apps/tl/counter/app.tl): ```tl app so.tilo.lang.counter "Counter" (icon: .hash, category: .utility) /// A counter that several people can bump at once. type Counter { /// The current value. value: Int merge counter } root Counter default view counter for Counter /// Add one to the counter. primary action increment(c: Counter) (icon: .plus) { c.value += 1 } /// Take one away from the counter. action decrement(c: Counter) (icon: .minus) { c.value -= 1 } /// The counter's window: the value, and the two buttons that change it. view counter(c: Counter) { std.page(c) { section("Count") { ui.Text("{c.value}", role: .title, numeric: true) } controls(c) } } view controls(c: Counter) { row(gap: .related) { button(decrement(c)) as minus button(increment(c)) as plus } } /// A counter of visitors after a busy morning. scenario "a busy morning" { let c = root Counter c.value += 42 } ``` ## Verify ```sh tilolang check path/to/package # every error, as path:line:col: E0xx message; exit 0 when clean tilolang check path/to/package --json tilolang fmt path/to/package # the one canonical formatting tilolang build path/to/package # a signed .tapp per package ``` Run `tilolang check` after every edit and fix what it reports before going on. Read the error codes: each names the rule it enforces. More examples: every app in https://tilolang.dev/apps/ is a real package from tilo's apps/tl, with its source, running in the browser. ## Docs ### Language - [Guide and reference](https://tilolang.dev/docs/): A tilolang package from its first type to its views, actions, effects and tests, and the full syntax reference. - [How tilolang works](https://tilolang.dev/docs/how-it-works/): Types, actions, views, effects and triggers: how a package becomes a collaborative, sandboxed app. - [The development loop](https://tilolang.dev/docs/develop/): Save a file and see the running app change in about 50 ms, with its state kept. ### Views - [Components](https://tilolang.dev/docs/components/): The shared components a view is built from, and how an app composes its own. - [Layout](https://tilolang.dev/docs/layout/): How views size and place their parts on any screen. - [Translations](https://tilolang.dev/docs/i18n/): Every string a view shows, translated through Fluent files the package ships. - [Tilo UI guidelines](https://tilolang.dev/docs/interface-guidelines/): Layout, navigation, text, chrome, system integration and the shared controls every app builds on. ### Agents - [Agents in apps](https://tilolang.dev/docs/agents/): Agents read and change an app's resources through the same actions people use. - [Script a workspace](https://tilolang.dev/docs/workspace-sdk/): Drive any workspace from Python, TypeScript, the command line or tilolang. ### Rust - [Rust apps (tilo-app)](https://tilolang.dev/docs/rust-apps/): Build an app in Rust with the tilo-app SDK: model it as resources and actions, test it, run it everywhere and publish it. ### Runtime - [Engines](https://tilolang.dev/docs/engines/): How compiled packages run: the tiered engine, wasmi, Cranelift and Winch. - [Publishing](https://tilolang.dev/docs/publishing/): Iterating in a chat, publishing to a workspace or to everyone, and using an app without installing it.