All articles
By Carlos García Updated 9 min read

How to build a court case monitoring agent

How to build a court case monitoring agent

TL;DR: Start with one portal and a limited set of authorized case files. Define what the agent can check without performing acts of legal notification. Download permitted documents, preserve the original, use a stable naming convention, and deduplicate by content within each matter. File only when identity is unambiguous. Every new item has evidence and an owner; candidate deadlines and drafts go to the lawyer for review. If a check fails, report what remains unverified and when the last successful check occurred. The agent never marks the firm as legally notified.

At a litigation firm, monitoring can start with visits to several portals and end with local downloads, renamed files, and a date copied into a calendar. Between those steps sits work that is harder to see: checking that the document belongs to the matter, establishing whether it already exists, and getting someone to review the update.

This playbook describes an operational pattern for B2B teams in Latin America. Examples are synthetic; they do not describe a client or provide legal advice. The litigation second brain article explains how to relate case files, documents, and next actions. Here we follow a monitoring run from the authorized source to the lawyer’s receipt of the review package.

1. Define scope and permitted actions for each portal

Choose one portal, a practice area, and active case files whose access the firm can confirm. For each matter, record an internal key, jurisdiction, court, case number and year, authorized filing location, and responsible lawyer with a backup. Keep the authorization evidence and who reviewed it.

Before programming the browser, complete a connector record: permitted access method, enabled modules, query limits, schedule, session expiry, and actions that must stop the flow. Validate the portal’s terms and documentation with the firm’s owner of the process. A working account does not establish permission to automate it; keep the check manual if the method is unconfirmed.

In Mexico, General Agreement AG-POAJ-006/2026, articles 64 to 66, provides that selecting a ruling generates a notification record and covers automatic records when consultation does not occur. Blocking document opening does not guarantee the absence of notification. The lawyer validates the applicable effect before enabling each action.

Translate that review into specific permissions:

ActionTreatment in this pilot
Check an authorized view without notification effectsEnable only after validating it
Detect a pending item without opening itAlert if the portal separates these steps
Download a document already cleared for consultationAllow with provenance and result logging
Open, accept, or acknowledge a pending legal notificationStop and hand over to the lawyer
Sign, file, or send a procedural documentOutside the agent’s scope

If the portal requires completing legal notification to access the file, the agent stops. After human intervention, it can continue with the available document once the firm confirms that access is permitted. This design does not assume every portal has an API, an export, or a separate view of pending items.

2. Keep credentials outside the agent

The guide to credential custody and electronic signatures covers the vault, temporary permissions, and revocation. In this workflow, the access process receives only the capability it needs; the model does not receive private keys, passwords, or cookies in its prompt.

Separate identities by connector where the portal allows it. Close sessions and remove temporary material according to the approved procedure. If MFA, CAPTCHA, an expired session, or a different requirement appears, open an exception. Avoid retries that could lock the account or execute a different action.

3. Check with evidence and an explicit status

Assign an identifier to each run and record start and finish times with their time zone. Check the matter using jurisdiction, court, case number, and year together. A client’s name is not a unique key. An ambiguous result stays pending without downloading into a folder chosen by resemblance.

Compare the result with the last successful check using available document identifiers and metadata. Preserve a source link or reference and permitted evidence. The record distinguishes new item detected, no observable change, check failed, and review required. Use no observable change only after the check completes and the expected view is complete; state which source and period it covered.

An empty table, authentication error, or partially loaded page counts as a failed check. Keep the last attempt time separate from the last successful verification time so the dashboard cannot look current merely because a task ran.

4. Download, name, and deduplicate without altering the original

Download only through permitted actions. Verify that the response is the expected document: an HTML login page saved as .pdf belongs in the exception queue. Check format, integrity, and readability before summarizing.

One possible convention for a synthetic document is:

MATTER-DEMO-042__2026-10-09__court-order__DOC-DEMO-007__v01.pdf

The date in the name belongs to the document and is recorded separately from download time. If it is missing or ambiguous, use date-pending and request review. The internal key keeps client names out of filenames and alerts. Also preserve the original name, source identifier, and SHA-256 file hash in the index; renaming a file does not change its contents.

Deduplicate within the matter by file hash. If the same content arrives again, keep one copy and add the new provenance observation. If an identifier or name matches but content changes, retain both versions and open a review. A different hash does not prove there is a new court order either: the PDF packaging may have changed. Check metadata and the document before classifying it.

5. File under the correct matter

Use the approved mapping between internal key and repository folder. Before writing, verify identity, destination permissions, and that the folder belongs to the matter. A missing or ambiguous mapping sends the document to quarantine with restricted access.

