Skip to main content

AI-powered web search and structured data extraction using Anthropic Claude or OpenAI GPT

Project description

Sentinel Searcher

AI-powered web search and structured data extraction

PyPI Python License


Overview

Sentinel Searcher is a tool for automated web research that returns structured data. Define a schema, describe what to search for, and let AI agents browse the web and return exactly the data you need in JSON or YAML format.

Supported Providers:

  • Anthropic Claude - Uses web_search_20250305 tool
  • OpenAI GPT - Uses web_search_preview via Responses API

Use Cases:

  • Portfolio automation (awards, publications, news mentions)
  • Competitive intelligence gathering
  • Content curation and aggregation
  • Research data collection

Installation

pip install sentinelsearcher

For OpenAI support:

pip install sentinelsearcher[openai]

Quick Start

1. Set up API keys

Create a .env file or set environment variables:

# For Anthropic (default)
ANTHROPIC_API_KEY=your_key_here

# For OpenAI
OPENAI_API_KEY=your_key_here

2. Create configuration

Create sentinel.config.yaml:

api:
  provider: "anthropic"  # or "openai"
  model: "claude-sonnet-4-20250514"  # or "gpt-4o"
  delay_between_jobs: 60

jobs:
  - name: "news-updates"
    instruction: "Find recent news articles mentioning Acme Corp product launches"
    file_path: "data/news.yaml"
    output_format: "yaml"
    schema:
      type: "array"
      items:
        title: "string"
        url: "string"
        date: "YYYY-MM-DD"
        summary: "string"

  - name: "awards"
    instruction: "Find industry awards won by Acme Corp in 2024-2025"
    file_path: "data/awards.json"
    schema:
      type: "array"
      items:
        award_name: "string"
        date: "YYYY-MM-DD"
        description: "string"

3. Run

sentinelsearcher --config sentinel.config.yaml

Or generate starter files:

sentinelsearcher --start

Python API

from sentinelsearcher import run_sentinel_searcher, create_provider

# Simple usage (reads provider from config)
results = run_sentinel_searcher("sentinel.config.yaml")

for job_name, items in results.items():
    print(f"{job_name}: {len(items)} new items found")

# With explicit provider
provider = create_provider("openai")
results = run_sentinel_searcher("config.yaml", provider=provider)

Configuration Reference

API Section

Field Type Required Description
provider string Yes "anthropic" or "openai"
model string Yes Model identifier
delay_between_jobs int No Seconds between jobs (default: 60)

Recommended Models:

  • Anthropic: claude-sonnet-4-20250514
  • OpenAI: gpt-4o

Job Section

Field Type Required Description
name string Yes Unique job identifier
instruction string Yes Search instruction for the AI
file_path string Yes Output file path
schema object Yes Output data schema
output_format string No "json" (default) or "yaml"

Schema Types

The schema uses a simplified format:

schema:
  type: "array"
  items:
    field_name: "string"       # Any text
    date_field: "YYYY-MM-DD"   # ISO date format
    image_field: "example.png" # Placeholder indicator

GitHub Actions

Automate searches with a scheduled workflow:

name: Sentinel Search

on:
  schedule:
    - cron: "0 9 1 * *"  # Monthly on the 1st
  workflow_dispatch: {}

jobs:
  search:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-python@v5
        with:
          python-version: "3.11"

      - run: pip install sentinelsearcher[openai]

      - run: sentinelsearcher --config sentinel.config.yaml
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

      - uses: peter-evans/create-pull-request@v5
        with:
          commit-message: "chore: update from Sentinel Search"
          title: "Sentinel Search: New content found"
          branch: sentinel-updates

Setting Secrets

gh secret set OPENAI_API_KEY --body "sk-..."
gh secret set ANTHROPIC_API_KEY --body "sk-ant-..."

How It Works

  1. Load Configuration - Reads your YAML config with jobs and schemas
  2. Read Existing Data - Loads current file contents to avoid duplicates
  3. Web Search - AI agent searches the web based on your instruction
  4. Extract & Validate - Parses response and validates against schema
  5. Deduplicate & Merge - Combines new items with existing data
  6. Write Output - Saves updated file in JSON or YAML format

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sentinelsearcher-0.2.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sentinelsearcher-0.2.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file sentinelsearcher-0.2.0.tar.gz.

File metadata

  • Download URL: sentinelsearcher-0.2.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.14

File hashes

Hashes for sentinelsearcher-0.2.0.tar.gz
Algorithm Hash digest
SHA256 702a8416aa8cf928c80aab73ecae4c6b2df73aec2071cc3d94e8144187e7177d
MD5 c7d61239beebd787a3a14f0a9fa02377
BLAKE2b-256 6a12daa41d5caa0a70f5ec995d793782887086814788121ed49aa6336080e8fe

See more details on using hashes here.

File details

Details for the file sentinelsearcher-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sentinelsearcher-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 641a3a730043bbf96c4a79c023c4ef8c2332323dd02cc9d841a8980c844b93a2
MD5 2e0632c5f1ae24c4417f277cf8cd4f48
BLAKE2b-256 69ff90639e0bd43d1df7296ffb2c3999d3487aaf45088a26cea593f10b362bb9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page