Architecture
Eight layers, each one running on this page.
Nothing here is a diagram of an intention. Run the retrieval probe and watch the corpus answer on meaning rather than keywords. Read the memory the desk is carrying into your next question. Attempt a tool your role does not hold and watch the boundary refuse it before anything is called. Run the regression suite and see the graph scored like code.
01 · Context
Context engineering
Facts, recent determinations and the dialogue tail are compressed into a bounded preamble instead of a growing transcript, so cost per turn stays flat as a thread ages.
02 · Retrieval
Vector RAG with a corrective loop
The corpus is embedded once and searched by cosine similarity; a grader scores what came back, rewrites the query, and escalates to the external index before any draft is written.
03 · Reasoning
Multi-agent graph
A coordinator routes to a retriever, grader, rewriter, filing drafter and quality agent. Each node is a streamed prompt-to-model chain, checkpointed so a failed run resumes at the span.
04 · Memory
Three-tier agent memory
Working turns, episodic run outcomes and durable semantic facts, persisted per thread and replayed into the next question.
05 · Tools
Scoped tool boundary
Every external system is declared with a scope, an auth mode and a side-effect class. Deny by default; mutating tools additionally hold for a human approval token.
06 · Evaluation
Regression gate
The suite asserts on the structured filing packet — route, forms, citations, quality gate, latency budget — so a behavioural regression fails a case, not a vibe check.
07 · Operations
Observability and governance
Span-level latency, tokens and cost on every run, tracing to the managed project, and an append-only tool ledger a supervisor can read.
08 · Surface
Prediction, not reporting
Every desk opens with a forecast and the action that improves it. Open the prediction surface.
Retrieval — semantic, with a deterministic fallback
The corpus is embedded once per process and searched by meaning; if the embeddings endpoint is unreachable the same query is answered lexically rather than left ungrounded.
Agent memory — 0 facts · 0 runs · 0 turns
Semantic facts
Set an entity and a corridor on the prediction surface — the desk remembers them.
Episodic runs
- Runs from the agent graph land here and are replayed into the next question.
Compiled context sent to the model
empty — nothing to carry forward yet
Secure tool connections — role “guest”, deny by default
| Tool | Server / transport | Scope | Auth | Effect | Egress | |
|---|---|---|---|---|---|---|
| fx.rate | corpvidesh.fx · http | fx.read | none (public feed) | read | None — currency codes only leave the rail. | |
| market.quote | corpvidesh.markets · http | market.read | none (public feed) | read | None — index symbols only. | |
| statute.search | corpvidesh.corpus · in-process | corpus.read | session bearer | read | None — the corpus never leaves the process. | |
| ledger.read | corpvidesh.ledger · mcp/http | ledger.read | session bearer | read | Case metadata stays inside the tenant boundary. | |
| ledger.stamp | corpvidesh.ledger · mcp/http | ledger.write | service credential | write | Hash-chained entry; payload hashed, not copied. | |
| filing.submit | corpvidesh.filing · mcp/http | filing.submit | officer step-up | irreversible | Form 15CA/15CB payload to the statutory endpoint. |
Try a tool your role does not hold — the boundary refuses before anything is called, and the attempt is written to the append-only tool ledger.
Evaluation and managed deployment
Managed deployment — LangGraph Platform
graph “statutory” · langgraph.json
Runtime
LangGraph Platform — managed task queue, Postgres checkpointer, horizontal autoscale
Scaling
Queue-backed workers scale on pending-run depth; long statutory drafts run as background runs and stream tokens back to the desk
Persistence
Thread-scoped checkpoints after every node, so a run resumes at the failed span rather than from intake
Observability
LangSmith project tracing on every managed run; the same spans render in the desk trace console
Published assistants on the deployment
Statutory determination
asst_statutory_full
Full run: coordinate, retrieve, grade, draft the filing packet, quality-check every citation.
recursion_limit 24 · streaming on · corrective retries 2
Corrective retrieval probe
asst_retrieval_only
Retriever + grader + rewriter only — used to test the corpus without spending draft tokens.
interrupt_after ['grader'] · streaming on
Filing QA gate
asst_qa_gate
Re-runs the quality agent against an existing draft before a filing leaves the desk.
entry ['qa'] · deterministic temperature 0
The factory at src/lib/agents/platform-graph.server.ts:makeDeployedGraph is the same builder the desk runs in-process, so a managed run and a desk run execute an identical topology.
Graph regression suite — 4 cases against the deployed graph
Not run in this session
Qwen · reasoning
Statutory reasoning model reads the rule and the filing together, and writes the conclusion with the rule quoted.
LangChain · orchestration
Chains the retrieval, tool calls and checks in a fixed order so every filing is examined the same way.
Alibaba Cloud · compute
Runs the heavy document and screening workloads in an India-resident region.
Federated ledger
Each result is hash-chained into a block every regulator node holds a copy of.
Human desk
A named officer signs this off. The machine only prepares the file.