Example requests
Ask your coding agent for an automation with known steps. It can turn that request into a workflow whose steps are tracked, retried, and inspected.“When a new signup comes in, research the account, score the lead, add it to Salesforce, and post a brief to Slack.”
“Every Friday, collect closed deals from HubSpot, generate a sales summary, and email it to the leadership team.”
“When a support escalation is approved, create a Linear issue, notify the account owner, and wait for a human resolution before closing the loop.”
How workflows are defined
In Keystroke, workflows live in your project code undersrc/workflows/. Each file default-exports a defineWorkflow() definition with typed input and output, and the runtime discovers it when you run or deploy the project.
src/workflows/signup-pipeline.ts
run function is normal async/await code. Each .run() (or agent .prompt()) call is recorded as a durable step, so the workflow can replay completed steps instead of repeating them.
What workflows can do
| Capability | How it works |
|---|---|
| Typed input and output | Zod schemas validate the payload going in and the result coming out |
| Action steps | Call any action with .run(), your own or one from an integration |
| Agent steps | Prompt an agent with .prompt() when a step needs judgment |
| LLM steps | Use promptLlm() for a one-shot model call without defining a full agent |
| Durability | Completed steps are recorded and replayed, so retries resume instead of restarting |
| Durable waits | ctx.sleep() and ctx.hook() suspend a run for a delay or until it is resumed externally |
| Sandbox | An optional /workspace shared with agent steps for file and code work |
How to run workflows
Most workflows run from a trigger, such as a webhook, schedule, poll, or app event attached to the workflow. While building, run them directly from the CLI:Running deployed workflows
Deploy your project, then run the workflow against the deployed project:keystroke dev and the same commands target it instead. The CLI chooses local or cloud based on the active target; see targets: local vs cloud.
Next steps
Build workflows
Define workflows with typed input, steps, durability, and waits.
Run workflows
Start runs from the CLI, triggers, the API, and agent tools.
Test workflows
Run workflows in tests and assert their output.
Workflow runs
Inspect input, output, steps, errors, and traces.