Skip to main content
A workflow is a reliable sequence of steps written in TypeScript. Prefer one when you already know the order of work—even if an individual step uses an LLM or agent for judgment: call an action, prompt an agent, branch on the result, wait for approval, then continue. Keystroke records each action, agent, or LLM step as it finishes. If a later step fails or the run is retried, the workflow resumes from the first unfinished step instead of starting over.

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 under src/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
The 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

Workflows are one of the main primitives in a project, alongside agents, actions, and triggers. Reach for a workflow when the work is a known sequence that should run reliably; reach for an agent when the work needs open-ended reasoning. The two compose: a workflow can prompt an agent as a step, and an agent can run a workflow as a tool.

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:
To let people outside your team start a run from a link, publish a workflow form. See run workflows for triggers, forms, the HTTP API, and using a workflow as an agent tool.

Running deployed workflows

Deploy your project, then run the workflow against the deployed project:

Next steps

Build workflows

Define workflows with typed input, steps, durability, and waits.

Best practices

Keep workflows replayable at runtime and legible on the canvas.

Run workflows

Start runs from the CLI, triggers, forms, the API, and agent tools.

Workflow forms

Publish a public form that starts a run from a shareable link.

Test workflows

Run workflows in tests and assert their output.

Workflow runs

Inspect input, output, steps, errors, and traces.