AI agent orchestration & evals
AI agents you can put in front of real users, and the evals that prove it.
Since 2023 I have owned the AI features at Turn.io end to end, including the agent harness, sandboxed tools, simulation and online evals, and the loop that turns failing evals into fixes. Much of it runs in healthcare, where "it seems to work" is not good enough.
Animated walkthrough of an AI agent run and its evaluation: an LLM plays a simulated user, a triage agent hands off to specialist agents with retrieval, sandboxed tools, a deterministic rules engine and human handover, then LLM judges score the transcript against customer-defined criteria and failures feed back into the prompt.
- persona
- First-time mother, 28 weeks pregnant
- goal
- Find out whether a symptom needs a clinic visit
- low data budget
- short messages
- worried
- persona
- Father of a 9-month-old, works night shifts
- goal
- Book the 9-month vaccination near home
- mornings only
- lives in Ward 7
- types in lowercase
- persona
- Mother of two, 34 weeks pregnant
- goal
- Ask whether swollen feet are normal
- shared family phone
- English as 2nd language
- wants reassurance
- persona
- Mother of two, 34 weeks pregnant
- goal
- Ask whether swollen feet are normal
- shared family phone
- English as 2nd language
- wants reassurance
- sim user
hi im 28 weeks. bad headache since last night and my eyes are blurry. is that normal?
- clinical guidelines agent
A severe headache with blurry vision can be a danger sign in pregnancy. Please go to a clinic today, don't wait. I'm connecting you to a nurse now.
Handed over to the on-call nurse (stubbed in simulation)
- sim user
ok thank you. going to the clinic now
- sim user
hi my son needs his 9 month injections. can i book near ward 7? mornings only
- booking agent
Clinic Central (1.2 km) has two morning slots: Tue 08:30 or Thu 09:00. Which suits you?
- sim user
tuesday 8:30 please
- booking agent
Booked: Tue 08:30 at Clinic Central. Bring the baby's health booklet. Reply CHANGE to move it.
- sim user
my feet are very swollen in the evening. is that normal at 34 weeks?
- clinical guidelines agent
Some swelling of the feet is common late in pregnancy. Rest with your feet raised and drink plenty of water.
- sim user
ok thank you
- sim user
my feet are very swollen in the evening. is that normal at 34 weeks?
- clinical guidelines agent
Some swelling is common late in pregnancy. First, a quick check: do you also have a bad headache, blurry vision, or sudden swelling of your face or hands?
- sim user
no, just my feet at night
- clinical guidelines agent
That sounds like normal pregnancy swelling. Rest with your feet up. If you get a headache, blurry vision or a swollen face, go to a clinic the same day.
- Screens & escalates danger signs0.38fail
- Only uses validated guidelines0.93pass
- No diagnosis given0.90pass
- Resolved in ≤ 4 turns1.00pass
Waiting for the judges…
No regressions on this run. Prompt v13 unchanged.
Waiting for the judges…
No regressions on this run. Prompt v13 unchanged.
Waiting for the judges…
Judges: reassured without screening for danger signs. Never asked about headache, blurry vision or sudden swelling of the face or hands.
- Answer symptom questions using the retrieved guideline.+ If swelling is reported, first ask about headache, vision changes and sudden face/hand swelling.
Re-running 50 simulations on prompt v14…
Waiting for the judges…
Replaying run 37 on prompt v14: same persona, same seed.
✓ Fixed on v14: danger-sign screening 0.38 → 0.96. Suite pass rate 92% → 97%.
Agents are easy to demo and hard to trust
A demo agent answers the five questions you tried. A production agent meets thousands of people who phrase things differently, leave out key details, change their minds and occasionally try to break it. In healthcare, one missed danger sign is one too many.
At Turn.io I own the AI features end to end:
- The agent harness organisations use to run AI agents on WhatsApp, covering tool use, orchestration, guardrails and handover between agents and to humans.
- Sandboxed tools. Agents execute tools and code inside a Lua sandbox, which lets customers connect them to medical records and external APIs without being able to break the platform.
- Offline simulation evals. An LLM plays the user from a persona and a goal, has the whole conversation with the bot, and LLM judges score the transcript against criteria the customer defines. I built these because teams doing clinical triage needed to know the error rate before real patients used the service.
- Online evals. OpenTelemetry GenAI collection and export of all AI traffic, so teams can score live conversations in Comet Opik, LangSmith or LangWatch.
- The feedback loop. Eval results flow into the AI copilot that builders use, so a failing criterion becomes a concrete change to the bot, and the builder re-runs the evals to check it worked.
I have also designed triage systems with two cooperating agents and a deterministic rule engine for high-risk decisions, measured sensitivity and errors of omission with simulation evals on vignette datasets, and compared MedGemma with frontier models on live bots rather than benchmarks. For the MedGemma work I quantised the 27B model to FP8, published it on Hugging Face and deployed it on vLLM on Modal with cold starts of about 21 seconds (down from ~100), so it is paid per use. I wrote up how the deployment works.
What I build
Agent architecture. Single agent, orchestrator and specialists, or LLM plus rules engine, chosen according to risk and testability rather than hype.
Tools and integrations. Well-typed tools with timeouts, sandboxes and audit logs, connected to your CRM, EMR or internal APIs.
Eval harnesses. Personas and goals, scenario datasets built with domain experts, judges with binary criteria, repeated runs to measure variance, and dashboards that show trends across versions.
Tracing and online evals. OpenTelemetry GenAI spans across LLM calls, tools and handovers, sampled for scoring in production.
Model selection and hosting. Frontier APIs (Anthropic, OpenAI, Gemini) or self-hosted open models (vLLM, quantisation, serverless GPUs), chosen based on your evals.
How I approach it
- Start on a call with the people who will use it. I run discovery with your users and domain experts, and most of the criteria come from them.
- Write the evals before polishing the prompt. Define what “good” means, then iterate.
- Ship a first version fast, measure it on simulations, then on real traffic.
- Close the loop. Every failure becomes a test case.
Related
- WhatsApp Business Platform engineering: where many of these agents live.
- Agentic coding for engineering teams: using agents to build software, not just ship them.
Ways to engage
Evals sprint
Two to three weeks to define criteria with your domain experts, build a simulation and judging harness, and get a baseline for your agent.
Agent build
Design and ship an agent or multi-agent system end to end, from discovery with your users to production.
Architecture and model review
Review an existing agent for failure modes, cost and latency, and compare models on your own data.
Questions
What are simulation evals?
An LLM plays a user with a persona and a goal and has a whole multi-turn conversation with your agent. Then LLM judges score the transcript against criteria your domain experts define. Running hundreds of simulations tells you the error rate before real users see the agent.
Is LLM-as-judge reliable?
It is reliable when the criteria are specific and binary, the judge sees the evidence it needs, and you calibrate it against human labels on a sample. Vague rubrics give noisy scores. I design criteria with the people who know the domain.
How do you evaluate agents in production?
By collecting traces of real conversations using the OpenTelemetry GenAI conventions, scoring samples with the same judges used offline, and exporting to tools like LangSmith, Opik or LangWatch. That way offline and online results are comparable.
Which model should we use?
The one that passes your evals at an acceptable cost and latency. I compare frontier models and open models on your own simulations rather than on public benchmarks. Sometimes a quantised open model on serverless GPUs wins, and sometimes it doesn't.
Do you work on multi-agent systems?
Yes, including triage agents that hand over to specialists, deterministic rule engines for high-risk decisions, and handover to human operators. I only reach for multiple agents when it makes the system easier to test.
Related writing
Testing a medical triage agent with LangWatch Scenario and pytest
How I test a medical triage AI agent with LangWatch Scenario: a simulated user, judge criteria, scripted and free-running conversations, in pytest and CI.
Letting AI agents run code safely in Elixir with tv-labs/lua
How tv-labs/lua gives AI agents a sandboxed Lua runtime inside Elixir: exposing safe functions, setting limits and wiring code execution into the agent loop.
Serving MedGemma 27B on Modal: FP8, vLLM sleep mode and 21-second cold starts
How I self-host MedGemma 27B as a scale-to-zero, OpenAI-compatible API on Modal: FP8 quantisation, GPU snapshots, two vLLM bugs and Gemma 3 tool calling.
Designing AI agents that know when to hand over: to other agents, to rules, to humans
A practical architecture for AI agents that hand over safely: multi-agent transfers, a deterministic rules engine for high-risk calls, sandboxed tools, evals.