# Content Summarizer Agent
# Generates AI summaries for articles and blog posts

id: content_summarizer
name: Content Summarizer
description: |
  Generates concise summaries and extracts key points from long-form content
  like articles, blog posts, and documentation.

watch:
  database: content
  collection: articles
  operations:
    - insert
    - update
  filter:
    status: published
    $or:
      - ai_summary:
          $exists: false
      - needs_resummary: true

ai:
  provider: anthropic
  model: claude-3-haiku-20240307
  temperature: 0.5
  max_tokens: 1000
  system_prompt: |
    You are a professional content summarizer. Create clear, accurate summaries
    that capture the key points of the original content.
  prompt: |
    Summarize this {{ document.type | default('article') }}:

    Title: {{ document.title }}

    Content:
    {{ document.content | truncate(8000) }}

    Generate:
    1. A one-sentence summary (max 100 characters)
    2. A paragraph summary (2-3 sentences)
    3. 3-5 key points as bullet items
    4. Relevant tags for categorization
  response_schema:
    type: object
    properties:
      one_liner:
        type: string
        maxLength: 100
      summary:
        type: string
      key_points:
        type: array
        items:
          type: string
        minItems: 3
        maxItems: 5
      tags:
        type: array
        items:
          type: string
      reading_time_minutes:
        type: integer
    required: [one_liner, summary, key_points, tags]

write:
  strategy: merge
  target_field: ai_summary
  idempotency_key: "{{ document._id }}_{{ document.updated_at | default('v1') }}"

execution:
  max_retries: 2
  retry_delay_ms: 2000
  timeout_ms: 60000
  rate_limit_per_minute: 30
  cost_limit_usd: 0.50

enabled: true
