Context.Tag for service definitions and Layer for composition.
Defining a Service
A service is a typed capability:run functions:
Providing a Service
Services are provided throughLayer:
Composing Layers
UseLayer.mergeAll to compose multiple service layers:
Layer Dependencies
Services can depend on other services:Common Service Patterns
Model Provider
Repository
VCS Adapter
Testing with Services
Replace live services with test implementations:Services in TOON
TOON workflows can use Effect services throughhandler: functions and the imports: block:
Design Principles
- Services own capabilities, not workflow data. Step context provides workflow data; services provide infrastructure.
- Layers compose. Build your service graph with
Layer.mergeAll,Layer.provide, andLayer.effect. - Test by swapping layers. The same workflow runs against live and mock services without code changes.
- Keep services focused. A service should represent one capability (model calls, VCS, tickets), not a grab-bag of utilities.
Next Steps
- Context — How services interact with step context.
- Builder API — Using services inside builder steps.
- Installation — Setting up Effect and provider packages.