Skip to main content
This example demonstrates how to build an Upsonic LLM agent that can autonomously find and verify agreement or policy pages on a company’s ecommerce website β€” such as Privacy Policy, Terms of Use, or Cookie Policy β€” using web scraping and LLM reasoning for exploration and validation.
Overview In this task, the agent:
  1. Explores the website intelligently using a single website_scraping tool
  2. Identifies links that are likely related to agreements or policies (e.g., privacy, terms, refund, cookie, legal)
  3. Follows those links autonomously and determines whether each page is a valid agreement or policy document
  4. Returns structured results, including link availability and verification
Unlike traditional scripts, this task delegates all exploration and reasoning to the LLM agent β€” keeping the implementation lightweight and adaptable.

Key Features

  • Autonomous Exploration: LLM handles all website navigation and link discovery
  • Intelligent Verification: Determines if pages contain actual policy content
  • Structured Output: Returns verified agreement links with metadata
  • Flexible Architecture: Works with any website structure
  • No Hardcoded Logic: All reasoning is handled by the LLM

Code Structure

Response Models

Web Scraping Tool

Complete Implementation

How It Works

1. Website Discovery

  • The LLM uses the website_scraping tool to analyze the main site content
  • It identifies subpages likely to contain legal or policy-related text

2. Intelligent Exploration

  • The agent autonomously follows links and checks accessibility
  • It looks for URLs containing keywords like β€œprivacy”, β€œterms”, β€œpolicy”, β€œlegal”, β€œcookie”

3. Agreement Verification

  • The LLM determines whether each reachable page is an agreement/policy page
  • It analyzes content for mentions of user data, consent, cookies, terms, etc.
  • Results are returned as structured Pydantic models

Usage

Setup

Run the agent

Example output:

Try with other companies

Use Cases

  • Compliance Audits: Automatically find and verify policy pages for compliance
  • Legal Research: Identify legal documents on company websites
  • Due Diligence: Verify policy availability during business evaluations
  • Content Monitoring: Track changes in company policies over time
  • Regulatory Compliance: Ensure required policies are publicly available

File Structure

Advanced Features

Custom Policy Detection

Batch Processing

Notes

  • Lightweight architecture: The entire process is handled within one Task; Python only defines the tools
  • No hardcoded logic: The LLM autonomously explores and verifies
  • Structured output: Type-safe Pydantic schema (AgreementLinksResponse)
  • Flexible: Works with any website structure and design
  • Autonomous: Requires minimal human intervention

Repository

View the complete example: Find Agreement Links Example