Skip to main content

Scenario

Claude’s 1M token context window can process entire annual reports, 10-K filings, or industry whitepapers in a single call — no chunking, no summarization chains, no lost context. This job feeds a full document to Claude Opus 4.6 for deep analysis, extracts audience segments and decision-maker profiles, then creates Mavera Custom Personas grounded in real market intelligence. Flow: Read document → Anthropic POST /v1/messages (Claude Opus 4.6, full document) → Extract segments → Mavera POST /personas → Data-driven personas

Code

Example Output

Error Handling

Claude Opus 4.6 supports 1M input tokens. A 500-page annual report is ~200K tokens — well within limits. For documents exceeding 1M tokens, split at natural boundaries (chapters, sections) and run multiple calls.
Tier 1 allows 50 req/min. This job uses 1 Claude call + up to 6 Mavera calls. The anthropic SDK retries 429 errors automatically with exponential backoff. For raw HTTP, add retry logic with 30-60s waits.
Claude may wrap JSON in markdown code fences. The substring extraction handles this. If parsing still fails, retry with a system prompt that says “return raw JSON, no markdown.”