For the complete documentation index, see llms.txt. This page is also available as Markdown.

Routines

A routine is a step-by-step workflow the agent follows for one kind of request. Where a policy constrains behavior everywhere, a routine drives a specific conversation from start to finish: gathering details, calling a tool, branching on the result, and closing out.

Each routine declares the conditions under which it applies, and the agent picks the one that fits what the user asked for. When more than one could apply, the order comes from Priorities on the agent's Context step, and a tool result can send the agent back to reconsider through Re-evaluate routines after.

Writing a Routine

A routine is YAML. title, conditions, and the flow are required, description documents what the routine does, and id is optional since the storage name is the routine's primary identifier.

The flow is a list of nodes. entry names the node the routine starts at. Each node needs an id and one action, and edges live on the node itself: transitions lists where the flow can go next, with a condition on each one deciding whether it is taken.

Config holds arbitrary JSON attached to the version. It travels with that version and is available whenever the item is fetched, which makes it a place for metadata such as parameters your own tooling reads.

Associated Agents assigns a version to one or more agents while you save it. The agent label is written onto that version and the agent's configuration is updated to reference it, so an agent runs the version you assigned rather than automatically following the newest one. Assignments can be changed later.

Reading the diagram

Both Preview and the saved routine render as a diagram instead of raw YAML, which is the fastest way to confirm a flow does what you meant. Nodes are colour-coded by type:

  • Start marks where the routine begins and takes its label from the routine title.

  • Chat is something the agent says or does, defined by its chat state.

  • Tool calls a tool and carries the instruction explaining why.

  • Think is a reasoning step.

  • Macro inserts a macro from the project.

  • Fork is a branching point with no action of its own, just several outgoing transitions for the agent to choose between.

Transition conditions appear as labels on the edges, so you can follow the branching without reading the YAML.

Versions and labels

Every save creates a new version instead of overwriting the current one, and the panel on the left lists them all with the author and date. Each card also carries the labels on that version and the agents using it, so you can see which revision is actually in play before you change anything. A routine can be shared by several agents. Versions cannot be edited in place, which is what keeps the history trustworthy. New starts another version from the one you are viewing, and the commit message is what makes that history readable months later.

latest is applied automatically and always points at the newest version. Every other label is yours to create and move: the label control on a version opens Context version labels, listing the labels already in the project with a field for adding a new one. Labels are how you control which version gets fetched without touching the code that fetches it, and they are also what assigns a version to an agent.

The detail view

Five tabs sit above the content.

  • Context shows the item itself, rendered for its type.

  • Config holds the arbitrary JSON attached to this version.

  • Linked Generations lists the observations that used this version, with the same filters, columns, and export controls as Observability. This is how you tell whether a version is actually being exercised in production, and how it performs when it is.

  • Use Context gives you a ready-made Python snippet for fetching the item, either by label or pinned to a version number. Every context type is fetched with get_prompt and its full path, as in routines/dublin-attractions.

  • Label History is an audit log of label movement: which label changed, whether it was added or removed, the version it landed on, who moved it, and when.

Metrics, in the top right, swaps the versions panel for a table comparing every version side by side: median latency, median input and output tokens, median cost, how many generations used it, and when it was first and last used. It is the fastest way to catch a version that got slower or more expensive before you promote it.

Last updated

Was this helpful?