Contract Review Agent

Agent Description:

The Contract Review Agent automates legal and compliance checks for active agreements. It fetches contract metadata via API and retrieves detailed legal clauses (such as Liability and Termination) from an SQL database. The agent then analyzes these clauses to identify and flag high-risk terms, inconsistencies, or compliance violations. Finally, it generates a structured, human-readable report summarizing the findings for audit and review.

Purpose and Components
  • Purpose: To automate the intensive process of contract review, enabling legal and compliance teams to quickly identify high-risk terms, inconsistencies, and compliance violations across all active agreements.
  • Components:
    • Contract Fetcher (API): An agent to get a list of active contract metadata.

    • Clause Retriever (SQL): An agent to query a database for the full text of specific legal clauses associated with each contract.

    • Risk Analyzer: An agent that evaluates the retrieved clauses for risks and generates a final report.

    • Tool Integrations: Pre-configured tools for making GET requests and interacting with an SQL (SQLite) database.

Supported Capabilities
  • Initiating a secure GET API request to fetch all active contract documents.

  • Validating API responses to ensure required fields (contract_id, title, status) are present.

  • Filtering to process only contracts with an "Active" status.

  • Using a contract_id to query an SQL database for specific, structured legal clauses.

  • Extracting key clauses such as Payment Terms, Termination Conditions, Liability Limits, Confidentiality/NDA, and Governing Law.

  • Analyzing clauses to identify and flag high-risk terms (e.g., RiskType = 'Liability', 'Penalty', or 'Non-Compliance').

  • Generating a structured, human-readable report with flagged clauses and clear explanations for audit and review.

LLM Used
  • GPT_4O_MINI

    Note: To learn more about the LLM and to modify its behavior, refer to the Configuring LLM settings section.

Sub-Agents

1. Contract Reader

  • Role: Data Fetcher

  • Scope: Fetch contracts via GET API and forward raw content to the Clause Reader for extraction.

  • Description: This agent starts the workflow. It makes a GET API call to retrieve a list of all contract documents. It then filters this list to find only those with an "Active" status and passes their contract_ids to the Clause Reader for the next step.

  • LLM Used: Default (Inherits from parent agent).

  • Tools Used: Request - Get

2. Clause Reader

  • Role: Data Reader

  • Scope: Query SQL database for structured clauses of the contracts fetched via API, and prepare for risk evaluation.

  • Description: This agent receives the contract_ids for active contracts from the Contract Reader. It then queries the SQL database to fetch the full, detailed text of key legal clauses (like Liability, Termination, etc.) associated with each of those contract_ids. This structured clause data is then sent to the Risk Evaluator.

  • LLM Used: Default (Inherits from parent agent).

  • Tools Used: SQL - Toolkit

3. Risk Evaluator

  • Role: Risk Analyzer

  • Scope: Combine contract content (from GET API) and structured clauses + risk terms (from SQL) to identify legal risks and generate a report.

  • Description: This is the final agent in the chain. It receives the structured clause data and performs the core legal analysis. It scans the text for high-risk terms, inconsistencies, or compliance violations, specifically flagging clauses related to 'Liability', 'Penalty', or 'Non-Compliance'. It then generates a final, human-readable report with all its findings.

  • LLM Used: Default (Inherits from parent agent).

  • Tools Used: None

Tools Used:
  • Request - Get Tool – Fetches the list of active contract metadata from a remote JSON endpoint.

  • SQL - Toolkit (SQLite) – Executes queries against a SQLite database to retrieve the full text of legal clauses based on contract_id.

Note: For details on modifying the Tools, refer Tools Library section.
Agent Workflow Behavior Summary
  1. The Contract Reader (start node) makes a GET request to fetch all contracts and filters for those with status = "Active".

  2. It passes the list of active contract_ids to the Clause Reader.

  3. The Clause Reader queries the SQL database to extract the full text of key legal clauses (Termination, Liability, etc.) for each active contract.

  4. This structured data is passed to the Risk Evaluator (end node).

  5. The Risk Evaluator analyzes the clauses for high-risk language and generates a final, human-readable audit report detailing all flagged items.

Sample Questions:
  • Are there any non-standard clauses added by vendors?

  • Highlight all clauses that contain “penalty”, “termination”, or “liability” keywords.