Quickstart
An agent states an intent. The service answers with proposals that list their effects before anything happens. The person's signed policy lets some go ahead on their own and stops the rest for their approval, and a receipt can be undone. This page runs that loop in your browser or terminal, then shows where the service and agent code lives.
Try it in your browser: the playground runs the real core, with nothing to install. Or in your terminal: npx @yea-protocol/cli demo runs a narrated session with two services, a human's policy, consent and undo, over real sockets.
Unreleased: the SDKs and the
yeacommand aren't on npm or PyPI yet, sonpxand the installs below fail for now. Until they're published, run the demo from a clone:shgit clone https://github.com/yea-protocol/yea && cd yea npm ci && npm run build node cli/bin/yea.js demoIn your own project, install the TypeScript SDK as a packed file, as the MCP guide shows, and the Python SDK from the repo:
shuv add "git+https://github.com/yea-protocol/yea#subdirectory=python"
Once they're published, each SDK installs with one command:
npm install @yea-protocol/sdk # TypeScript/JavaScript: Node ≥ 20, Bun, Deno (web-standard APIs only)
uv add yea-sdk # Python ≥ 3.10 (or: pip install yea-sdk)Build a service
A service declares what an agent may ask and what it may intend. For each intent, plan returns proposals: a summary, the effects, an apply that runs only on COMMIT and at most once, and a revert with an undo window when the change can be undone. Params are validated against the compact schema automatically, and typos get fixes like rename `dya` to `day` . Budgets, EXPAND, idempotent commits, replay protection, grant verification, spend accounting and consent are all handled for you.
The example calendar is a whole service, tested in CI: calendar.ts declares its capabilities, and calendar/plans.ts is what each intent proposes. In Python, it's calendar_example.py. listen(service) from @yea-protocol/sdk/node serves one on yea://127.0.0.1:7447, and serveHttp or fetchHandler serve it over HTTP, for Workers, Bun and Deno. Build a service walks through one.
Have a REST API already? From REST to YEA maps each REST concept to YEA and translates a Stripe-backed billing API step by step, with the full code.
Act as an agent
An agent connects with its own key and the grants its person signed (connect(url, { key, grants })), states an intent (intent(capability, params, { auto: true })), gives the reply's lens to its model, and commits the proposal it picks (commit(proposal)). The SDK's service tests drive the example calendar this way, and Intents and proposals explains each reply.
Python has the same concepts in snake_case (issue_grant, consent_grant, lens, connect), with decorators and a Plan dataclass instead of chaining. The CLI and MCP bridge are TypeScript-only. See python/README.md.
Delegate with a policy
yea init # your principal key + an agent key (~/.yea)
yea grant --svc cal.example.com --svc shop.example \
--risk low --each spend=40.00USD --total spend=100.00USD --exp 8h # signed policy for your agent
yea inspect <token> # read any grant chain
yea delegate <token> --to <sub-agent key> --verbs ASK,INTENT # narrower authority for a sub-agent
yea approve <pc1.code> # review and sign a one-time consent for one proposal
yea approve [<id>] # on one account: list pending approvals, or review one by its short id
yea examples # serve the example calendar + shop locally
yea do yea://127.0.0.1:7447 calendar.reschedule event=Ana # interactive: intent → pick → commit
yea help grant # any command's flags and an exampleNext
- Add YEA to your MCP server (Python): guard one risky tool with one call.
- Intents and proposals: the loop every YEA service speaks.
- Build a service: capabilities, plans, errors that teach.
- Python: the same protocol in Python.
- Security model: where the principal key must live.