Cookbook: add recipe 11 — 10-K extraction agent to CSV, optimized by ACE#3
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
Like recipes 01–07, it runs fully offline via the deterministic
SimulatedLLM+TeachingEnvironment. The docstring documents the one-line swap to a realOpenAILLM/wrap_agentbackend for genuine 10-K text.Changes
cookbook/11_extract_10k_to_csv.pytests/test_cookbook.py: end-to-end test (lift + CSV) and import check → 161 → 163 passingcookbook/README.md: recipe table entryREADME.md: updated recipe/test countsQuality gate
ruff check+ruff format --checkmypy acepytest— 163 passed, fully offline🤖 Generated with Claude Code