SARATHI - 20 Specialized AI Agent for Research
AI Tool Basics for CA

SARATHI - 20 Specialized AI Agent for Research

Author : CA. Himanshu Majithiya

Watch on Youtube
  1. What is Sarathi?



Sarathi is a web-based, agentic-AI platform purpose-built for Chartered Accountancy firms in India. It amplifies the professional judgment of a CA — it does not replace it. A CA submits a matter in plain language; Sarathi routes it through a multi-agent AI pipeline that researches the relevant law across all tax and regulatory domains, verifies citations, grades risk, and produces a structured, firm-branded advisory report. The CA reviews and approves every report before it is final.


CA Advisory Ecosystem
  1. GST (CGST / IGST / Cess)
  2. Income Tax (Act 2025 / 1961)
  3. TDS / TCS
  4. Company Law (MCA)
  5. FEMA / RBI
  6. Audit & Compliance (SA / CARO / 3CD)
AI Automation Consultancy
  1. L1 — Existing Software (Tally, Zoho, Gen)
  2. L2 — Google Workspace / Apps Script
  3. L3 — No-Code (Zapier, Make, n8n)
  4. L4 — API Integration
  5. L5 — Custom Software
  6. L6 — AI Agent Solutions


2. How Sarathi Helps a Chartered Accountant



Every CA firm faces the same constraint: advisory quality is bounded by research time. Sarathi eliminates that constraint — giving every CA firm a research team that is built in, always on, and never missing a circular.


Challenge Faced by CA FirmsHow Sarathi Resolves It
Keeping up with daily CBIC / CBDT / MCA / RBI circularsAutomated crawlers run every morning; new circulars are queued for CA approval and compiled into the knowledge base automatically
Missing cross-domain implications (e.g. GST + Income Tax interaction)Cross-Domain Scanner scores all 6 practice areas for every query — no implication is overlooked
Risk of citing outdated or superseded provisionsWiki tracks effective dates; agents always serve the provision valid on the date of the matter
Time spent drafting advisory reports13-section structured report generated in firm voice; CA reviews and approves in minutes
Hallucinated or unverifiable legal referencesCitation Verifier + Hallucination Checker validate every claim against the KB before the report reaches the CA
Client PII risk in AI tools8 structured identifiers (PAN, GSTIN, Aadhaar, etc.) masked before any LLM call; embeddings run fully on-premise — no client data leaves the firm's server
Automation decisions made without expert guidanceL1→L6 hierarchy recommends the lowest viable automation level with ROI analysis and a step-by-step SOP
No partial or unsigned advisoryHard-stop policy: pipeline blocks if any agent fails; CA signs off every report before it is final


3. Solution Architecture



Sarathi is built on a layered architecture. Each layer is purpose-designed for compliance with Indian CA professional ethics and the DPDP Act 2023.


LayerComponentRole
FrontendReact 19 + TypeScript + Vite + Tailwind CSSBrowser / mobile UI — submit queries, review reports, manage KB
Backend APIDjango 4.2 + Django REST Framework + JWTAuthentication, role enforcement, audit logging, all business logic
AI OrchestrationLangGraph stateful graphsRuns the 12-step CA Advisory and 6-step Automation pipelines asynchronously
Retrieval — T0Compiled LLM Wiki (pgvector)Highest priority: date-aware, interlinked knowledge pages compiled by WIKI-COMPILE-01
Retrieval — T1Vector KB — pgvector (BAAI/BGE-large)Semantic search over all approved, chunked source documents
Retrieval — T2Official APIs / RSS (CBIC, CBDT, MCA, RBI)Live fallback from official government sources; cached 4 hours
Retrieval — T3CA-managed web search (curated site list)Last-resort scrape of P1→P3 priority trusted sites; cached 4 hours
Async WorkCelery + Redis + Celery BeatAll pipelines, crawlers, wiki compilation and lint run as background tasks
Data StorePostgreSQL 16 + pgvectorAll application data, vector indexes, audit logs; soft deletes for traceability
Report OutputJinja2 + WeasyPrint + python-docxPDF and DOCX advisory reports with firm branding
EmbeddingsBAAI/bge-large-en-v1.5 (local)Self-hosted on server — no text sent to external embedding API
SecurityFernet encryption + PII masking + Audit LogAppSetting secrets encrypted; 8 identifiers masked before every LLM call; full immutable audit trail


4. Technology Stack