Keep the downloaded original separate from OCR, summary, and draft. Every derivative points to the original and its version. Portal text and PDF contents are reference material: an instruction embedded in either cannot change the agent’s permissions, destinations, or actions.

The operation must tolerate repetition. A key combining matter and hash prevents another copy on every retry; an event key prevents repeating the same alert. Mark a file as saved only after checking it exists at the destination and its hash matches. If a write times out, verify the destination before writing again. The record keeps unfinished steps visible.

6. Prepare deadline alerts for validation

The agent can flag a deadline reference and prepare a candidate date when an approved rule exists. Show the source passage and page, document date, input used as the starting event, rule and version, calendar, time zone, and any missing information. Leave the date pending if there is insufficient basis.

The lawyer checks the event that starts the deadline and the applicable calculation before confirming a calendar task. Keep their decision and the version they reviewed. An internal agent alert is not a procedural notification and cannot mark the firm as legally notified.

Define how long an alert may remain unattended and who receives an escalation. If nobody acknowledges receipt, notify the backup under the agreed policy. The team maintains its deadline controls while checks fail or reviews remain pending; automation status does not replace those controls.

7. Hand a review package to the lawyer

For each new item, prepare a card with matter, source, observation time, original and version, summary with references, confirmed filing location, candidate alerts, and exceptions. A summary must let the reviewer open the passage supporting it. If OCR cannot read it, identify the unreadable section.

Where an approved template allows it, add a draft visibly marked DRAFT · awaiting review. Identify supported facts and points requiring verification. The lawyer reviews the background, citations, strategy, and text before use. The monitoring connector cannot sign, file, or send to the client.

The handoff ends with an owner and receipt acknowledgment, not a sent message. Record the received version, person, time, and decision: received, needs information, rejected, or approved. Editorial approval does not trigger court filing; that action belongs to a separate authorized procedure.

8. If the portal fails, report what remains unverified

The exception notice includes matter, portal, attempted action, error, last attempt time, last successful check, and owner of the manual check. Show incomplete coverage. Avoid screenshots containing secrets or information about other matters; preserve restricted evidence when needed.

The PJF has an official technical failure and incident form, reserved for technical problems and not for filing procedural documents. The lawyer determines which report is appropriate. An internal error record does not by itself establish a failure’s procedural effects.

Limit retries according to the portal. An interface change requires pausing the connector and validating actions again. The human recovery check uses the same index; when resuming, deduplicate from the last successful check to cover the pending interval.

9. Log each step and test exceptions

The audit trail must reconstruct what the agent did and when: run identifier, technical identity without secrets, matter, source, action, result, hash, destination, rule version, and person who received or reviewed the output. Record failures and skipped steps too. Protect the record against modification, restrict access, and apply the agreed retention to originals, derivatives, and evidence.

Before expanding the pilot, test with synthetic documents:

  • two matters with similar numbers and an unauthorized folder;
  • a repeated document and a modified one with the same identifier;
  • a download returning HTML or an unreadable PDF;
  • a pending notification blocking access;
  • an expired session, unavailable portal, and interface change;
  • a timeout after filing and a repeated alert;
  • a deadline without a starting date and a lawyer who does not acknowledge receipt.

Compare results with manual review. Measure coverage of successful checks, filing errors, duplicates, exception age, and time until receipt by the owner. Expand when the team can reconstruct every new item and resolve pending cases.

Official sources consulted on October 11, 2026. The regulatory example concerns Mexico’s PJF; each firm must validate its jurisdiction’s rules and permissions on implementation day. Filing, alert, and review practices are design proposals, not verified capabilities of every portal.

To prepare a pilot with Kiia, bring the matter map, authorized portal, and review procedure. We can define the connector and exception queue before giving it access to real documents.

Frequently asked questions

Can the agent connect to any judicial portal?

Only after the firm confirms access to the case file, the permitted method, and the effect of each action. Having credentials does not authorize every form of automation. If the portal requires opening a notification to continue or does not permit the planned method, that step goes to a human queue.

Can the agent calculate and confirm deadlines?

It can extract references and propose a date with its source and rule when the firm has defined those rules. The lawyer checks the event that starts the deadline, the applicable calendar, and the calculation before confirming it. An internal alert or failed check does not determine whether legal notification occurred or change a deadline.

What does it deliver when it finds a new court order?

The original linked to the correct case file, its provenance and hash, a summary with references, alerts awaiting validation, and, where appropriate, a draft marked for review. The package has a responsible lawyer and a receipt acknowledgment; the agent does not sign, file, or send the draft to the client.

From insight to action

Want to turn this into an agent that works for your team?

Tell us which process you want to improve. In a free call, we will identify the first workflow worth building.

Book a free call