← Back to all products

Doc Review Agent Kit

$247

A contract-review agent: clause extraction, risk scoring against a YAML playbook, cited findings, and mandatory human sign-off. Ships with synthetic contracts. Not legal advice.

3 filespythonv1.0.0
MarkdownPythonJSONYAMLTOMLLLM

Product Preview

Try the interactive reader and demo tools below, or get the full product with all content unlocked.

Interactive Reader (Free Preview) Download Free Sample

File Structure 3 files

doc-review-agent-kit/ ├── free_sample ├── interactive └── preview

Documentation Preview README excerpt

Doc Review Agent Kit

NOT LEGAL ADVICE. This kit produces automated triage output, not legal opinions. It is not a lawyer and
creates no attorney-client relationship. A qualified human must read the contract and sign off on every
report. Every output the kit emits carries this notice.

Contract clause extraction, risk scoring driven by a YAML playbook, findings that cite the exact clause text and

character offsets, and a mandatory human sign-off gate: a report is a DRAFT until a named reviewer approves it,

and export_final() raises SignoffError until then.

The kit vendors the agent_forge core runtime (src/agent_forge), so it is standalone: no other package needed.

Everything runs offline with the deterministic MockLLM; plug in a real model through the 1-method LLM protocol.

Quickstart


python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest                                # offline, mock LLM
python examples/quickstart.py         # review a synthetic contract, blocked until sign-off

from doc_review import load_playbook, review_document
pb = load_playbook("playbooks/standard-saas-vendor.yaml")
report = review_document(open("samples/saas_risky.txt").read(), pb)   # DRAFT
report.sign_off("Your Name", "approved", "checked against source")      # human step
print(report.export_final())                                            # only now allowed

How it works

  • extract.py: splits numbered clauses; source[c.start:c.end] == c.text.
  • playbook.py + playbooks/*.yaml: rules (regex, severity, guidance) and required clauses. All risk judgement lives in YAML.
  • scoring.py: findings with quote, start, end (absolute offsets) and the full clause text.
  • review.py: runs the vendored injection detector on the document, redacts PII before any model prompt, asks the LLM for a one-line note.
  • report.py: draft/final state machine, sign-off, Markdown/JSON export.

Layout

src/agent_forge (vendored core) - src/doc_review - playbooks/ - samples/ (synthetic contracts) - tests/ - guide/ - examples/.

What it is not

Not legal advice, not a substitute for counsel, not a guarantee that a clause is safe because nothing was flagged.

Regex playbooks miss unusual wording. Sample contracts are fictional. Adapt the playbook to your jurisdiction and risk appetite with your lawyer.

License: MIT with a no-resale-as-template clause (see LICENSE).

Code Sample .py preview

src/agent_forge/api.py """FastAPI service: per-tenant API keys, blocking + SSE runs, human approval. POST /v1/runs run to completion (or until approval needed) POST /v1/runs/stream same, as Server-Sent Events GET /v1/runs/{id} status / final answer / pending approval POST /v1/runs/{id}/approval approve or reject a paused tool call POST /v1/admin/tenants create tenant + first API key (admin token) GET /healthz liveness (no auth) Auth: ``X-API-Key: afk_...`` (or ``Authorization: Bearer afk_...``). Keys are stored only as HMAC hashes. Runs are tenant-scoped: another tenant's run id returns 404, never 403 (no existence oracle). """ from __future__ import annotations import hmac import json from typing import Any, Iterator from fastapi import Depends, FastAPI, Header, HTTPException, Request from fastapi.responses import JSONResponse, StreamingResponse from pydantic import BaseModel, Field from .config import Settings from .errors import (AgentForgeError, ApprovalNotPending, AuthError, BudgetExceeded, GuardrailViolation, NotFound, PromptInjectionBlocked, ToolNotAllowed) from .runtime import AgentRuntime from .store import Tenant _STATUS = {AuthError: 401, NotFound: 404, ApprovalNotPending: 409, BudgetExceeded: 402, PromptInjectionBlocked: 422, ToolNotAllowed: 403, GuardrailViolation: 422} class RunRequest(BaseModel): task: str = Field(min_length=1, max_length=20000) class ApprovalRequest(BaseModel): approved: bool note: str = Field(default="", max_length=2000) class TenantRequest(BaseModel): id: str = Field(pattern=r"^[a-z0-9][a-z0-9_-]{1,62}$") name: str = "" allowed_tools: list[str] = [] approval_tools: list[str] = [] token_budget: int = Field(default=0, ge=0) usd_budget: float = Field(default=0.0, ge=0) # ... 88 more lines ...
Buy Now — $247 Back to Products