<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Satoshi Imai on Medium]]></title>
        <description><![CDATA[Stories by Satoshi Imai on Medium]]></description>
        <link>https://medium.com/@simai?source=rss-91f3a4d01e17------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4JSiXzUxe8-Dcn6OotCFaw.jpeg</url>
            <title>Stories by Satoshi Imai on Medium</title>
            <link>https://medium.com/@simai?source=rss-91f3a4d01e17------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 23:06:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@simai/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ContractOps: A Serverless Multi-Agent System for Contract Operations]]></title>
            <link>https://techblog.finatext.com/contractops-a-serverless-multi-agent-system-for-contract-operations-08c167e9dada?source=rss-91f3a4d01e17------2</link>
            <guid isPermaLink="false">https://medium.com/p/08c167e9dada</guid>
            <category><![CDATA[preprints]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[ai-agents-in-action]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Satoshi Imai]]></dc:creator>
            <pubDate>Mon, 22 Jun 2026 07:24:36 GMT</pubDate>
            <atom:updated>2026-06-22T07:24:36.293Z</atom:updated>
            <content:encoded><![CDATA[<p>By <a href="https://github.com/SatoshiImai">Satoshi Imai</a>; Finatext Ltd.</p><p><em>What I set out to support, how I built it on AWS, and the architectural philosophy that emerged along the way.</em></p><h3>Contracts are living things</h3><p>It’s tempting to think of a contract as something you sign once and file away. In practice, a contract is alive. It gets amended. Deadlines shift. New people join the project and need to get up to speed. Renewal windows open and close. Across the whole lifecycle, the people who need to act on a contract — in sales, in finance, in the legal team that supports them — all need to be looking at the <em>same, current</em> picture.</p><p>And that’s genuinely hard work. Not because anyone is doing anything wrong, but because it’s an inherent coordination challenge of the domain. The more an organization grows, the more contracts and stakeholders it has, and the more effort it takes to keep everyone aligned on the latest state of each one. This is true for any company and its partners alike — it’s just the nature of contract lifecycle management.</p><p>So here’s a nice thought to build toward: <em>what if the current state of every contract — its terms, its upcoming milestones, the status of what’s in flight — were something everyone involved could see, the same way, whenever they needed to?</em> That kind of shared, always-fresh picture is exactly what lets both sides of a deal fulfill their contracts smoothly and with confidence. Less time spent chasing status, more time spent on the relationship.</p><p>That’s what I built <strong>ContractOps</strong> to support. Not with a single clever prompt, but with a deliberate, down-to-earth architecture. This article is a tour of how I built it — on AWS, fully serverless — and the design philosophy I kept returning to at every turn.</p><h3>What ContractOps actually is</h3><p>Since this article is meant to be the canonical description of the system, let me draw the boundaries clearly before the tour begins.</p><p>ContractOps is a multi-agent system that <strong>supports Legal Operations</strong> — the contract and billing administration that a company’s sales and finance teams carry out, with the backing of the legal department. It is deliberately <strong>not</strong> a system that renders legal judgments or performs legal work on its own. The work the AI does is bounded and concrete:</p><ul><li>it structures, indexes, searches, and keeps watch over contract-related information,</li><li>it assists with drafting (producing first drafts and edits for people to review),</li><li>and it prepares the groundwork so a human can reach a decision faster.</li></ul><p><strong>The final judgment always belongs to a human</strong> — and, for anything carrying legal weight, to the legal team or a qualified professional. Human-in-the-loop isn’t a feature I bolted on at the end; as you’ll see, it’s wired into the data model itself.</p><p>The system is a small pantheon of single-purpose agents, named after Greek deities — less for flair than because a good name makes a responsibility easy to remember. What matters here is that they fall into three layers:</p><ul><li><strong>The people-facing layer.</strong> <strong>Themis</strong> is the Slack-native assistant people actually talk to — search, analysis, Q&amp;A, and draft assistance — turning information that’s normally scattered across places into something you can simply <em>ask about</em>. <strong>Iris</strong> is the gateway in front of it, validating incoming Slack events and routing them by domain.</li><li><strong>The monitoring layer.</strong> A small fleet — <strong>Argus</strong>, <strong>Chronos</strong>, and <strong>Cassandra</strong> — that keeps the shared picture fresh, each from its own angle. (They’re the stars of Decision 7, so I’ll save the detail.)</li><li><strong>The knowledge layer.</strong> Behind both runs a data pipeline of specialist agents I call the <strong>Scribes</strong> — the ones who turn raw documents into trustworthy, structured knowledge. You’ll meet them by name on the tour, exactly where their work comes up.</li></ul><p>One thing holds for every agent in the system: it <em>reconciles facts, structures information, and notifies.</em> None of them makes a legal call. Chronos can say “this milestone is coming up”; it never decides what should be done about it. That decision is a person’s.</p><p>The substrate is <strong>fully serverless on AWS</strong>: AWS Lambda for compute, Amazon DynamoDB for state, Amazon Bedrock (Claude Sonnet 4.5) for inference, Amazon EventBridge for scheduling, Amazon S3 for intermediate artifacts — with Slack and Google Workspace integration at the edges. <strong>There is no external message queue.</strong> That omission turns out to be a feature, not a gap, and I’ll get to why.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*01KHDm2z4Pjtu2fuxNhFYQ.png" /><figcaption>ContractOps system architecture (AWS + GCP)</figcaption></figure><p><em>ContractOps at a glance: a fleet of single-purpose Lambda agents over a DynamoDB single source of truth, with model inference kept inside the AWS boundary.</em></p><p>Now, the tour. Each stop is a design decision, framed the way I actually faced it: a problem anyone building serious LLM agents will hit, the call I made, and what it cost.</p><h3>A principle that kept coming back</h3><p>Before the specifics, one idea connects all of them, so let me name it.</p><p>An LLM is a <em>probabilistic reasoning engine</em>. The physical data layer — file hierarchies, spreadsheet coordinates like A1:Z45, raw database schemas — is <em>deterministic structure</em>. When you let the two touch directly, the model ends up spending its reasoning on the wrong job: guessing where data lives and how to address it, instead of thinking about your actual question.</p><p>The fix isn’t novel. It’s a <em>return</em> to principles software engineering settled decades ago — encapsulation, separation of concerns, the <strong>Information Expert</strong> principle (give a responsibility to the component that actually has the knowledge to fulfill it). Business logic was never asked to understand the physical layout of a database; the industry put a data-access layer in between. An LLM deserves the same courtesy.</p><p>The further I went, the more this hardened into a full architectural paradigm, which I’ve since written up as a preprint — <a href="https://doi.org/10.5281/zenodo.20741063"><em>[</em>The Survey-Sonar-Pickup (SSP) Paradigm: Redefining Responsibility Boundaries Between LLMs and Physical Data Layer<em>]</em></a>. You don’t need the theory to follow this article; you need the decisions it produced. Here they are.</p><h3>Decision 1 — Don’t send the model exploring. Hand it a menu, not a map.</h3><p><strong>The universal problem.</strong> The seductive shortcut in agent design is to grant the model broad access — “here’s read access to the database, go find what you need” — and trust its reasoning for the rest. Modern models are good enough to <em>attempt</em> this, which is exactly the trap. With no map, the agent resorts to trial and error: guessing table names, guessing column meanings, generating speculative queries. Tokens evaporate, the context window chokes on its own speculative garbage, and your system collapses into a spectacular, expensive hallucination loop.</p><p><strong>The approach.</strong> Revoke the model’s right to free exploration. Instead of accepting open-ended search against the physical layer, the tool presents a <strong>closed menu of logical options</strong> — semantic IDs plus just enough metadata to choose between them. The model’s job collapses from open-ended <em>generation</em> (“write a query to find X”) into bounded <em>selection</em> (“pick from these”). Hallucination has nowhere to go, because every option on the menu provably exists.</p><p><strong>The trade-off.</strong> The moment you take away free exploration, you owe the model <strong>completeness</strong>. The menu must exhaustively cover what’s actually there — a candidate missing from the list is one the model can never know to ask for. Drilling down a hierarchy is fine (folders, then files within a chosen folder). Forcing the model to page sideways through “next page, next page” because one response was scoped too narrowly is not.</p><h3>Decision 2 — Pay the comprehension tax up front, not at runtime.</h3><p><strong>The universal problem.</strong> Chatbot-era design is poisoned by the Zero-Latency Dogma — the absurd belief that a tool must answer in a second or two or it has failed. But genuinely understanding enterprise documents is <em>expensive</em>. A scanned contract needs OCR and layout reasoning. A richly formatted spreadsheet can encode meaning in cell colors and borders. Done properly, that takes real time — so, under pressure to respond instantly, tools skip the hard part and return whatever flat text they can grab in the moment. That’s how meaning gets dropped before the model ever sees it, with nothing to signal the loss.</p><p><strong>The approach.</strong> Move the heavy structural work <strong>off the runtime path entirely</strong> and do it asynchronously, ahead of time. In ContractOps, an upfront ETL pipeline absorbs the physical noise <em>before</em> the model is ever involved. Whether the source is a clean digital PDF or a skewed paper scan, the Scribes homogenize it into one rigorous semantic tree — articles, sections, items — expressed as structured Markdown. The model never spends a token interpolating a smudged character or guessing at a layout. The LLM works here too, but as the <em>eyes of a deterministic ETL process</em>, not as a live explorer.</p><p>The payoff: by query time, the data is already <em>known territory</em>. The latency-versus-completeness dilemma that feels impossible at runtime simply dissolves, because the cost was paid in advance.</p><p><strong>The trade-off.</strong> It looks like you’re trading away instant freshness on brand-new data — but that’s an illusion. The “instant” alternative only ever handed the model impoverished flat text, so there was never any <em>real</em> freshness to lose. And data that genuinely is brand-new — dropped in mid-conversation — gets its own runtime path (Decision 5). The one honest cost is the engineering effort up front: the pipeline has to be designed and maintained. In return, the model can’t be caught off guard by structure that nobody mapped.</p><p><strong>On AWS.</strong> This is a textbook serverless ETL. EventBridge fires on a schedule → Clio (a lightweight Lambda) routes the work → Metis dispatches each document to Theia (vision OCR) or Eunomia (text structuring), both calling Bedrock → intermediate Markdown lands in S3 → structured results land in DynamoDB. Heavy, binary-dependent steps run in container-based Lambdas; everything else ships as a slim ZIP. Idle cost is essentially nothing, because nothing runs when nothing needs to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7qnPYGbuvoG4jY0r2jdRhg.png" /><figcaption>Clio data pipeline: AllocationMap → contract analysis</figcaption></figure><p><em>The pre-runtime comprehension pipeline. Physical noise is absorbed asynchronously and turned into structured, queryable knowledge before any agent asks a question.</em></p><h3>Decision 3 — Split “finding” from “fetching” at the storage layer.</h3><p><strong>The universal problem.</strong> Suppose your data is already beautifully structured. You drop it into one searchable store and let the agent query it. The first hit comes back — and drags a 40-page contract along with it, because the store doesn’t distinguish “the thing you searched for” from “the entire payload of that thing.” A couple of hits like that and the context window is gone. One careless search, total collapse.</p><p><strong>The approach.</strong> Separate the <em>act of finding</em> from the <em>act of fetching</em>, physically, into two stores with two jobs:</p><ul><li>A <strong>search index</strong> (the ContractOps table) holds only ultralight metadata — parties, execution dates, status, contract type. The agent scans <em>this</em> to grasp the landscape, with near-zero pressure on the context window.</li><li>An <strong>extraction store</strong> (the ContractCodex table) holds the actual payloads — the structured clauses themselves.</li></ul><p>The flow becomes deterministic: the agent reviews the lightweight menu, picks a document ID and a clause key, and only then fetches exactly those clauses by ID. What used to be an uncertain similarity search across a giant text blob becomes a precise, two-step API call. Searching and reading are no longer the same operation, so reading can never accidentally flood the model.</p><p><strong>On AWS.</strong> Both stores live in DynamoDB under a single-table design, but their responsibilities are cleaved apart by purpose-built tables and secondary indexes — operational metadata indexed for the “find” path, contract knowledge partitioned for the “fetch” path. Same database technology; deliberately different access surfaces.</p><h3>Decision 4 — Don’t hide what you can’t fully trust. Make trust a column.</h3><p><strong>The universal problem.</strong> AI-extracted data leaves you with two bad options. Trust it uncritically, and an OCR misread can propagate downstream unnoticed. Or gate every extracted clause behind human review before anyone can use it — honest, but it doesn’t scale.</p><p><strong>The approach.</strong> A third path: don’t block the data, <strong>grade it.</strong> A dedicated auditor agent, <strong>Dike</strong>, runs as the last step of the ETL pipeline — long before any model does semantic reasoning. It deterministically cross-checks the structured output against the raw text (using techniques like SHA-256 hashing), marks the indisputable matches as trusted, and marks anything with detected drift as <em>requires verification</em>. Crucially, it <strong>does not remove</strong> the uncertain data. Everything stays searchable; only its <strong>trustworthiness becomes explicit metadata</strong> — a “trust boundary” baked right into the schema.</p><p>This is what it means to treat the AI’s own output with <strong>zero trust</strong>. Neither the model nor a person ever has to take a clause on faith. They can see, per item, exactly where automation can be relied upon and exactly where a human should look.</p><p>And <em>this is where Human-in-the-loop actually lives.</em> It isn’t an abstract principle — it’s a flag in a table that says, for each piece of data, “from here, a person decides.” For a Legal Operations tool, that line — drawn by the system, in data, between what’s safely automated and what a person (and where appropriate, the legal team) should review — is the whole point.</p><p><strong>The trade-off.</strong> The cost is a deterministic audit pass over every clause, paid up front — and it’s a bargain. In return you get two things at once. You structurally prevent the kind of undetected error that no after-the-fact warning can ever catch; and every output now carries an explicit, machine-readable trust boundary. A risk that used to be unknowable — contamination that raises no error of its own — becomes a known, bounded property of the data that humans and agents alike can act on.</p><h3>Decision 5 — Match the pattern to the nature of the data. Reject the universal solution.</h3><p>This is the heart of the tour. Not all data is the same shape, and the single biggest architectural mistake is pretending it is — trying to serve everything through one generic file-reading tool. ContractOps recognizes <strong>three fundamentally different kinds of data</strong> and applies a different decomposition to each.</p><p><strong>A. Settled data — already in the system.</strong> Past, executed contracts that have been through the ETL pipeline. The comprehension was done up front, so the runtime tooling is lean: scan the lightweight index, then fetch by ID. This is the world of Decisions 2–4.</p><p><strong>B. Just-arrived data — handed over in the moment.</strong> A draft a user just dropped into the chat; a working spreadsheet that didn’t exist five minutes ago. There’s no pre-processing something you’ve never seen, so here the parsing <em>does</em> happen at runtime — but carefully. A heavyweight, isolated tool reconstructs the document into structured Markdown via vision reasoning, then returns just the <strong>list of section headers</strong> — a table of contents that doubles as a schema. The moment those headers exist, the model is no longer wandering an unknown document; it’s choosing from a map. It then issues one of two deterministic requests: fetch a whole section, or pull only the blocks matching a condition. The tool runs the repetitive search internally and answers in one shot — <strong>declarative extraction</strong>, instead of the model groping item by item.</p><p><strong>C. Opaque external data — out in the wild</strong> (think an untamed Google Drive: folders of mixed PDFs, scans, and docs nobody curated). Files scattered across storage you don’t control and can’t pre-index, where the search API hands you discovery and filtering as a single inseparable operation. Here I keep “finding” fused but force “fetching” to stay separate and <strong>lazy</strong> — never opening a file until the model has committed to it.</p><p>The point isn’t the taxonomy for its own sake. It’s the discipline: a tool is not a one-size-fits-all pipe. Choosing the decomposition that fits the data’s actual structure — its maturity, its time constraints, its opacity — is the design work that keeps the model out of trouble.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*auyvtRCrGS7pD_-Q63uw7g.png" /><figcaption>Themis &amp; supervisor agents flow (interactive + monitoring)</figcaption></figure><p><em>The interactive side: Themis reasons over pre-structured knowledge, while the supervisor agents watch the same source of truth from different angles.</em></p><h3>Decision 6 — Choose an honest limit over false confidence.</h3><p><strong>The universal problem.</strong> When the agent searches opaque external storage and hits a file it can’t parse — a legacy Office document, an unreadable image — the tempting design is to filter it out of the results. And even when no one decides this on purpose, simply wiring up generic tools tends to produce exactly that exclusion by default. Cleaner, right? Except now the agent sees nothing where something exists, concludes “no relevant information found,” and reports that with total confidence. A confident <strong>false negative</strong> — “that document doesn’t exist” when it very much does — is not just a bug; it is an architectural betrayal.</p><p><strong>The approach.</strong> Don’t hide the unprocessable. The search results include the file even if it can’t be opened. The block happens later, at fetch time, where the tool refuses the unsupported format <em>and says so</em>: “a relevant file exists here, but the system can’t process this format — please check the source directly.” The model stays fully aware the file exists, and instead of inventing an absence, it takes the honest path: it <strong>escalates to a person</strong> with a precise pointer.</p><p>This is the point that’s easy to get backwards. When the system honestly reports what it cannot read, it makes the <em>human’s</em> proper role possible: you go to the source and, where it matters, cleanse or contextualize that file by hand before handing it back. On honest information, that isn’t a workaround — it’s the legitimate division of labor between a person and a tool. <strong>Real collaboration is built on understood constraints, not on the pretense of unlimited capability.</strong></p><h3>Decision 7 — Govern by choreography, not by a conductor.</h3><p>This is the technical centerpiece, and it’s where the serverless substrate really earns its keep. It’s also where ContractOps does its most valuable supportive work: keeping the shared picture fresh.</p><p><strong>The universal problem.</strong> The default way to coordinate many agents is to appoint a central orchestrator and run everything through an external message queue. It works, but it buys you a single coordination point to keep alive, state duplicated between the queue and your database, and a whole category of distributed-systems bugs — most painfully, notifications that drop or double-fire with nothing to flag either. For supportive monitoring, where the entire value is <em>keeping everyone in sync</em>, a missed or duplicated notification is exactly what you can’t have.</p><p><strong>The approach, in three parts.</strong></p><p><strong>A. Choreography over orchestration.</strong> There is no conductor. The monitoring agents — <strong>Argus</strong> (contract changes), <strong>Chronos</strong> (deadlines and milestones), <strong>Cassandra</strong> (early warnings when activity looks likely to run against the terms) — are independent, each woken by its own EventBridge schedule or event. They never call a central brain. Instead, each watches the <em>same single source of truth</em> — the DynamoDB state — from its own angle. Good coordination emerges from several independent observers cross-checking one shared reality, the way a well-run team stays aligned precisely because more than one person is paying attention. This is also how the supportive jobs map cleanly onto the lifecycle: Argus helps the latest contract state reach the right people; Chronos surfaces milestones early enough to plan around; Cassandra raises an early warning when planned human activity looks likely to run against the schedule or the agreed terms.</p><p><strong>B. Pure-state idempotency, with no external queue.</strong> This is the part I’m proudest of. No SQS, no broker — just Lambda and DynamoDB. Coordination is achieved through <strong>DynamoDB conditional writes</strong> (optimistic concurrency) plus disciplined state management. Each agent, before it acts, checks the current state and skips if it isn’t what it expected. The result is a fully idempotent “singleton” flow whose design mantra is: <em>a notification is never missed and never duplicated.</em> Those are the two failure modes that plague every naive notifier, and they’re closed off purely through state, not queue plumbing.</p><p><strong>C. Self-healing on the assumption of undetected failure.</strong> Distributed systems fail in ways that raise no error, so the design assumes it. Every Scribe, whenever it runs, also sweeps for <em>stalled jobs</em> — anything stuck past a short threshold — and resets them to the start of the pipeline. I call it the <strong>Ride-Along Sweep</strong>: an agent’s ordinary execution doubles as a recovery pass for the stuck work of the <em>colleagues it collaborates with</em>, so a group of collaborators heals itself. Clio runs a full-fleet sweep on a daily schedule as a backstop. The pipeline doesn’t promise it never stumbles; it guarantees it never <em>stays down</em>.</p><p><strong>A boundary worth naming.</strong> Note precisely what these agents do: they reconcile facts and raise notifications. <em>They do not make legal calls.</em> The monitoring fleet hardens the <strong>factual groundwork</strong> that a person then judges — which is exactly the line a Legal Operations tool must hold.</p><p><strong>The trade-off.</strong> You accept eventual consistency and a little sweep latency. In return you get operational simplicity, low cost, and a kind of fault tolerance that a queue-centric design would charge you dearly for.</p><h3>Decision 8 — Keep secrets inside the boundary. Hold no keys.</h3><p>Contract information is confidential, which makes security its own design pillar — and another place the AWS foundation does heavy lifting.</p><p><strong>The universal problem.</strong> Two fears dominate: that confidential data slips out to a public service or an external AI through some unexpected egress, and that a static credential leaks and hands an attacker the keys.</p><p><strong>The approach.</strong></p><ul><li><strong>A private, enclosed boundary.</strong> Model inference (Bedrock) and the core retrieval stay <em>inside AWS</em>. Only the strictly necessary paths out — to Google Drive, to Slack — are opened, each behind a tightly scoped API. Unexpected egress is designed out, not merely monitored. Data is encrypted at rest with <strong>AWS KMS</strong>, and the handful of secrets that do exist live in <strong>AWS Secrets Manager</strong> — never in code or environment dumps.</li><li><strong>Keyless security via Workload Identity Federation.</strong> There are no static cloud credentials to leak, because there are none. Starting from an <strong>AWS IAM Role</strong>, the system federates into Google Cloud service accounts by exchanging short-lived tokens on demand — a multi-cloud privilege chain with nothing long-lived to steal.</li><li><strong>Dual service-account partitioning.</strong> The service account that parses documents and the one that searches are strictly separated, so least privilege is enforced at the infrastructure layer, not by convention.</li><li><strong>Layered Slack access control.</strong> Three gates in series: <strong>AWS WAF</strong> at the perimeter, Slack request-signature verification for authenticity, and a channel-ID allowlist for authorization — logically sealing the public endpoint down to specific channels only.</li></ul><p>The throughline is the same one running under every decision in this article: <strong>explicit limitation.</strong> A boundary you can name and enforce beats a capability you merely hope behaves.</p><h3>The philosophy underneath: autonomy through constraint</h3><p>Step back, and every decision rhymes. Each one <em>takes something away from the model</em> — the right to roam the physical layer, the burden of guessing at structure it was never told about, the temptation to answer when it shouldn’t — and hands that responsibility to a part of the system actually equipped to bear it. What’s left for the LLM is the thing it’s genuinely good at: reasoning over clean, trustworthy, bounded options.</p><p>That turned out to be a paradigm worth formalizing. The grand version of the idea — why these boundaries are not just convenient but <em>necessary</em>, and how to reason about them systematically — is laid out in a preprint I’ve written: <a href="https://doi.org/10.5281/zenodo.20741063"><strong>Survey–Sonar–Pickup (SSP)</strong></a>. ContractOps is its living proof, but the principles are meant to outlive any one system.</p><p>And the principle, in the end, is a humble one. Real autonomy — and real collaboration between people and AI — doesn’t come from dogmatically worshiping an LLM’s unconstrained capabilities. It comes from ruthlessly enforcing honest, structured boundaries, so the system knows its own limits and a person always holds the decisions that matter. For a tool that supports Legal Operations — work that belongs to people, backed by their legal team — that isn’t a compromise. It’s the entire point. It’s also what lets everyone involved, on both sides of a contract, get on with fulfilling it in confidence.</p><p><em>The architectural paradigm behind these decisions — Survey–Sonar–Pickup (SSP) — is described in a preprint: </em><a href="https://doi.org/10.5281/zenodo.20741063"><em>[</em>The Survey-Sonar-Pickup (SSP) Paradigm: Redefining Responsibility Boundaries Between LLMs and Physical Data Layer<em>]</em></a><em>. ContractOps runs fully serverless on AWS (Lambda, DynamoDB, Bedrock, EventBridge, S3). If you’re building agents that work with messy, high-stakes information, I hope a few of these boundaries are worth borrowing.</em></p><p><strong>Special Thanks:</strong> By the way, the awesome agent icons used throughout ContractOps (and in the architecture diagram here) were generated by Gemini (nano-banana). In the spirit of full transparency — and recognizing the irony of writing an entire article about strictly limiting AI, only to fully outsource the graphic design to it — huge thanks to the model for bringing these agents to life!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=08c167e9dada" width="1" height="1" alt=""><hr><p><a href="https://techblog.finatext.com/contractops-a-serverless-multi-agent-system-for-contract-operations-08c167e9dada">ContractOps: A Serverless Multi-Agent System for Contract Operations</a> was originally published in <a href="https://techblog.finatext.com/">The Finatext Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A model for data aggregation task]]></title>
            <link>https://techblog.finatext.com/a-model-for-data-aggregation-task-30aa1c175d53?source=rss-91f3a4d01e17------2</link>
            <guid isPermaLink="false">https://medium.com/p/30aa1c175d53</guid>
            <category><![CDATA[modelling]]></category>
            <category><![CDATA[data-aggregation]]></category>
            <dc:creator><![CDATA[Satoshi Imai]]></dc:creator>
            <pubDate>Mon, 14 Dec 2020 00:56:11 GMT</pubDate>
            <atom:updated>2020-12-14T00:56:11.411Z</atom:updated>
            <content:encoded><![CDATA[<h3>A model for data aggregation task</h3><p>by <a href="https://www.wantedly.com/id/satoshi_imai_nowcast">Satoshi Imai</a>; Nowcast Inc.</p><h3>1. Abstract</h3><p>This post explains the main two steps in a model for data aggregation tasks. “Data aggregation task” means a project which converts source data to aggregated result data and its conversion steps don’t have a prediction model. Two main steps are the “cleansing” step and the “tabulation” step. The “supervision” step is a specialized process that is utilized when the model is implemented in the IT system.<br>The “cleansing” has two sub-stages; “validation” and “imputation”. The “Tabulation” has two sub-stages, too; “Aggregation” and “Arrangement”.</p><figure><img alt="An overview of the model" src="https://cdn-images-1.medium.com/max/717/1*xyd0mi_u0I_nP8RQ0ad4Vg.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/20422081fa8cf40562b506a5d11ba4e1/href">https://medium.com/media/20422081fa8cf40562b506a5d11ba4e1/href</a></iframe><p>Why do I apply this model to my data aggregation task? First, to structure the programming model. And to clarify and isolate the responsibilities assigned to the programming modules. Second, for ease of testing the responsibilities assigned to the program unit. In other words, this model is designed to take advantage of building a chain or network of responsibilities to build a tabulation system on a certain scale.<br>A particularly important point is the isolation of responsibilities. And the reason for focusing on isolation is to aim to loosely connect the responsibilities of each other to build a network. This kind of work finally builds a kind of chain of doing A, doing B, and doing C. And if you bring in some complexity, it becomes a directed graph. At this time, if the responsibilities in the network have a strong dependency relationship, the entire network will naturally go down when some responsibility point fails.<br>Ideally, under these conditions, only the responsibilities located downstream of the failed responsibility point are affected, not the other branches. In order to achieve this, loose connectivity of responsibilities is indispensable. In other words, I aim to reduce the dependency between modules to the utmost limit and aim for each responsibility point to solve the following conditions by itself.</p><ol><li>Understand and collect all the contexts (input data, environment, control information, etc.) necessary for its own responsibility.</li><li>Output all contexts having no dependencies (output data, control information) assigned at its own responsibility.</li><li>All responsibilities guarantee idempotency as a program and do not destroy the re-executability of the responsibilities in the event of failure.</li></ol><p>The most important and necessary thing for a data aggregation task is the output data. In other words, loose connectivity between responsibilities can be realized by relying on one’s own pre-process only by the input data that each other needs.<br>In order to realize this architecture, this model has one particularly important element. It is the most important chain of responsibility for us, “whether or not to change the content of the data”. In other words, in the process of “validation -&gt; imputation -&gt; aggregation -&gt; arrangement”, a clear chain of “do not change -&gt; change -&gt; change -&gt; do not change” is implemented. The processing performed by the program module to which the responsibility is assigned is clear. For example, if you recognize what the problem in the network you are trying to solve is, you can identify which responsibility unit is performing that operation. By doing this, the aim of obtaining a job network with high fault tolerance and excellent testability is the basis of this model.<br>Once you comprehend this most important point, all that remains is an explanation of the boring definition of what kind of responsibility is assigned to which model.</p><h3>2. Detail model of “Cleansing”</h3><p>The “cleansing” has two sub-stages; “validation” and “imputation”. The responsibility of the cleansing step is to confirm that the data is suitable for its purpose, and if necessary, correct or impute the data to perform preprocessing that suits the purpose.</p><h3>2.1 Validation</h3><p>The role of the validation step is to check and confirm that the data is valid for the project. As mentioned earlier, the validation step does not change the data. From first to last, while retaining the information as it is, we will only understand the situation and properties of the data and perform the necessary conversion as a matter of the format.</p><p>The following description is like tagging that there is a function that bears such responsibility. Therefore, every entry is not classified as categories that are independent of each other, and some have multiple properties and some have overlapping roles at the same time.</p><p>Format validation: A format check to see if the file format follows the data layout or data dictionary. Also check the format as data such as file format, line feed code, character string encoding, etc.</p><p>Single-cell validation: The check focuses on one data cell. In other words, it refers to the range of checks that can be completed without comparing or referencing with other cells or other data rows.</p><p>Single row validation: The check focuses on one data row. In other words, it refers to the range of checks that can be completed without comparing or referencing with other rows.</p><p>Data type validation: Check if the data type can be recognized correctly. Note that there are also unique numerical expressions such as “1e2”. It can be said to be a type of domain validation.</p><p>Data domain validation: A check to see if the data fits its own domain. Various checks can be considered for the number of domains, such as numerical range, date format, enumerated value, and code value with a check digit.</p><p>Nullability: Check whether the data allows null values and whether null values are mixed in cells that cannot allow null values. Null values are especially important because they can be imputation targets.</p><p>Cross cell validation: Single-cell validation focuses on one data cell, while cross-cell validation checks the correlation of values in two or more data cells. For example, as in the case of checking the relationship between the date of birth and the number of years of employment, the domain of the one value determined by the condition of the other value is checked. At this time, the value of each data cell to be checked must pass single-cell validation.</p><p>Cross row validation: Single row validation is completed by combining several single-cell validations and cross-selling validations. Cross-row validation is applied to the set of rows for which single-row validation has been completed.</p><p>Marking validation result: For example, count the records for a certain attribute value. If the number of records that exceeds the estimated population for that attribute value is observed, it is likely that something is wrong. Cross-row validation is deeply involved in the statistics and properties of the data and is the most important factor in considering the suitability of the data.</p><p>Reforming: In order to aggregate the data, it may be necessary to change the shape of the data from the original. Reforming is responsible for this process, but when performing reforming, it is necessary to ensure that the value of the data does not change. It only changes the position and order of the data.</p><p>Information merging: It may be necessary to combine information related to the data, as in the example of combining the product master information with the purchase transaction data. Information merging is a special case of validation, but again the value of the original data must not be changed.</p><p>Validation flag: As a special case of Information merging, the status of Validation applied to the data is added to the original data. Columns can be added to the data row, but it is desirable to manage them separately along with other status information.</p><h3>2.2 Imputation</h3><p>The role of the imputation step is modifying the data to adjust the data to the project purpose. However, this does not mean making data but is limited to making appropriate corrections. It can be outlier removal, outlier correction, or resampling. It is based on a certain theory or background, but since the data will be modified in this step, it needs to be done carefully. There are two types of Imputation steps: a design that performs its Imputation processing at its own discretion and a design that delegates the judgment to the validation step. How to do it? How to judge? It is a profound area that never ends.</p><p>Drop cell: It means ignoring the information in a single cell. It is used when you want to utilize other information than the corresponding cell.</p><p>Drop row: The brute force of excluding all lines that are problematic, anomalous, or of concern. It is sometimes necessary, but it should be treated with caution as it is an act of removing the entire affected region.</p><p>Imputation for missing values: Correct the missing information. Since the data is missing, we have no choice but to refer to the information in other cells or rows when making an imputation.</p><p>Modification for error values: Correct the data that can be clearly determined to be incorrect. A typical example is a typo. There are cases where corrections are made based only on the information of cells with errors, and cases where corrections are made based on information on other cells and rows.</p><p>Modification for anomalous values: Since the data itself does not violate the data domain, it cannot be determined that it is error data, but the data that can be determined to be an abnormal value will be modified. Although it may be judged as an abnormal value only by the data cell itself, it is usually judged by combining multiple peripheral information.</p><h3>3. Detail model of “Tabulation”</h3><p>The “Tabulation” has two sub-stages, too; “Aggregation” and “Arrangement”.<br>A promised land at the end of a long, tough, and dark tunnel. There is always the right answer that you can reach with the only effort. Because the Tabulation step is an act of applying mathematical formulas, it is a simple process that returns correct results if correct programming is performed.</p><h3>3.1 Aggregation</h3><p>It is the core of the data aggregation task, but it is also the most straightforward and easy to handle. Normally, the number of cells and rows of data is overwhelmingly reduced by aggregation. However, the statistics of the data are almost always equivalent to the original data.</p><p>Aggregation: sum, mean, count… You can do everything simply.</p><p>Indexation: The process of calculating an index or indicator by applying some indexing formula.</p><p>Resampling: This is a process that is in a special position in the aggregation step. Performs processing that limits the number of data to be used, such as taking a matched sample of data (obtaining a common sample having transactions at time points t and t-dt).</p><h3>3.2 Arrangement</h3><p>Steps to focus on adjusting and changing the way data is represented. Depending on the purpose of the project, it may not be done at all.</p><p>Round: Adjust the number of decimal places displayed in the data.</p><p>Converting the measure: Converts the number of digits represented by data, such as KB and GB.</p><p>Transpose: Swap the rows and columns of the data.</p><p>Pivoting: The data expressed in the row direction with columns for each attribute is re-expressed by arranging the attributes in the columns.</p><p>Compile the table: Arrange the format of a list of flat data as a table. Usually done for human readability.</p><p>Change the file format: For example, convert the CSV file to a parquet file or spreadsheet file, change the format of the file itself to arrange.</p><h3>4. Detail model of “Supervision”</h3><p>The supervisor step has a special position. This step produces only the quality of the project, not the data. The ultimate goal of this step is to ensure that the project is running properly on all sub-steps on the expected schedule.</p><h3>4.1 Processing supervision</h3><p>Monitor that all program units representing all responsibilities implemented in the project are operating properly and on schedule. The states monitored by this step are normal termination, abnormal termination, and most importantly, not started!!! It is relatively easy to detect that a program has terminated abnormally (It is another matter why it terminated abnormally …). However, it is not so easy to find one unit that is not started from among the many steps that are working properly.</p><h3>4.2 Result supervision</h3><p>Monitor the quality of various output results in the project. It may be monitoring of statistical information or monitoring of the output result value itself.</p><p>Thank you for reading. Happy aggregating!</p><p>The Finatext Group is actively hiring engineers. If you are interested in data engineering or data science, please feel free to contact us via the following form.</p><p><a href="https://hd.finatext.com/recruit/jobs/">募集職種一覧 | 採用情報 | 株式会社Finatextホールディングス | Reinvent Finance as a Service</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30aa1c175d53" width="1" height="1" alt=""><hr><p><a href="https://techblog.finatext.com/a-model-for-data-aggregation-task-30aa1c175d53">A model for data aggregation task</a> was originally published in <a href="https://techblog.finatext.com/">The Finatext Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>