Conversation Routines: When Code Learns to "Improvise"
This is a structured summary of a long-form Chinese post analyzing Giorgio Robino's *Conversation Routines: A Prompt Engineering Framework for Task-Oriented Dialog Systems* (arXiv:2501.11613v7).
Key points
- The core idea: Rather than hard-coding dialog flows, Conversation Routines (CR) embed business processes as natural-language instructions in LLM prompts, turning the model itself into the workflow interpreter—an "executable specification" readable by both humans and machines.
- Paradigm shift: As LangChain's Harrison Chase put it, "AI agents are systems that use LLMs to decide the control flow of an application." Instruction-tuned chat models can maintain multi-turn context, track state, and generate contextually appropriate responses.
- Single vs. multi-agent: Robino's experiments started with a single agent but moved toward OpenAI's SWARM-style architecture—specialized agents with distinct system prompts, dynamic handoffs, and context-aware transitions.
- Sequential steps and conditional branches (
IF ... ELSE) - Iteration logic for pagination and validation retries (max 3 attempts)
- Explicit binary confirmation checkpoints ("YES or NO") before critical actions 4. Output format and tone directives
- Built on GPT-4o-mini (128k context, function calling, low latency).
- A key design insight: stateless functions outperformed stateful Python classes—letting the LLM track pagination state in-context eliminated transaction-ID synchronization issues.
- In 50+ test runs, booking almost always succeeded; failures occurred only with deliberately uncooperative users. The agent gracefully handled vague queries ("a station in Genova, I forget the name"), pagination navigation, fuzzy time expressions, and multi-turn confirmations. A sample session took 3m41s and 36,208 tokens.
- An 18-step conveyor-belt troubleshooting manual (with conditionals, loops, and safety preconditions) was used as-is as the CR script.
- Two-agent architecture: a troubleshooting guide agent and a report-writer agent, connected via
handoff_report(). - Rigid safety rules were embedded: mandatory warnings before hazardous steps, explicit confirmation, never skipping voltage-zero verification.
- The system recovered seamlessly from interrupted flows (part lookup mid-procedure) and interpreted ambiguous confirmations, producing a structured compliance report with step IDs.
Anatomy of a CR script (eight elements)
1. Persona & goals for both agent and user
2. Function integration protocol — when/how to call tools (e.g., search_railway_station(), book_train_ticket())
3. Workflow control patterns using systematic indentation (Markdown/YAML-like):
Proof of concept 1: Train ticket booking
Proof of concept 2: Industrial troubleshooting
Comparison with other frameworks
| Framework | Approach | Trade-off vs. CR | |---|---|---| | RASA CALM | Hybrid: LLM intent understanding + deterministic dialog manager | Cheaper/lower latency, but YAML-hard-coded logic; experts sidelined | | LangGraph | Graph of nodes (Python functions) and edges | Fine-grained control and persistence, but logic lives in code | | HF Smolagents | LLM generates executable Python | Efficient, but debugging code hallucinations is hard |
CR's edge: accessibility, flexibility, fast iteration, business-expert involvement. Its costs: non-determinism, token/latency overhead, and debugging complexity.
Future directions
1. Goal-based evaluation: two-stage LLM-judge metrics (task completion, coherence, robustness, safety) feeding an eval-improve-validate loop—a CI/CD pipeline for prompts. 2. Prompt optimization pipelines: joint optimization of function signatures and CR text; possibly "CR compilers" translating high-level routines into framework-specific workflows. 3. Small LLMs for edge deployment: Mistral Small 3 (23.6B) matched GPT-4o-mini on tool-selection quality (TSQ 0.832) at lower cost. 4. Adaptive dialog design: intent recovery for off-topic queries, user-expertise-aware tone, risk-scaled confirmation granularity. 5. Modular multi-agent CR engineering: shared memory, style protocols, and arbiter agents to handle context drift and inter-agent conflicts.
Takeaway
CR frames a broader movement toward "Natural Language as Code": business logic expressed in plain language, executable by LLMs, iterated at text-editing speed. It does not replace traditional programming but opens a new abstraction layer—letting the people closest to the problem shape the solution.
References
1. Robino, G. (2025). *Conversation Routines: A Prompt Engineering Framework for Task-Oriented Dialog Systems*. arXiv:2501.11613v7. 2. Chase, H. (2023). *What is an AI agent?* LangChain Blog. 3. OpenAI (2023). *SWARM Framework: Orchestrating Agents with Routines and Handoffs*. 4. Ouyang, L., et al. (2022). *Training language models to follow instructions with human feedback*. NeurIPS.