AWS Builder Center
Contract_Review_AI_Assistant

Contract_Review_AI_Assistant

A production-ready architecture and checklist for deploying the Contract Review Assistant on AWS, including recommended services, a Step Functions workflow, and security and cost controls.

Building a Multi-Agent Contract Review Assistant on AWS

Contracts are full of small details that can become expensive later: uncapped liability, missing termination rights, vague data protection language, and commercial terms that look harmless until the first dispute. In this project, I built a multi-agent Contract Review Assistant that breaks the review into specialist roles and then produces one consolidated report.
This is not a replacement for legal counsel. The goal is to speed up first-pass review, create a consistent checklist, and help legal or business teams focus on the clauses that deserve human attention.

The Idea

Instead of asking one model to review everything at once, the workflow uses multiple agents:
  • Intake Agent for metadata and normalization.
  • Clause Agent for clause detection.
  • Risk Agent for business and legal exposure.
  • Compliance Agent for policy checks.
  • Negotiation Agent for redlines and fallback positions.
  • Supervisor Agent for final synthesis.
This structure makes the system easier to debug. If the compliance output looks weak, I can improve the Compliance Agent prompt without disturbing the rest of the workflow.

Why Multi-Agent?

A contract review task has different kinds of reasoning. Extracting dates is not the same as judging indemnity risk. Finding a missing termination clause is not the same as drafting a negotiation fallback. Multi-agent design gives each role a narrower job and lets the supervisor combine the outputs.
The pattern also maps naturally to AWS:
  • Amazon S3 stores the uploaded contract.
  • AWS Step Functions orchestrates the agent workflow.
  • AWS Lambda runs each agent worker.
  • Amazon Bedrock invokes the foundation model.
  • DynamoDB stores review state and audit history.
  • CloudWatch captures logs and operational metrics.

Workflow

  1. User uploads a contract.
  2. The document is stored in S3.
  3. Step Functions starts the review.
  4. Intake and Clause agents run first.
  5. Risk and Compliance agents run in parallel.
  6. The Negotiation Agent turns findings into action.
  7. The Supervisor Agent creates the final report.
  8. High-risk reports are routed to a human reviewer.

Code Walkthrough

The core local workflow is in src/contract_review_assistant/orchestrator.py.
1
2
3
4
5
intake = INTAKE_AGENT.run(llm, contract_text)
clause = CLAUSE_AGENT.run(llm, contract_text, summarize_context(results))
risk = RISK_AGENT.run(llm, contract_text, summarize_context(results))
compliance = COMPLIANCE_AGENT.run(llm, contract_text, summarize_context(results))
negotiation = NEGOTIATION_AGENT.run(llm, contract_text, summarize_context(results))
The demo includes a mock LLM client, so the project can run without AWS credentials:
1
python -m contract_review_assistant.cli sample_data/sample_contract.txt
To switch to Amazon Bedrock:
1
2
3
4
export LLM_PROVIDER=bedrock
export AWS_REGION=us-east-1
export BEDROCK_MODEL_ID=anthropic.claude-3-5-sonnet-20240620-v1:0
python -m contract_review_assistant.cli sample_data/sample_contract.txt

Example Output

The assistant returns a JSON report with:
  • Contract metadata.
  • Executive summary.
  • Overall risk level.
  • Agent findings.
  • Negotiation points.
  • Human next steps.
  • Agent trace for auditability.

Production Considerations

For production, I would add:
  • OCR and PDF parsing.
  • Clause-level citations back to source pages.
  • Bedrock Guardrails.
  • Human approval for high-risk reports.
  • Prompt and output versioning.
  • Evaluation datasets for known contract risks.
  • Redline generation in DOCX.
  • Role-based access controls.

Final Thought

The most useful agentic systems are not just "one big prompt." They are workflows: small expert roles, clear handoffs, observable outputs, and human approval where the stakes are high. Contract review is a great fit because the work is structured, repetitive, and still important enough to keep a human in the loop.
The full source code and setup are available on GitHub: https://github.com/its-me-sweta/Contract_Review_AI_Assistant.git
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article