How to build an AI workflow that works in production
An AI workflow is a series of steps in which a model handles some of them, and it's usually built from predefined code paths that orchestrate LLMs and tools. To build one that holds up, write down the outcome, decide which steps need a model, put a check on each step, and watch real runs.
By Arun Prasad · Published · Last updated
On this page
Why AI workflows matter
A workflow can finish every step without an error and still miss what the user wanted. Standard monitoring won't tell you that it failed.
AI agents don't fail like normal software. A tool can return a 200 and the task can still fail. Standard monitoring shows that the request went through, not whether the answer was right. In a multi-step workflow this gets worse. A wrong answer at step 2 can pass through steps 3 to 5 with every status green, and you only hear about it from the user.
The rest of this guide is about checking the outcome, not only whether each step ran.
Step 1: Write down what the workflow should achieve
Define the outcome in the user's terms before you draw any steps. That outcome is what you will check later.
Write one sentence for what the user came for. For example, "the customer's refund request is resolved or handed to a person with the details filled in." Don't write "the refund tool is called." The first is an outcome. The second is an activity, and it can succeed while the outcome fails.
This matters because PRISM by Block Convey's Agent Observability tracks the outcome against the user's goal, not just whether each step returned success. A sentence written now gives you something to measure against.
Step 2: Split it into steps and decide which need a model
Use a fixed rule where the answer is known. Use a model only where the input varies.
List each step the workflow takes. A span is one step inside a trace, such as a single tool call. For each span, ask whether a fixed rule could do the job. Validating an order number format, routing by a field, or looking up a record are rules. Reading a free-text complaint and deciding what it's about is a model's job.
The reason is checkability. A fixed code path behaves the same way each time, so it is easier to test and to explain. Anthropic's guidance on building agents says workflows offer predictability and consistency for well-defined tasks. It also recommends finding the simplest solution possible and adding complexity only when needed. Each model step you add is a step whose output you must judge instead of just compare.
Step 3: Add a check to each step
Pair a deterministic rule with an LLM judge, and use each where it fits.
PRISM's Evaluators use two kinds of rules:
- Deterministic rules give the same verdict for the same input. No model is involved, and they run on 100% of sessions. Use them for things you can state exactly, such as a required field being present.
- LLM-as-judge rules have a model read the exchange. Use them where correctness depends on meaning, such as whether the reply answered the question.
Core scores are on the Free plan. Custom evaluators and the Evaluators Hub need Builder or above.
Evaluators score runs after the fact. To enforce a rule while the workflow runs, PRISM's Guardrails monitor and enforce on verified runtime paths, in Monitor and Enforce modes. Supported policies are PII/PHI, prompt injection, regex and off-topic. The checks are rule-based, and no LLM is involved. Guardrails need Builder or above.
Step 4: Trace every run
Send a trace for each run so you can see every step, tool call, retry and handoff. You can't check what you can't see.
In PRISM, Agent Observability gives you Traces (request, response, model, cost, timing and scores for each run) and Agent Runs (steps, tool calls, retries, handoffs and state). Two limits to plan around:
- Agent steps appear when your integration sends them. If your workflow doesn't send a step, PRISM can't show it.
- Traces that share a session_id form one conversation, and sessions can't be backfilled. Set the ID from the start.
Every supported connector is available on every plan, including Free.
Step 5: Test it before real users do
Run simulated users against the workflow before launch, and keep the cases that fail as regression tests.
Synthetic Scenarios (Beta) does this in PRISM. You describe the app, and PRISM writes simulated users from the app description and the Knowledge Base: 7 app-specific types plus 3 that try to break it. They cover realistic situations such as changing intent, missing details, tool problems and questions outside the knowledge. PRISM then judges whether the user got what they came for. A failing scenario becomes a regression test.
This is a Beta, and access is by waitlist. It's switched off in production, and "Request beta access" joins the waitlist. Until you have access, you can write a short list of tricky cases by hand and run them before each release.
Step 6: Fix one thing at a time and compare
Change one prompt, source or tool setting per release, then compare results before and after. A person approves each change.
If you change three things at once and results move, you won't know which change did it. With one change per release, the comparison means something.
PRISM's AI Remediation traces a failure to a likely cause and suggests a change. After a fix is merged, PRISM compares pass rates for the 7 days before and the 7 days after the merge. Nothing ships without human sign-off.
How this looks in production
For one workflow run, PRISM records the steps, tool calls, retries, handoffs and state, along with the model, cost, timing and scores for the run. Each evaluator verdict links to the rule, the span, the source checked and the reason. When a check fails, you can see which step it failed on and why. You don't have to guess from a final answer.
PRISM also groups repeated failures into patterns and shows how many sessions share each one. Together, these are one loop:
Create a scenario → run the app → PRISM finds the issue → Observability (traces, sessions) → Agent Intelligence → Evaluators (checks that re-run) → AI Remediation → run it again.
The SDK is Python only. To start sending traces from a Python workflow:
Example:
pip install "prismtrace-sdk>=0.4.3"
Then import prismtrace in your code. Workflows in other languages can use the HTTP endpoint or OpenTelemetry. See how PRISM supports teams shipping AI agents for how PRISM fits agent stacks.
If your workflow already runs, you can send its traces to PRISM and look at real runs.
Common mistakes
- Checking only whether a step returned success. A 200 says the request went through, not that the answer was right. Fix: check the outcome against what the user came for (Step 1).
- Putting a model in steps a fixed rule could handle. Each model step adds output you must judge. Fix: use a rule where the answer is known and a model only where the input varies (Step 2).
- Changing several things at once. You can't tell which change moved the result. Fix: change one thing per release and compare before and after (Step 6).
- Assuming an LLM judge checks only a sample. In PRISM it doesn't. The LLM judge is not sampled. It scores every incoming trace until the plan's allowance runs out (Free: 100 a day). After that only the deterministic rules run. Fix: know your allowance, put the checks that must never lapse in deterministic rules, and watch for the day the allowance ends.
What are automation workflows?
In this guide, an automation workflow means a fixed sequence of steps that runs without manual handoffs. An AI workflow is one where a model handles some of those steps, often inside predefined code paths that orchestrate LLMs and tools.
That makes checking harder. A fixed step gives the same output for the same input, so you can compare it with an expected value. A model step can give a different answer each time, so you have to judge whether the answer was right, not just whether it matches.
Check your AI workflow against real runs
Send your workflow's traces to PRISM and see each step, tool call and outcome.
Free to start, 100 credits each month.