CategoryTechnology / Tool
Backend FrameworkPython · Django 4.2 · Django REST Framework
AuthenticationJWT (SimpleJWT) — access + refresh tokens
Async / SchedulingCelery + Redis (broker) · Celery Beat (cron jobs)
AI OrchestrationLangGraph (stateful multi-agent graphs)
LLMs (via OpenRouter)Claude Sonnet 4.5 (primary) · Claude Haiku 4.5 (economy) · Gemini 3.5 Flash (research)
EmbeddingsBAAI/bge-large-en-v1.5 (1024-d, default) · law-ai/InLegalBERT (768-d) — fully self-hosted
Vector SearchPostgreSQL 16 + pgvector (IVFFlat cosine); SQLite + Python-cosine (dev)
NER (PII Names / Addresses)dslim/bert-base-NER — lazy singleton, fail-closed
Document ParsingPyMuPDF (PDF) · BeautifulSoup4 (HTML) · python-docx · tiktoken (512 tokens / 50 overlap)
Report GenerationJinja2 (templating) · WeasyPrint 62.3 (PDF) · python-docx (DOCX)
FrontendReact 19 + TypeScript · Vite · Tailwind CSS · TanStack Query · React Router · Radix UI · Recharts
SecurityFernet/cryptography (encrypted AppSettings + mask_map) · soft deletes · full audit log
OCRTesseract 5.3.4
Crawler FallbackPlaywright + Chromium
InfrastructureContabo Asia VPS, Mumbai · Ubuntu 24.04.3 LTS · Nginx · Gunicorn (gthread) · Let’s Encrypt SSL
Version ControlGitHub


5. AI Agents



Sarathi deploys 20 specialised AI agents across its two pipelines. Every agent prompt is editable at runtime by a CA in Settings → Prompts & Voice — no code deployment required.


5.1 CA Advisory Pipeline — 12 Steps


Agent IDRoleModel
CA-GST-01GST research — CGST/IGST, ITC, returns, RCM, refundsClaude Sonnet
CA-GST-02Advanced GST — litigation, AAR/AAAR, anti-profiteeringClaude Sonnet
CA-IT-01Income Tax — primary advisory (Act 2025 / 1961)Claude Sonnet
CA-IT-02TDS/TCS specialist — withholding, transfer pricing, DTAAClaude Sonnet
CA-FEMA-01FEMA / RBI — FDI, ODI, ECB, NRI, compoundingClaude Sonnet
CA-AUDIT-01Audit & Compliance — SA standards, 3CD, CARO 2020, NFRAClaude Sonnet
RES-CASE-01Case-law research — SC, HC, ITAT, AAR (large context)Gemini Flash
RES-CIRC-01Circulars & notifications — CBIC, CBDT, MCA, RBIClaude Haiku
RES-ACT-01Bare-act provisions — exact section / rule textClaude Haiku
INTAKE-01Intake parser — domain, entities, amounts, clarification checkClaude Haiku
QA-XDOMAIN-01Cross-domain scanner — scores all 6 domains High / Low / NoneClaude Sonnet
QA-VALID-01Hallucination checker — validates claims against citationsClaude Haiku
REPORT-ARCH-01Report architect — synthesises 13-section advisory outlineClaude Sonnet
VO-STYLE-01Voice & style — rewrites report in firm’s professional voiceClaude Sonnet
WIKI-COMPILE-01Wiki compiler — compiles approved sources into interlinked pagesClaude Sonnet


5.2 Automation Consultancy Pipeline — 6 Steps


Agent IDRoleModel
AUTO-ARCH-01Automation architect — L1→L6 recommendation with specific toolsClaude Sonnet
AUTO-ROI-01ROI analyser — cost / saving / payback calibrated to Indian CA firm economicsClaude Sonnet
AUTO-SOP-01SOP generator — phase-by-phase implementation guideClaude Sonnet
AUTO-WRITER-01Report writer — plain-language automation roadmap for clientClaude Sonnet
AUTO-PARSE-01Problem parser — extracts structured problem from queryClaude Haiku


6. Privacy & PII Masking



Client confidentiality is the foundation of CA professional ethics. Sarathi enforces privacy at the architecture level. Before any text reaches an LLM, 8 structured identifiers are detected and replaced with stable placeholders (e.g. “<PAN_1>”). The same raw value maps to the same placeholder within one call, preserving reasoning without ever exposing the identifier. Patterns are applied longest-first to prevent mis-masking. Free-text names and addresses are handled by an on-premise NER model (dslim/bert-base-NER).


#IdentifierWhat It IsDetection Pattern
1CINCorporate Identification Number (MCA, 21 chars)[LU]\d{5}[A-Z]{2}\d{4}[A-Z]{3}\d{6}
2GSTINGST Identification Number (15 chars)\d{2}[A-Z]{5}\d{4}[A-Z]\d[Z][0-9A-Z]
3TANTax Deduction Account Number (10 chars)[A-Z]{4}\d{5}[A-Z]
4PANPermanent Account Number (10 chars)[A-Z]{5}\d{4}[A-Z]
5Aadhaar12-digit UIDAI identity number\d{4}[\s-]?\d{4}[\s-]?\d{4}
6EmailEmail address[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}
7PhoneIndian mobile number (optional +91, 10 digits)(?:\+?91[\s-]?)?[6-9]\d{4}[\s-]?\d{5}
8Bank AccountBank account number (11–18 consecutive digits)\d{11,18}


