~/docs/services
Services
Action and trigger services — the core building blocks of OpenPieces.
Services are Deno HTTP servers that the AI writes, deploys, and manages. There are two types: action and trigger.
Action Services
An action service is a standalone Deno HTTP server. It can serve a web UI, expose a REST API, or both. Action services are reusable across workflows and get a public URL on deployment.
- Standalone products — games, dashboards, tools, APIs
- Reusable across multiple workflows
- Gets a unique public URL when deployed
- Can use SQLite for persistence
- Can serve a Fresh web UI or be a pure API
Trigger Services
A trigger service receives inbound events — webhooks from Stripe, GitHub, or any external system. It validates the event, then calls the built-innotifyEventsAi function to start workflow execution.
- One trigger per workflow — never reused
- Validates events (signatures, auth) before notifying
- Calls
notifyEventsAiwhich wakes the Events agent - The Events agent executes the linked workflow
Service Lifecycle
1The AI creates the service record and a directory on disk
2OpenCode writes the Deno code in a session
3The service auto-deploys when the session goes idle
4Status becomes
running — the service is live5If required secrets are missing, status stays
stoppedStatus Reference
| Status | Meaning |
|---|---|
| stopped | Not deployed — missing secrets or not yet built |
| running | Deployed and accepting requests |
| crashed | Process exited unexpectedly — auto-repair attempted |
| deploying | Currently being deployed or redeployed |
Learn how to register HTTP routes.Endpoints