Event responders
Reply in a Slack thread when a message reports a failed deploy.
A code automation is a managed agent automation that you write in TypeScript. You deploy it with Type CLI, and Type runs it on a schedule or when an event comes. You do not manage servers.
With code automations, you can:
Code is fast, costs less than AI, and gives the same result each time. Use code for the fixed steps, and AI for the rest.
Event responders
Reply in a Slack thread when a message reports a failed deploy.
GitHub workflows
Post in a Space when a pull request is merged, or when CI fails on main.
Scheduled checks
Read a service every 15 minutes and report only what changed.
Webhook receivers
Verify webhooks from any service, then process each event in code.
A code automation is one TypeScript file with two exports:
import type { AutomationContext, AutomationDeployment, RecurringEvent,} from "@type-dot-com/sdk/automations";
// When to runexport const deployment = { subscriptions: { hourly: { title: "Hourly check", description: "Record the scheduled time", source: { kind: "recurring", schedule: { kind: "interval", everySeconds: 3600 } }, }, },} satisfies AutomationDeployment;
// What to do: one method for each subscriptionexport default class { hourly(ctx: AutomationContext, event: RecurringEvent) { return ctx.setOutput({ checkedAt: event.scheduledAt }); }}After you deploy, Type does the rest:
ctx. It has no direct network access.| Concept | Meaning |
|---|---|
| Subscription | A trigger and the method that it runs. An automation has one or more. |
| Source | What starts a run: a schedule (recurring) or an event (integration). |
| Matcher | A filter that Type runs on the server before your code. |
ctx | The object that your method uses to read, write, save state, and give work to the managed agent. |
| Checkpoint | State that a subscription saves for its next run. |
| Fixture | A test case that Type runs at each deploy. |
| Webhook adapter | Code that connects a service’s webhooks to Type. |
type.json and src/main.ts.type-cli automations deploy . --space <space>. Type typechecks the code, runs the fixtures, and enables the automation.You can also ask Type AI in a Space to write and deploy a code automation for you. See Create and Manage Automations.
A code automation is not limited to code. In the same run, your code can:
ctx.read and ctx.write,See Managed Agent Automations to compare code automations with instruction automations.