7. Knowledge Lifecycle — KB to Wiki



Sarathi's knowledge compounds over time. Every approved source goes through a governed lifecycle before agents can use it.


StageWhat HappensWho Acts
1. DiscoverDaily crawlers (CBIC, CBDT, MCA, RBI, ICAI, Indian Kanoon) + CA watched URLs + manual uploads + auto-queued web hitsSystem (automated)
2. ApprovePending items appear in KB Review grouped by urgency (Immediate / Routine / Reference). CA approves or rejects.CA (human gate)
3. IngestDownload → extract text → chunk (512 tokens / 50 overlap via tiktoken) → embed locally (BGE-large) → store as KnowledgeChunk + pgvectorSystem (automated)
4. CompileWIKI-COMPILE-01 converts each source into interlinked Entity / Concept / Procedure wiki pages (DRAFT)System (automated)
5. PublishCA reviews draft pages; resolves conflicts; publishes. Amendments recorded as dated supersessions — old and new provisions remain valid for their own date range.CA (human gate)
6. ServePublished pages served as Tier T0 (highest priority); KB chunks as T1. All date-aware and citable.System (automated)


8. Scheduled Background Jobs



All scheduled jobs run via Celery Beat (times in IST). They require Celery worker + beat processes to be running on the server.


Time (IST)JobPurpose
06:00 dailycrawl_cbicCBIC GST circulars & notifications
06:10 dailycrawl_cbdtCBDT Income-Tax circulars
06:20 dailycrawl_mcaMCA Company-Law circulars
06:30 dailycrawl_rbiRBI / FEMA notifications
06:40 Mon & Thucrawl_icaiICAI announcements
06:50 Suncrawl_indiankanoonIndian Kanoon judgments
07:00 dailycrawl_kb_source_urlsRe-check CA ‘watched’ source URLs
07:30 weeklylint_wikiWiki health check — broken links, stale pages, orphans, conflicts
08:00 dailysend_kb_digestEmail digest of pending KB approval items
09:00 dailycheck_llm_cost_alertAlert if per-query cost > ₹50 or daily total > ₹500


9. Security & Governance



ControlImplementation
AuthenticationJWT (access + refresh tokens); silent single-flight refresh on expiry
AuthorisationCA vs STAFF roles enforced server-side; CA-only actions return HTTP 403 for STAFF
PII Masking8 structured identifiers masked before every LLM call; NER handles free-text names/addresses; mask_map Fernet-encrypted, never sent to browser
Embeddings PrivacySelf-hosted BAAI/BGE-large on server — no text sent to external embedding API
Secrets EncryptionIntegration credentials (API keys) encrypted at rest via Fernet; entered from UI, override server .env
Audit TrailEvery sensitive action written to immutable AuditLog (who, what, when, IP)
Human-in-the-LoopThree CA gates: knowledge approval, wiki publication, report sign-off
Hard-Stop PolicyPipeline halts if any required agent fails; no partial advisory delivered; CA retries or overrides
Data RetentionAll records are soft-deleted (never silently destroyed); full traceability and recovery
DPDP Act 2023On-premise processing, minimal data exposure, and audit trail support DPDP compliance posture
ICAI EthicsCA controls every knowledge gate; AI provides research; professional responsibility remains with CA


10. End-to-End Use Cases



Use Case A — GST Advisory Query

A CA asks: “Can we claim ITC on a Honda City for our FFMC business?” Sarathi parses the query, finds ITC eligibility is the core issue, scores all 6 domains (GST: High, IT: Low for depreciation impact, others: None), runs the GST and IT agents in parallel, verifies citations against the KB, grades the risk, and synthesises a 13-section advisory in the firm’s voice. The CA reviews the report in the Reports screen and approves it — with quantified INR exposure, the exact interest section and rate, related blocked credits under Section 17(5)(ab), and a GSTR-3B reversal mechanic.


Use Case B — Keeping Knowledge Current

The CBIC crawler runs at 06:00, finds a new circular, and queues it in KB Review. The CA approves it. Sarathi ingests and chunks the document, embeds it locally, and auto-compiles it into DRAFT wiki pages. Because the circular amends a rate from a specific date, it is recorded as a supersession — the old page governs matters before that date, the new one after. The CA publishes the pages; agents immediately use the updated position.


Use Case C — Automation Consultancy

A CA’s client asks how to automate their monthly GST reconciliation. Sarathi’s AUTO-ARCH-01 evaluates L1→L6 in order and recommends L3 (n8n workflow connecting Tally export to a reconciliation sheet) because the client already uses Tally and the logic is rule-based. AUTO-ROI-01 computes payback in months using Indian CA firm staff cost benchmarks. AUTO-SOP-01 produces a phase-by-phase guide. The CA reviews and approves the roadmap report.