What's next
Production patternsChapter 14 of 141 min read
Review key architectural principles demonstrated by the contract review crew and explore advanced production extensions.
Architectural takeaways#
Each pattern introduced in this course directly remediates a common failure mode in LLM applications:
- Grounding over parametric guessing: Equipping agents with file reading tools prevents ungrounded assumptions about document contents.
- Specialized review loops: Distributing extraction, analysis, and verification across distinct agents eliminates self-confirmation bias.
- Schema enforcement: Constraining outputs with Pydantic models eliminates markdown parsing failures and delivers typed data objects.
- Deterministic arithmetic: Offloading date, financial, and numerical calculations to unit-tested Python functions prevents hallucinated math.
Core architectural rule: Use language models for semantic comprehension, extraction, and synthesis; use deterministic Python code for mathematics, dates, and schema validation.
Next challenges#
Extend your agentic system with these production patterns:
- Adversarial role testing: Update the risk analyst persona to represent vendor counsel and contrast the identified terms against buyer priorities.
- Hierarchical orchestration: Replace
Process.sequentialwithProcess.hierarchicaland introduce a manager agent to delegate tasks dynamically.
- Custom task guardrails: Implement validation callbacks that reject draft memos omitting specific contract section citations.
- Financial arithmetic tools: Build a service level credit calculator that computes contractual penalties based on uptime logs.
- Batch contract processing: Use
kickoff_for_eachto parallelize evaluations across an entire directory of agreements.