Add cookbook: Building World-Aware Agents with Prediction Market Data#2577
Add cookbook: Building World-Aware Agents with Prediction Market Data#2577patrickliu0077 wants to merge 3 commits intoopenai:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 804fd34feb
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "researcher = Agent(\n", | ||
| " name=\"researcher\",\n", | ||
| " instructions=SHARED_CONTEXT + \"\\nYou are a macro researcher. Analyze geopolitical and economic developments. Hand off to the risk analyst when you identify concerning data.\",\n", | ||
| " handoffs=[\"risk_analyst\"],\n", |
There was a problem hiding this comment.
The multi-agent example configures handoffs with a string name ("risk_analyst") instead of an Agent/handoff object, so the handoff target is not actually wired into the SDK graph. In practice this breaks the intended transfer behavior (and can raise a validation/runtime error when Runner.run_sync executes), so the cookbook’s core “shared multi-agent” pattern will fail for readers following it verbatim.
Useful? React with 👍 / 👎.
The multi-agent example referenced risk_analyst in researcher's handoffs before it was defined, causing a NameError. Reordered the agent definitions so risk_analyst is created first. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Hi — the handoff issue flagged by the automated review has been fixed in the follow-up commits (Agent objects instead of string names, correct definition order). Everything should be in good shape now. Happy to address any other feedback. Thanks! |
Summary
Adds a cookbook showing how to build agents that have real-time world awareness using calibrated prediction market data. The cookbook uses the OpenAI Agents SDK and demonstrates:
?focus=energy,geo) and incremental updates (/delta?since=1hfor ~30-50 tokens)The data source (SimpleFunctions) aggregates 9,706 prediction market contracts from Kalshi (CFTC-regulated) and Polymarket into a markdown snapshot optimized for LLM context windows. No API key needed — the endpoint is free and public.
Motivation
A recurring problem in agent development: LLMs have a knowledge cutoff and don't know what's happening today. Web search returns narratives ("tensions remain elevated"), not data. This cookbook shows a different approach — injecting calibrated probabilities backed by real money into the agent's context.
The prediction market insight: a price of 53c on "Iran invasion" encodes the aggregate judgment of everyone with money at risk on that question. This is fundamentally more useful for agent reasoning than news headlines or search results.
Checklist
registry.yamlauthors.yamlrequirements.txtSelf-review