From agent prompt to deterministic process
How to recognise agent prompts that are really fixed processes, rewrite them into Orchesty topologies with AI coding agents, and keep LLM calls only in the steps that need judgement.
The strategy article Prepare your business for AI-driven solutions argues that the agent should decide what to do, while a deterministic layer decides how. This guide is for teams that already run automations driven by agent prompts. It shows how to spot the prompts that are really processes in disguise, how to rewrite them into Orchesty topologies with an AI coding agent, and where an LLM call still belongs inside the result.
The prompt that is really a process #
Many agent automations start as a quick win: describe the task, give the agent a few tools, done. Over time the prompt grows into something like this:
You are an order-sync agent. For every new order:
1. Fetch the order from Shopify.
2. Find the customer in the ERP by email. If missing, create it.
3. Map line items to ERP SKUs using the mapping table.
4. Create the invoice in the ERP.
5. Email the invoice PDF to the customer.
Always follow this order. Never skip step 2.
If any step fails, stop and report the error. Do not improvise.
Read it again and notice what it does not ask for: there is no decision for the model to make. Every step, its order, its inputs and its failure behaviour are already fixed. Most of the prompt is spent preventing the model from doing anything other than executing a script.
Typical signs of a process in disguise:
- The prompt lists steps in a mandatory order.
- It contains prohibitions such as "never skip", "always", "do not improvise".
- Data from one step is passed to the next without being interpreted, only reshaped or forwarded.
- A "wrong" run is defined as any deviation from the listed steps.
What you pay for on every run #
An agent does not compile the prompt once. On every run it reads the instructions again, looks at the result of the previous step and decides what to call next. That runtime orchestration has a price that grows with every run:
- Tokens for decisions that are not decisions. Each step is another model call with the instructions, the previous output and often the full payload in context. Multiply by steps per run and runs per day.
- Data streamed through the model. Orders, line items and customer records pass through the context window only to be forwarded to the next system. Large payloads hit context limits or get silently truncated.
- Variance. A language model is probabilistic. An ambiguous instruction, an unusual payload or a model upgrade can produce a different sequence than the one you wrote. Rare, but real, and hard to reproduce.
- Weak operations. When a run fails halfway, you are reading a reasoning trace, not a process state. There is no per-message persistence, no controlled retry and no replay of the failed message.
None of these costs buys you anything when the sequence was fixed from the start.
Split the work: decide once, run many times #
The fix is not to remove AI. It is to move the decisions to the right moment. A fixed sequence is decided once, when the process is written. Judgement stays where it is genuinely needed.
| Concern | Agent prompt | Orchesty process |
|---|---|---|
| Step order | Re-decided on every run | Defined once in the topology |
| System access | Tools and credentials handed to the agent | Connectors with centrally managed credentials |
| Data mapping | The model reshapes payloads | Mappers and custom nodes in code |
| Errors | The model decides what to do | Repeat, stop or limit per connector, failed messages kept for replay |
| Cost per run | Tokens for every step | Tokens only in the nodes that need judgement |
| Role of the agent | Everything | Choose the right process and supply its inputs |
The agent keeps the part it is good at: understanding what the user or the triggering event wants and selecting the right process. Everything that must stay the same runs as code.
Rewriting the prompt with an AI coding agent #
You do not have to rewrite the automation by hand. The same AI that ran the prompt can help you turn it into a process, as long as it knows how Orchesty components are built.
That knowledge ships as an open rule pack, the @orchesty/nodejs-ai package. It is not tied to a single tool. When you start from the AI Bootstrap prompt, the agent clones the orchesty-nodejs-bootstrap template, reads AGENTS.md in the repository root and copies the rules to wherever your editor reads them from: Cursor, Claude Code, Windsurf, GitHub Copilot, Cline, Aider and others. The rules cover project architecture, naming, connector, batch and custom-node patterns, authentication, testing and the topology JSON format. See Using AI to bootstrap for the details.
With the rules in place, the existing prompt becomes the specification:
Here is the prompt our order-sync agent runs today (pasted below).
Rewrite it as an Orchesty integration:
- Reuse existing Shopify and ERP applications from the components catalogue where possible.
- Implement each step as a connector or custom node, with the field mapping in code.
- Keep the step order and failure behaviour exactly as described.
- Generate the topology JSON and NodeTester tests for every node.
The coding agent then does the usual Orchesty workflow described in Building integrations with AI: it checks the catalogue, installs existing applications, writes the missing connectors and mappers, registers them and generates the topology. You review the diff, import the topology and step through it with breakpoints before going live.
Keeping LLM steps where they belong #
Some steps in the original prompt may genuinely need judgement: classifying a free-text note on the order, extracting fields from an attached document, or deciding whether a request should go to automatic processing or to a person.
In Orchesty, such a step is simply a connector that calls an LLM provider's API. There is no special node type, and that is the point. The LLM step gets everything every other connector gets:
- Minimal input. You decide exactly which fields go into the call, for example only the customer's note, not the whole order with personal data.
- Structured output. Ask the model for a fixed schema or a value from a known set, and validate it in the next node.
- Routing on the result. The answer decides which branch the message continues to. Add a fallback branch, such as manual review, for answers outside the expected set.
- Operations for free. Retries, rate limiting, logging and centrally stored API keys apply to the LLM call like to any other connector.
A good rule of thumb
If a step has one correct output for a given input, write it as code. If it needs interpretation of unstructured content or a judgement call, give it to an LLM node, with the smallest input and the narrowest output you can define.
Exposing the result to agents with Pulse #
Once the topology runs, the agent no longer needs the step-by-step prompt. With Pulse, the process becomes an MCP tool with a clear name, description and input schema. The agent selects it and supplies the inputs, and Orchesty executes it deterministically, with credentials, authorization and audit kept outside the model.
What used to be a chain of model calls per run becomes a single decision: which process to call. To scope that decision to the right set of processes, see Authorize AI agents to specific processes.
Checklist #
- Review your agent prompts. Fixed order and prohibitions mean a candidate for a process.
- List the steps and mark each one as deterministic or requiring judgement.
- Let an AI coding agent with the Orchesty rule pack write the deterministic steps as connectors, mappers and a topology.
- Implement judgement steps as LLM connector nodes with minimal input and validated, structured output.
- Expose the finished process through Pulse with a description good enough for an agent to choose it.
- Compare before and after: model calls per run, tokens per run, and how failures are handled and replayed.