How data moves through a Factory
A workflow is more than a list of steps. Each step needs information: a customer’s request, an issue title, a document, or the result of earlier work.
As a workflow grows, it can become difficult to answer a basic question: where did this value come from?
Factory makes those connections part of the workflow definition. Triggers and steps expose named ports, and bindings describe how values move between them. Types give those values a shape.
Let’s look at a small example.
Start with a ticket
Suppose we want an agent to draft a response to a support ticket. The trigger needs two pieces of information: the ticket’s key and its title.
We can describe that shape as a type:
type Ticket = { key: text, title: text }
A Ticket is a record with two fields, both containing text. We can then use it in a manual trigger:
trigger start:
kind: manual
out: { ticket: Ticket }
When someone opens this trigger in the app, Factory can build a form from its declared outputs. The person firing it supplies the ticket information that starts the Run.
Connect the ticket to a step
Here’s a complete example using the OpenCode runner from Your First Factory:
type Ticket = { key: text, title: text }
external port credential(key: text) -> secret
runner agent:
kind: opencode
in: open
out: open
trigger start:
kind: manual
out: { ticket: Ticket }
step draft:
runner: agent
in:
prompt: start.ticket.title
token: credential(key: "opencode")
out: { text: text }
The line that connects the trigger to the agent is:
prompt: start.ticket.title
Read it from right to left: take the title field from the ticket emitted by start, and bind it to the draft step’s prompt input.
The step declares a text output named text. Once the Run completes, you can inspect the step and its recorded output in the app.
The ticket key is part of the trigger’s input, but this step doesn’t use it. That’s visible too: the definition tells you exactly which field feeds the prompt.
To run the example, you need an opencode secret and a deployment with the runner and its machine backend configured, as described in the previous article.
What the types help with
Types make the expected shape of data explicit. Here, Ticket tells a reader—and the trigger form—that a ticket has a key and a title. The draft step declares that it produces text.
Factory checks a definition when you upload it, including names, declared ports, and certain structural and type constraints. It also checks some values as they cross boundaries during a Run. Those checks aren’t exhaustive: not every connection is fully type-checked at upload, and runtime conformance does not recheck every primitive value.
That distinction matters. Types help make a workflow understandable and catch some errors, but they don’t replace testing the workflow with real inputs.
Follow the data
The example has one step, but the same idea applies as a factory grows. A later step can bind an input to a named output from an earlier one. A reader can follow those bindings to understand where the data comes from.
On the Run page, the definition becomes a record of an execution: you can inspect the flow, step outcomes, and recorded values for the version that ran.
For the details of Factory’s types and their rules, see the types guide. To build and run your first agent workflow, start with Your First Factory.