Skip to content

Cookbook: add recipe 11 — 10-K extraction agent to CSV, optimized by ACE#3

Merged
rrahimi-uci merged 1 commit into
mainfrom
cookbook/10k-extraction-to-csv
Jun 30, 2026
Merged

Cookbook: add recipe 11 — 10-K extraction agent to CSV, optimized by ACE#3
rrahimi-uci merged 1 commit into
mainfrom
cookbook/10k-extraction-to-csv

Conversation

@rrahimi-uci

Copy link
Copy Markdown
Owner

What

Adds a new core (no API key) cookbook recipe: cookbook/11_extract_10k_to_csv.py — an end-to-end 10-K extraction agent that ACE optimizes, exporting results to CSV.

The story

A 10-K page is full of look-alike numbers — prior-year columns, segment subtotals, "Total current assets" vs. "Total assets", Basic vs. Diluted EPS, the 21% statutory rate vs. the real effective rate. A naive extractor grabs the wrong one. ACE turns each mistake into a reusable extraction rule (one playbook bullet per field): where the number lives and which look-alikes to avoid.

The agent learns the rules from two companies' filings, then extracts from a brand-new company's 10-K it has never seen, and ports the results to CSV.

Measured result (deterministic, offline)

Held-out filing extracted         : Meridian Software Inc
Extraction accuracy (no learning) : 33.3%
Extraction accuracy (+ ACE)       : 100.0%   (learned 4 extraction rules)
Ported 6 extractions to CSV

Like recipes 01–07, it runs fully offline via the deterministic SimulatedLLM + TeachingEnvironment. The docstring documents the one-line swap to a real OpenAILLM / wrap_agent backend for genuine 10-K text.

Changes

  • New recipe cookbook/11_extract_10k_to_csv.py
  • tests/test_cookbook.py: end-to-end test (lift + CSV) and import check → 161 → 163 passing
  • cookbook/README.md: recipe table entry
  • README.md: updated recipe/test counts

Quality gate

  • ruff check + ruff format --check
  • mypy ace
  • pytest — 163 passed, fully offline

🤖 Generated with Claude Code

A new offline (no API key) core recipe that frames a real-world job — reading
10-K pages and extracting structured financials into a CSV — as an ACE Task.
The agent learns one extraction rule per field from two companies' filings and
applies them to a held-out company's 10-K (33.3% -> 100.0% on the unseen filing),
then ports the extractions to CSV. Docstring shows the one-line swap to a real
OpenAILLM / wrap_agent backend.

- Wire into tests/test_cookbook.py (end-to-end + import check): 161 -> 163 passing
- Update cookbook/README.md recipe table and README.md counts

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rrahimi-uci rrahimi-uci merged commit f932311 into main Jun 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant