The pricing tool your sales team asked for. Built in an afternoon, with access rules and approvals built in.
Reps price quotes for their own region. Discounts above 15% go to a manager. See the Osy# source, then run the app on your laptop and try both sides of the approval.
Reps price their own region. Big discounts wait for their manager.
On the front page, a sales analyst's pricing tool quietly became infrastructure. This is the same tool, built the governed way. It took a coding agent, about two hundred lines of Osy# and the kits that already exist.
The request"Our reps need to price quotes for their own region. Anything over 15% off needs their manager's yes."
A real screenshot of the sample running locally, signed in as Sam, a Pacific manager. The light and dark versions follow this page's theme.
Everything the app does is in its source, and it reads like what it does.
Each part below is copied from the sample's files, line for line. The highlighted lines are the ones doing the work.
Rules about the data live on the data.
A discount can't pass 40%, a quantity can't be zero, and the total is worked out from the row, never typed in. The form shows the same total live, by the same rule, while the rep is still choosing.
Those hold whatever writes the quote: the screen, an import or an agent. You declare them once and stop checking.
model/quotes/quote.osy
entity Quote { [Required("Who is the quote for?"), MaxLength(120)] string Customer; [Required("Pick a product.")] Product Product; [Min(0)] decimal ListPrice; [Min(1)] int Quantity = 1; [Min(0), Max(40)] decimal Discount = 0; Region Region; [Required("A quote belongs to a rep.")] Principal Rep; QuoteStatus Status; Principal? ApprovedBy; [MaxLength(300)] string? ManagerNote; [Stored] decimal Total => PriceOf(ListPrice, Quantity, Discount);
/// List price times quantity, less the discount, to the cent. The stored total and the form's live total both use it. decimal PriceOf(decimal listPrice, int quantity, decimal discount) => Math.Round(listPrice * quantity * (100 - discount) / 100, 2);
One line reads the data. No endpoint, no fetch.
Each live var runs on the server as the person looking, and updates the moment a quote changes. The second one is every discount waiting for this manager, already typed.
The card, the table and the form are kit controls, dressed in your own theme.
model/quotes/quotes-page.osy
component QuotesPage() { live var quotes = Quote.Include(q => q.Product).OrderByDescending(q => q.Total).Take(200).ToList(); live var waiting = Workflow.Inbox<Quote>().Where(r => r.SlotAlias == "Manager").Include(r => r.Item.Product).ToList(); live var me = SignedInAs();
if (waiting.Count() > 0) { Card("Waiting for your approval") { foreach (var r in waiting) { Row(gap: 3, align: Align.Center) { Text(r.Item.Customer + " · " + r.Item.Product.Name, fontWeight: FontWeight.Semibold); Text(r.Item.Discount + "% off · " + r.Item.Total.ToString("N2"), color: Colors.TextMuted); Spacer(); Button("Decline", onPress: () => Decline(r.Item), tone: Tone.Ghost); Button("Approve", onPress: () => Approve(r.Item), tone: Tone.Primary); } } } }
Say who may see it once. Every query obeys.
Ava sees Pacific and Maria sees Mountain, and no screen filters by hand. The rule is compiled into every read and write, so a report, an export or an agent gets the same answer.
A quote is frozen while a manager decides, and only the approval itself can write down who approved.
model/quotes/quote.osy · model/people/people.osy
security { // Reps and managers see the quotes of the regions they cover. No one sees any other region. allow read, create when IsSales where Covers(Region); // A draft can be changed. Once it is with a manager, it is frozen. allow update when IsSales where Covers(Region) && Status == QuoteStatus.Draft; // Only the approval itself writes down who approved, and why. deny update ApprovedBy, ManagerNote; allow update ApprovedBy, ManagerNote when IsDiscountDesk; }
/// The regions the caller covers. Every rule about quotes is written with it. policy Covers(Region region) => Territory.Any(t => t.Person == user && t.Region == region);
An approval that can wait for days, and never loses its place.
Above 15% off, the quote goes to a manager of its region, never to the rep who wrote it. If nobody answers in two days, it comes back to the rep with a note.
The run survives restarts and deploys. The inbox, the clock and the record of who decided come with the engine.
model/quotes/discount-approval.osy
state Draft { subscribe Submit(); on Submit { when (NeedsManager(this.Item)) { goto WithManager; } default { goto Approved; } } } state WithManager { subscribe Decide(Decision decision, string note) as Manager { Candidates = u => RoleGrant.Any(g => g.Member == u && g.Role == AppRole.Manager) && Territory.Any(t => t.Person == u && t.Region == this.Item.Region) && u != this.Item.Rep; Finished { Within = TimeSpan.FromDays(2); Unfinished { this.Item.ManagerNote = "No manager answered in two days"; goto Draft; } } } on Manager(Decision decision, string note) { this.Item.ManagerNote = note; when (decision == Decision.Decline) { goto Draft; } default { this.Item.ApprovedBy = actor; goto Approved; } } } terminal success Approved { }
The deeper read. How the workflow engine keeps thousands of runs going through a new release, with people, deadlines and agents in the same process.
Read about the workflow engineYour agent writes the app. The compiler keeps it honest.
Use Claude Code, or the coding agent you prefer. It works in one language, asks the toolchain instead of guessing, and builds on kits that are already tested.
You say what the app is for.
One command sets up the project for your agent, with the language's rules and how to check its own work. You describe the request. The agent writes the data, the rules, the screen and the workflow, and the tests that prove them.
osy init --agent claude -d pricing-tool cd pricing-tool && claude
A mistake comes back with its line and its fix.
We broke a copy of the sample on purpose. Here is what osy validate said, in seconds each time.
quotes-page.osy:40:87 ERROR RESOLVE_ERROR UI: entity 'Quote' has no property 'DiscountPercent' … discount-approval.osy:39:50 ERROR RESOLVE_ERROR `goto Rejected`: 'Rejected' is not a declared state in this workflow
The hard parts arrive already done.
The sample writes none of these. It names them in one file, and they come with their own data, screens, security and tests.
- Sign-in and accountsUserAccounts
- RolesIdentity
- Sign-in mailMail · EmailTemplates
- Durable approvalsWorkflow
- Tables, forms, cardsUi
- A trail of every changeObservability
Ava saw her own drafts in the approval inbox. One line fixed it, and a test keeps it fixed.
A compiler catches a wrong field or a missing state. It can't know that a rep's own drafts don't belong under "Waiting for your approval". The first screenshot of this sample showed exactly that: the inbox listed every step Ava could act on, including sending her own quotes.
The fix asks for the manager's step only. Then the test the_screen_shows_her_region_and_hides_the_rest signs in as Ava and checks that the card is gone. Take the fix out and osy check fails on that test.
So a behaviour your team cares about becomes a test, and every later change, yours or your agent's, is checked against it.
live var waiting = Workflow.Inbox<Quote>().Where(r => r.SlotAlias == "Manager").Include(r => r.Item.Product).ToList();[Test(SalesTeam)] [runas(Ava)] void the_screen_shows_her_region_and_hides_the_rest() { Ui.Visit("/"); Assert.Visible("Bluewater Logistics"); Assert.Visible("Cedar Clinics"); Assert.Hidden("Summit Outfitters"); Assert.Hidden("Waiting for your approval"); // her own drafts are hers to send, not to approve}
The checks a careful reviewer makes, run every time your agent checks its work.
Because the whole app is one program, the toolchain can see how the pieces fit. That is what lets an agent build fast without leaving holes for someone else to find.
Access rules on every query and write
A rule is compiled into every read, so no screen, report or agent can forget it. A rule in the wrong place is refused, with the rewrite.
The screen and the data, typed together
A page that names a field the data doesn't have won't compile. Rename a field, and every screen that uses it tells you.
Every workflow step leads somewhere real
A step into a state that doesn't exist is refused. A step that could wait forever, with no deadline, is pointed out before it ships.
Rules your tests have proven
A rule no test has tried to break is flagged until one proves both the no and the yes. The sample proves both.
Unbounded queries are flagged
A screen that reads a whole table with no limit is flagged before it ships, so it stays quick when fifty rows become fifty thousand. It flagged this sample's first draft.
Who can do what, in plain words
osy explain turns the rules into sentences for your security review: who reads, creates and changes each kind of record.
osy check gives one verdict: it validates, runs the lint and runs the app's tests. The sample passes, with 12 tests across access, approval and the screen.
On your laptop in a few minutes. Free, and no account needed.
Submit a quote, then approve it as the manager.
Ava is a rep in the Pacific region and Sam is her manager. You play both, in the real app with a real PostgreSQL database on your own machine.
Each osy launch --as opens the app in your browser already signed in, so there are no passwords to type.
Cedar Clinics asks for 22% off. When Ava sends it, it waits for Sam. When Sam approves, the quote shows Approved.
The first run fetches the database once. After that the app starts in seconds. Setup for Windows, Homebrew and the Claude Code plugin is on osysharp.com/install.
# 1. Install the tools curl -fsSL https://osysharp.com/get.sh | sh # 2. In the sample's folder, load the sales team osy seed "A sales team in two regions" # 3. As Ava, press Send on Cedar Clinics (22% off) osy launch --as [email protected] # 4. As Sam, press Approve under "Waiting for your approval" osy launch --as [email protected]
osy check validates, lints and runs every test, the inbox bug's test included.osy stop shuts down the local platform.Everything else about the language is on osysharp.com.
Run the sample, then build the app your team keeps asking for.
When it is ready for real users, Osyrin runs it inside your organization's policy. See how policy works →
Or write to us at [email protected]. Tell us what you would like to build, or where your current approach gets stuck.

