Economics
Most AI frameworks have no concept of economic exchange. You build an agent, deploy it, and figure out billing yourself. In mashin, economics is a first-class section of the machine definition. You declare your pricing, the runtime enforces it, and every payment decision flows through the same governance interpreter that handles permissions, guards, and consent.
The economics section
Add an economics section to any machine you want to charge for:
machine email_triage
accepts subject as text, is required body as text, is required
responds with priority as text category as text
economics pricing: per_call price: 0.05 currency: usd free_trial: 100
ensures permissions allowed to llm_call
implements ask classify, using: "anthropic:claude-sonnet-4-6" with role "You classify emails by priority and category." with task "Subject: ${input.subject}\n\nBody: ${input.body}" returns priority as text category as textThis machine costs $0.05 per call. The first 100 calls are free. When someone calls this machine, the governance interpreter checks their balance or subscription status before execution begins. If they cannot pay, the call is denied and the denial is recorded in the behavioral ledger.
Pricing models
Per-call pricing
The simplest model. Every call costs the same amount:
economics pricing: per_call price: 0.05 currency: usdGood for utility machines with predictable cost per execution: classifiers, formatters, validators, data enrichment.
Subscription tiers
For machines that consumers use regularly, subscription pricing gives them predictable costs:
economics pricing: subscription tiers starter price: 29/month limit: 1000 calls pro price: 99/month limit: unlimited enterprise price: customEach tier has a name, a monthly price, and a call limit. The custom price means the publisher negotiates directly with the consumer. The governance interpreter tracks which tier a consumer is on and enforces the call limit.
Usage-based pricing
For machines where cost varies by what happens during execution (token usage, compute time, data volume):
economics pricing: usage price: 0.001 currency: usdThe price is per unit of usage. The governance interpreter settles the actual amount after execution completes, based on measured usage.
The payment pipeline
Every economic transaction follows three steps:
-
Reserve: Before execution, the governance interpreter checks that the caller can afford the call. For per-call pricing, this is a balance check. For subscriptions, it verifies an active tier with remaining calls.
-
Execute: The machine runs normally. Steps execute, governance mediates, the behavioral ledger records everything.
-
Settle: After execution, the actual cost is settled. For per-call pricing, the reserved amount is debited. For usage-based pricing, the measured amount is debited.
If the reservation fails (insufficient balance, expired subscription, exhausted trial), the call never executes. The denial is recorded as a PolicyDecision in the behavioral ledger, just like a permission denial or a consent rejection.
Free trials
Give consumers a way to evaluate your machine before committing:
machine sentiment_analyzer
accepts text as text, is required
responds with sentiment as text confidence as number
economics pricing: per_call price: 0.02 currency: usd free_trial: 50
ensures permissions allowed to llm_call
implements ask analyze, using: "anthropic:claude-haiku" with role "Analyze sentiment. Return positive, negative, or neutral with a confidence score." with task input.text returns sentiment as text confidence as numberThe free_trial: 50 declaration means each consumer gets 50 free calls. Trial usage is tracked per consumer per machine in the behavioral ledger. Once the trial is exhausted, the consumer must pay or subscribe.
Paying for machines you call
When your machine calls another machine that charges for access, use the payment block on the call step:
machine market_report
accepts company as text, is required
responds with report as text
ensures permissions allowed to llm_call, machine.call
implements ask enrich, from: "@dataco/company-enrich" company: input.company payment max: 50 credits prefer: "mpp" fallback: "x402" returns financials as object competitors as list
ask synthesize, using: "anthropic:claude-sonnet-4-6" with role "Write a concise market report." with task "Company: ${input.company}\n\nFinancials: ${steps.enrich.financials}\n\nCompetitors: ${steps.enrich.competitors}" returns report as textThe payment block declares:
max: the maximum amount you are willing to pay for this callprefer: the preferred payment rail (MPP, x402, internal credits)fallback: an alternative rail if the preferred one is unavailable
Your machine does not need to know which rail settles the payment. The governance interpreter resolves the rail at runtime based on your organization’s configuration and the provider’s requirements.
Revenue sharing
When someone pays for your machine, the revenue splits:
| Party | Share |
|---|---|
| Publisher (you) | 85% |
| mashin platform | 15% |
Stripe processing fees come out of the platform’s 15%. Your effective take is 85% of every transaction.
Publishers connect their Stripe account through mashin.live settings. Revenue transfers happen automatically via Stripe Connect.
Governance integration
Economics is not a billing layer bolted onto the side. It runs inside the governance interpreter, in the same pipeline as permissions, guards, and consent:
trust_ceiling -> denial_history -> consent -> agency -> permissions -> economic -> execute -> recordEvery economic decision is a PolicyDecision event in the behavioral ledger:
- Which machine was called
- What the quoted price was
- Whether the caller was authorized to pay
- Which payment rail was used
- Whether the call was allowed or denied
- The hash chain linking this decision to everything before it
You can audit exactly why a call was denied (“insufficient balance”), exactly what was charged (“$0.05 via MPP”), and exactly when (“2026-04-30T14:23:01Z”). The same audit trail that proves your machine followed its governance rules also proves your economic transactions are correct.
Try it
Add an economics section to any machine. Set pricing: per_call, a price, and a free trial. Publish it. Then call it from another machine and watch the payment pipeline in the behavioral ledger: reservation, execution, settlement, all recorded as governed decisions.
Next steps
- Publishing - How to publish machines to the Kura registry
- Governance - The full governance system that economics plugs into
- Composition - Building machines that call other machines
- economics reference - Full syntax specification