Summary
Highlights
Margo van Laar, an applied AI engineer at Anthropic, introduces the essential skill of prompting for effective AI systems. The session will cover best practices for two scenarios: refining existing production prompts and building new agentic use cases from the ground up.
The speaker illustrates common problems with complex, collaborative prompts, such as conflicting instructions and legacy patches. The solution begins with rigorous evaluations (evals) to measure prompt performance, differentiate between model capabilities and behavior, and test for regressions during model migration.
An effective eval suite needs control cases (expected to pass), edge cases (where the model previously failed), and refusal cases (where the model should hand off to a human or refuse to answer). An example is presented using a customer support bot for a Telco company with five specific test cases.
Before detailed debugging, general prompt hygiene is applied. This includes clarifying the bot's role (removing 'human' designation), removing irrelevant information (like website-specific text), and structuring instructions with XML tags to separate policy, guidelines, and tone. This leads to an immediate improvement in model performance.
A key best practice for consistent output format is to define an 'output contract'. For conversational bots, this might involve specifying XML tags for responses. For more complex structures like nested JSONs, using structured outputs and API stop sequences (to detect closing tags) can ensure consistency and prevent parsing errors.
The model was deflecting inquiries about hotspot data for legacy plans, even when the information was available. This was due to an overfitted instruction from a previous model patch. The fix involves providing a balanced view in the prompt, emphasizing accuracy from customer-specific data over general policy, and tracking reasons for defensive changes through version control.
The model failed to perform accurate proration calculations. The initial prompt instructions to 'do a good job' or 'calculate correctly' were insufficient. The solution was to provide the model with a 'calculate proration tool', defining its schema and implementing the underlying math. This demonstrates that instructions don't add capability; tools do.
The bot was failing to escalate billing errors to a human, instead attempting to self-diagnose. This was caused by an instruction that emphasized the cost of escalation without mentioning the cost of getting it wrong. The fix involves presenting both sides of the trade-off, allowing the model to make more informed decisions, especially as models become more intelligent.
The second scenario involves building a new agent, a retail staff scheduler, from scratch. The evaluation uses hard rules checked by a Python function. The talk explores how model choice, prompt complexity, and thinking strategies impact performance.
Initial attempts with a simple prompt and a smaller model (Sonnet 4.6) result in many violations. Switching to a larger, more capable model (Opus 4.7) reduces violations but doesn't eliminate them. Using Opus with adaptive thinking (allowing it to decide how much reasoning to use) reliably generates compliant schedules but increases token usage and latency.
Further attempts involve improving the Sonnet 4.6 prompt with more reasoning instructions, but this still faces token limits. The most effective approach is an agentic generate-evaluate-repair loop, where a generator creates a draft, a separate LLM evaluates violations, and a repair prompt makes targeted fixes. This method achieves high compliance with lower token usage and latency, offering flexibility for soft constraints at runtime.
The presentation concludes by summarizing the learnings: applying general hygiene principles provides initial uplift, evals are crucial for rigor, targeting failure modes systematically improves performance, and agentic loops can solve complex problems efficiently by splitting tasks across multiple prompts and leveraging model capabilities effectively.