# Agentic AI for Actuaries: the code companion > Companion site for the book Agentic AI for Actuaries (Satya Sai Mudigonda and Rohan Yashraj Gupta, ACTEX Learning, first edition 2026). The book is free at https://www.actexlearning.com/textbooks/agentic-ai-for-actuaries. This site carries the runnable companion code for chapters 9 to 17, the synthetic datasets it uses, and setup instructions. Site: https://aiforactuaries.sssia.org Repository: https://github.com/RohanYashraj/agentic-ai-for-actuaries-code (MIT licence; the book text is not covered) Book: https://www.actexlearning.com/textbooks/agentic-ai-for-actuaries ## What the site offers - https://aiforactuaries.sssia.org/code: nine chapters of companion code. Tool scripts run editable in the browser on Pyodide; agent scripts run live on the server against Gemini with tool calls streamed; every chapter opens in Colab. - https://aiforactuaries.sssia.org/setup: Colab with a free Google AI Studio key, local install with uv, the live runner's limits. - https://aiforactuaries.sssia.org/data: the synthetic Meridian Re datasets and which chapter reads each one. - https://aiforactuaries.sssia.org/book: what the book covers, where to get it, who wrote it. ## Code chapter pages ### Chapter 9: What is Agentic AI? https://aiforactuaries.sssia.org/code/ch09 Your first agents: a minimal Agno agent with a single tool, then a data quality agent that scans the defect-seeded motor India claims triangle and reports what it finds. - 01_column_agent.py: A single Gemini agent reasons about which triangle column to trust. (runs live on the server) - 02_data_quality_agent.py: Profiles the claims triangle and flags the seeded data defects. (runs live on the server) Builds: Autonomy, goal-directed behaviour, and environmental interaction as the three defining properties; The five-stage cognitive loop: perception, reasoning, planning, action, memory; ReAct, Plan-and-Execute, and Reflexion design patterns; Why heterogeneous inputs favour agents and uniform inputs favour deterministic pipelines; Agentic failure modes: wrong tool selection, compounding misinterpretation, and loops. Colab: https://colab.research.google.com/github/RohanYashraj/agentic-ai-for-actuaries-code/blob/main/notebooks/ch09.ipynb ### Chapter 10: Tool Use and Function Calling https://aiforactuaries.sssia.org/code/ch10 Designing actuarial tools: a mortality lookup with a validation gate, a present-value tool with structured error handling, and the term life premium agent that chains them together. - 01_mortality_tool.py: Looks up q(x) from the IALM 2012-14 ULP table, rejecting out-of-range inputs. (runs in the browser) - 02_present_value_tool.py: Discounts a stream of future cashflows with structured error returns. (runs in the browser) - 03_term_life_premium_agent.py: The agent chains both tools to price a 10-year term assurance. (runs live on the server) Builds: A tool as a named function with a specified input schema and output; Why tool descriptions drive reliability more than prompt engineering does; Tool selection failure, and keeping the tool set to five to ten tools; Structured errors that let an agent retry, fall back, or escalate; Sandboxing, least capability, and the blast radius of a tool call; Code execution tools as the highest-power, highest-risk case. Colab: https://colab.research.google.com/github/RohanYashraj/agentic-ai-for-actuaries-code/blob/main/notebooks/ch10.ipynb ### Chapter 11: Multi-Agent Systems and Collaboration https://aiforactuaries.sssia.org/code/ch11 A fixed-path, three-step reserving review: a data quality agent checks the triangle, a reserving agent fits chain ladder and Bornhuetter-Ferguson and reconciles them, and a commentary agent drafts the memo. - 01_reserving_review_workflow.py: The full analyst-and-reviewer workflow over the motor triangle. (runs live on the server) Builds: Sequential pipeline, parallel fan-out, hierarchical delegation, and debate patterns; Workflows versus teams — and why workflows come first under regulatory scrutiny; The supervisor pattern as the workhorse of production multi-agent systems; Structured handoffs with schemas, instead of lossy free-form text between agents; The status field as the basis for alerting, quality monitoring, and audit; Conflict resolution by voting, authority, arbitration, or escalation to a human. Colab: https://colab.research.google.com/github/RohanYashraj/agentic-ai-for-actuaries-code/blob/main/notebooks/ch11.ipynb ### Chapter 12: Memory, Planning, and Reasoning https://aiforactuaries.sssia.org/code/ch12 Persistent and semantic memory: an agent that remembers the FY2024 Q3 experience adjustment across processes via SQLite, and a vector store over the synthetic experience study archive. - 01_sqlite_memory.py: Two turns against SQLite-backed memory; the second recalls the first. (runs live on the server) - 02_vector_knowledge.py: Embeds the experience-study archive into Chroma and answers from it. (runs in Colab) Builds: Short-term, long-term, and episodic memory as distinct mechanisms; Context window management and summarisation at task boundaries; Vector stores, structured databases, and knowledge graphs for long-term memory; Planning versus reasoning, and hierarchical task decomposition; Reasoning traces as auditable and correctable evidence; Self-reflection before committing to an output. Colab: https://colab.research.google.com/github/RohanYashraj/agentic-ai-for-actuaries-code/blob/main/notebooks/ch12.ipynb ### Chapter 13: Pricing and Underwriting https://aiforactuaries.sssia.org/code/ch13 Commercial property underwriting for Meridian Re: COPE extraction from a broker submission PDF, GLM-vs-comparables premium reconciliation, and the three-agent underwriting workflow. - 01_cope_extraction_tool.py: Extracts COPE fields from the broker submission PDF via pypdf. (runs in Colab) - 02_pricing_reconciliation_tool.py: Reconciles a cedent's proposed rate against internal pricing. (runs in the browser) - 03_underwriting_workflow.py: Extraction, pricing, and review agents process the submission end to end. (runs live on the server) Builds: Automated rating with the rating model retained as the actuarial control point; Underwriting triage against underwriting authority; Competitive intelligence from public rate filings and market reports; Dynamic pricing cycles compressed from quarterly to weekly; Continuous model validation, back-testing, and sensitivity analysis; Rate filing compliance checks with citations to source provisions. Colab: https://colab.research.google.com/github/RohanYashraj/agentic-ai-for-actuaries-code/blob/main/notebooks/ch13.ipynb ### Chapter 14: Reserving and Claims https://aiforactuaries.sssia.org/code/ch14 Reserving with reflexion: a Cape Cod tool that derives its expected loss ratio from the data, movement commentary that cites its sources, and the full reflexion workflow that reconciles against the prior cycle. - tools_reserving.py: Cape Cod reserve estimate on the Meridian motor triangle. (runs in the browser) - tools_commentary.py: Drafts movement commentary from a reflexion check's output. (runs in the browser) - 01_reserving_reflexion_workflow.py: The workflow critiques its own diagnostics before concluding. (runs live on the server) - 02_commentary_agent.py: An agent exercises the commentary tool end to end. (runs live on the server) Builds: Multiple reserving methods applied to one triangle, with agreement and disagreement surfaced; Claims triage and routing from free-text notes; Fraud detection that produces investigative leads, not adjudications; Continuous loss development monitoring against prior expectations; Narrative generation for reserving memoranda; The shift from an episodic quarterly close to continuous monitoring. Colab: https://colab.research.google.com/github/RohanYashraj/agentic-ai-for-actuaries-code/blob/main/notebooks/ch14.ipynb ### Chapter 15: Life, Health, and Pensions https://aiforactuaries.sssia.org/code/ch15 A multi-scheme pension pipeline for closed UK DB schemes: a quality gate on member data, a funding valuation with a six-way sensitivity panel, and member statements whose every figure carries a citation. - 02_quality_gate.py: Validates scheme member data before the pipeline is allowed to run. (runs in the browser) - 01_pension_valuation.py: Technical provisions, funding target, and the sensitivity panel. (runs in the browser) - 03_member_communication.py: Drafts an annual annuity statement with source-traced citations. (runs in the browser) - 04_ingestion_agent.py: An agent gates the member file through the quality checks. (runs live on the server) Builds: Life product development: profit testing, sensitivities, and documentation; Mortality and morbidity experience studies against IALM, CMI, and SOA tables; Health analytics: utilisation, treatment cost trends, and case-mix adjustment; High-volume pension scheme valuations with per-scheme benefit structures; Asset-liability management and scenario expansion; Personalised policyholder communication at scale under GDPR, HIPAA, and DPDP. Colab: https://colab.research.google.com/github/RohanYashraj/agentic-ai-for-actuaries-code/blob/main/notebooks/ch15.ipynb ### Chapter 16: Risk Management and Compliance https://aiforactuaries.sssia.org/code/ch16 Regulatory monitoring, capital impact, and ORSA drafting: a source-of-truth registry guards authority, capital snapshots are read-only, and every quantitative claim in the draft carries a supervisor-grade citation. - 01_regulatory_monitoring_tool.py: Fetches from an approved source registry and rejects authority drift. (runs in the browser) - 02_capital_impact_tool.py: Attributes a regulation's capital impact across business lines. (runs in the browser) - 03_orsa_drafting_tool.py: Drafts an ORSA risk-profile section from a typed impact assessment. (runs in the browser) Builds: Regulatory monitoring across Solvency II, IFRS 17, LDTI, IRDAI, and IAIS document flows; Capital modelling support: parameter assembly, scenario specification, exhibits; Stress testing and scenario analysis against risk appetite; ORSA and board risk reporting assembly; Model risk management for an inventory growing faster than headcount; Designing for audit trail and explainability from the start, not retrofitting it. Colab: https://colab.research.google.com/github/RohanYashraj/agentic-ai-for-actuaries-code/blob/main/notebooks/ch16.ipynb ### Chapter 17: Deploying and Governing Agentic AI in Practice https://aiforactuaries.sssia.org/code/ch17 Governance in production: a monitoring dashboard that scores each agent against the firm's threshold registry, and a governance agent that reads the dashboard and escalates. - 01_monitoring_dashboard.py: Scores agents against thresholds: one nominal run, one tripped incident. (runs in the browser) - 02_governance_agent.py: Reads the dashboard output and decides whether to escalate. (runs live on the server) Builds: Quiet degradation: the drift failure that triggers no alarm; Reliability engineering: retries, circuit breakers, fallbacks, graceful degradation; Testing non-deterministic systems: unit, integration, statistical, and adversarial; Human-in-the-loop checkpoints designed around what the reviewer must verify; Monitoring latency, error rates, step counts, tool failures, tokens, and quality; Converging governance from the ASB, IFoA, IAA, and CAS, applied proportionately; Change management: deployments that succeed technically and fail organisationally. Colab: https://colab.research.google.com/github/RohanYashraj/agentic-ai-for-actuaries-code/blob/main/notebooks/ch17.ipynb ## Datasets https://aiforactuaries.sssia.org/data - meridian_motor_india_triangle.csv: Motor India paid and reported loss triangle, accident years 2018 to 2023, development 12 to 72 months, cumulative USD. Four defects are seeded for the data-quality agent to find. Used by chapter 9. - meridian_motor_india_triangle_clean.csv: The same triangle without the seeded defects, for the reserving workflows. Used by chapter 11, chapter 14. - ialm_2012_14_ulp.csv: A Gompertz-shaped synthetic mortality table with the structure of IALM 2012-14 ULP: ages 18 to 99, by gender and smoker status. Not the real table; do not use it for real work. Used by chapter 10. - internal_loss_db.csv: Sixty comparable commercial property accounts with total insured value, premium and five-year incurred losses, for underwriting benchmarks. Used by chapter 13. - submissions/MR-CHI-2025-Q3-018.pdf: A synthetic broker submission for a Chicago commercial property risk, read by the COPE extraction tool. Used by chapter 13. - term_life_india_policies.csv: Five hundred term life policies: age at entry, sum assured in INR, term, premium frequency, smoker status, lapse indicator. Used by no chapter script (generated for completeness). - xs_reports/fy2024/*.txt: Three quarterly experience-study notes for term life India, the archive the Chapter 12 vector-knowledge agent indexes. Used by chapter 12. - uk_annuity_members.csv: Three hundred UK annuity members: date of birth, annual pension in GBP, commencement date, level or escalating, dependant indicator. Used by chapter 15. - capital_snapshots.json: Two capital-model snapshots, FY2025 Q1 and Q2, with six SCR modules and the parameter versions behind each. Used by chapter 16. - metrics_registry.json: Monitoring thresholds and seven-day metrics for two deployed agents: tool error rate, tool calls per run, p95 latency, escalation rate, schema failures, cost per run. Used by chapter 17. ## Setup https://aiforactuaries.sssia.org/setup Colab: one notebook per chapter, add GOOGLE_API_KEY as a Colab secret. Local: uv sync, cp .env.example .env, uv run --env-file ../.env python