packages/twenty-docs/developers/extend/apps/logic/overview.mdx
A Twenty app's logic layer is the code that runs — server-side TypeScript handlers reacting to HTTP requests, cron schedules, and record changes; AI skills and agents that live inside the workspace; and OAuth connections that let your functions act on a user's behalf in third-party services.
┌─ HTTP route ──┐
│ Cron schedule │
│ Database event │ ┌────────────────────┐
triggers ─┤ AI tool call ├─────▶│ Logic function │
│ Workflow action │ │ (your handler) │
│ Manual exec │ └────────────────────┘
└────────────────────┘ │
▼
┌────────────────────────────┐
│ Twenty API (records) │
│ Third-party API │
│ (via Connection token) │
└────────────────────────────┘
A logic function picks one or more triggers — every entry below is a separate field on defineLogicFunction():
| Trigger | When it runs | Setting |
|---|---|---|
| HTTP route | A request hits your /s/<path> endpoint | httpRouteTriggerSettings |
| Cron | A CRON expression matches | cronTriggerSettings |
| Database event | A workspace record is created, updated, or deleted | databaseEventTriggerSettings |
| AI tool | A Twenty AI feature decides to call your function | toolTriggerSettings |
| Workflow action | A workflow step invokes your function | workflowActionTriggerSettings |
Functions run sandboxed in isolated Node.js processes and access the workspace through a typed API client scoped to the role declared on defineApplication().