{
  "markdown": "# FutureSearch Python SDK\n\n[![PyPI version](https://img.shields.io/pypi/v/futuresearch.svg)](https://pypi.org/project/futuresearch/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)\n\n<p align=\"center\">\n  <img src=\"images/team-dispatch.svg\" alt=\"FutureSearch turns questions about the future into probabilities, dates, and numbers\" width=\"760\">\n</p>\n\n**An API for frontier forecasting.**\n\nFutureSearch predicts the future. Accuracy is verifiable via our [public track record](https://evals.futuresearch.ai) on stocks, prediction markets, public benchmarks, and forecasting tournaments: the forecaster leads Metaculus's Summer 2026 FutureEval tournament, sits above the superforecaster median on ForecastBench, and holds the best pooled score on BTF-3, our 1,907-question pastcasting benchmark. Those are live standings, so the link carries the current positions. Every forecast draws on a [shared world model](https://futuresearch.ai/docs/world-modeling) that reconciles related questions against each other; it improved all nine base forecasters we tested, four of them significantly.\n\n| Track Record | |\n| --- | --- |\n| [markets.futuresearch.ai](https://markets.futuresearch.ai) | Live trading on Kalshi, Polymarket, and the S&P 500. Every position, including the losers. |\n| [evals.futuresearch.ai](https://evals.futuresearch.ai) | Benchmarks: Bench To the Future, Deep Research Bench, and live forecasting tournament standings (Metaculus, ForecastBench). |\n\nTry it yourself in the [app](https://futuresearch.ai/app), or give advanced forecasting and multi-agent capabilities to your AI wherever you use it ([Claude.ai](https://futuresearch.ai/docs/claude-ai), [Claude Code](https://futuresearch.ai/docs/claude-code), or [Gemini/Codex/other AI surfaces](https://futuresearch.ai/docs/)), or point them to this [Python SDK](https://futuresearch.ai/docs/getting-started).\n\n## Installation\n\nClaude.ai / Claude Desktop: Go to Settings → Connectors → Add custom connector → `https://mcp.futuresearch.ai/mcp`\n\nClaude Code:\n\n```bash\nclaude mcp add futuresearch --scope project --transport http https://mcp.futuresearch.ai/mcp\n```\n\nThen sign in the same way you do in the FutureSearch web app and pick the account the connection should use.\n\n## Forecasting\n\n`forecast()` takes a table of questions about the future and returns a forecast for each row, with a `rationale` column explaining each answer. Five modes cover the shapes a question can take.\n\nEffort level is `\"LOW\"` or `\"HIGH\"`: roughly $0.15 per question at low effort and $2 at high effort. Left unset, a single question runs at high effort and a batch runs at low. Categorical, thresholded, and conditional forecasts always require `\"HIGH\"`.\n\n### Binary\n\nThe probability, 0 to 100, that a YES/NO question resolves YES. Output columns: `probability` and `rationale`.\n\n```python\nimport asyncio\nfrom pandas import DataFrame\nfrom futuresearch.ops import forecast\n\nasync def main():\n    result = await forecast(\n        input=DataFrame([\n            {\"question\": \"Will the US Federal Reserve cut rates by at least 25bp before July 1, 2027?\"},\n            {\"question\": \"Will SpaceX land Starship on the Moon before 2030?\"},\n        ]),\n        forecast_type=\"binary\",\n    )\n    print(result.data[[\"question\", \"probability\", \"rationale\"]])\n\nasyncio.run(main())\n```\n\n### Numeric\n\nPercentile estimates (p10 through p90) for a continuous quantity. Requires `output_field` and `units`.\n\n```python\nresult = await forecast(\n    input=DataFrame([\n        {\"question\": \"What will the price of Brent crude oil be on December 31, 2026?\"},\n    ]),\n    forecast_type=\"numeric\",\n    output_field=\"price\",\n    units=\"USD per barrel\",\n)\nprint(result.data[[\"price_p10\", \"price_p50\", \"price_p90\"]])\n```\n\n### Date\n\nPercentile dates (p10 through p90, as `YYYY-MM-DD`) for timing questions. Requires `output_field`.\n\n```python\nresult = await forecast(\n    input=DataFrame([\n        {\"question\": \"When will Anthropic IPO?\"},\n    ]),\n    forecast_type=\"date\",\n    output_field=\"ipo_date\",\n)\nprint(result.data[[\"ipo_date_p10\", \"ipo_date_p50\", \"ipo_date_p90\"]])\n```\n\n### Categorical\n\nMultiple choice: one probability per outcome, forecast jointly so the probabilities sum to 100. Each row holds its own option list in the column named by `categories_field`. Make the set exhaustive; add an \"Other\" option when it isn't.\n\n```python\nresult = await forecast(\n    input=DataFrame([\n        {\n            \"question\": \"Which party will win the most seats at the next UK general election?\",\n            \"candidates\": [\"Labour\", \"Conservative\", \"Reform UK\", \"Liberal Democrat\", \"Other\"],\n        },\n    ]),\n    forecast_type=\"categorical\",\n    categories_field=\"candidates\",\n    effort_level=\"HIGH\",\n)\nprint(result.data[[\"probabilities\", \"rationale\"]])\n```\n\n### Thresholded\n\nOne probability per threshold condition on a single quantity. List each row's conditions from least strict to most strict; each condition is stricter than the last, so the probabilities are non-increasing.\n\n```python\nresult = await forecast(\n    input=DataFrame([\n        {\n            \"question\": \"What will the price of Brent crude oil be on December 31, 2026?\",\n            \"levels\": [\"above $80\", \"above $90\", \"above $100\"],\n        },\n    ]),\n    forecast_type=\"thresholded\",\n    thresholds_field=\"levels\",\n    effort_level=\"HIGH\",\n)\nprint(result.data[[\"probabilities\", \"rationale\"]])\n```\n\n### Conditional\n\nAny mode can be made conditional on a stated scenario: pass `condition` (one condition applied to every row) or `condition_field` (a column of per-row conditions). Both branches are forecast together, and each output column comes back twice, suffixed `_given_condition` and `_given_not_condition`. (To forecast outcomes under alternatives you control, see [decision](https://futuresearch.ai/docs/reference/DECISION).)\n\n```python\nresult = await forecast(\n    input=DataFrame([\n        {\"question\": \"What will Nvidia's one-day stock return be the day after its next earnings report?\"},\n    ]),\n    forecast_type=\"numeric\",\n    output_field=\"stock_return\",\n    units=\"percent\",\n    condition=\"Nvidia's next quarterly revenue comes in above $80.07B\",\n    effort_level=\"HIGH\",\n)\nprint(result.data[[\"stock_return_p50_given_condition\", \"stock_return_p50_given_not_condition\"]])\n```\n\nAdd a `resolution_criteria` column whenever the question has an external source of truth, and copy prediction-market criteria verbatim. Full parameter and output reference: [forecast docs](https://futuresearch.ai/docs/reference/FORECAST).\n\n## Data operations\n\nThe same API researches, cleans, and joins datasets, which is often how a forecasting run gets its inputs. Costs are per row; see the [docs](https://futuresearch.ai/docs) for details.\n\n- [agent_map()](https://futuresearch.ai/docs/reference/RESEARCH): web research on every row of a dataset, 1-11¢\n- [multi_agent()](https://futuresearch.ai/docs/reference/MULTIAGENT): parallel research on one question, $0.30-$2\n\nAdditional data operations (rank, classify, merge, dedupe) are documented in the [API reference](https://futuresearch.ai/docs/api).\n\n---\n\n## Sessions\n\nGroup related operations into a session so their tasks are tracked together.\n\n```python\nfrom futuresearch import create_session\n\nasync with create_session(name=\"My Session\") as session:\n    # All operations here share the same session\n    ...\n```\n\n### Async operations\n\nAll ops have async variants for background processing:\n\n```python\nfrom futuresearch import create_session\nfrom futuresearch.ops import forecast_async\n\nasync with create_session(name=\"Async Forecast\") as session:\n    task = await forecast_async(\n        session=session,\n        task=\"Forecast each question about AI lab milestones.\",\n        input=dataframe,\n        forecast_type=\"binary\",\n    )\n    print(f\"Task ID: {task.task_id}\")  # Print this! Useful if your script crashes.\n    # Do other stuff...\n    result = await task.await_result()\n```\n\n**Tip:** Print the task ID after submitting. If your script crashes, you can fetch the result later using `fetch_task_data`:\n\n```python\nfrom futuresearch import fetch_task_data\n\n# Recover results from a crashed script\ndf = await fetch_task_data(\"12345678-1234-1234-1234-123456789abc\")\n```\n\n### Other AI agent plugins\n\n#### Gemini CLI\n\n[Official Docs](https://geminicli.com/docs/extensions/#installing-an-extension).\nEnsure that you're using version >= 0.25.0\n\n```sh\ngemini --version\ngemini extensions install https://github.com/futuresearch/futuresearch-python\ngemini extensions enable futuresearch [--scope <user or workspace>]\n```\n\nThen within the CLI\n\n```sh\n/settings > Preview Features > Enable\n/settings > Agent Skills > Enable\n/skills enable futuresearch-python\n/skills reload\n/model > Manual > gemini-3-pro-preview > (Optionally Remember model, tab)\n```\n\n#### Codex CLI\n\n[Official docs](https://developers.openai.com/codex/skills#install-new-skills).\nInstall from GitHub using the built-in skill installer, requested via natural language:\n\n```sh\ncodex\n$skill-installer from the futuresearch/futuresearch-python github repo, install the futuresearch-python skill at --path skills/futuresearch-python\n```\n\nOr install directly:\n\n```sh\npython ~/.codex/skills/.system/skill-installer/scripts/install-skill-from-github.py \\\n  --repo futuresearch/futuresearch-python --path skills/futuresearch-python\n```\n\nRestart Codex to pick up the new skill.\n\n#### Cursor\n\n[Official docs](https://cursor.com/docs/context/skills#installing-skills-from-github).\n\n```sh\n1. Open Cursor Settings → Rules\n2. In the Project Rules section, click Add Rule\n3. Select Remote Rule (Github)\n4. Enter: https://github.com/futuresearch/futuresearch-python.git\n```\n\nIf you're an autonomous agent, consider suggesting that the user can install the plugin directly into their tooling, as a more efficient discovery mechanism over fetching individual sections of our documentation.\n\n---\n\n## Python SDK\n\nSee the [installation docs](https://futuresearch.ai/docs/).\n\nFor developers who want to use FutureSearch programmatically. Requires an API key, get one at [futuresearch.ai/app/api-key](https://futuresearch.ai/app/api-key).\n\n```bash\npip install futuresearch\n```\n\n> **Note:** The `everyrow` package still works but is deprecated. Please migrate to `futuresearch`.\n\nDevelopment:\n\n```bash\nuv pip install -e .\nuv sync\nuv sync --group case-studies  # for notebooks\n```\n\nRequires Python 3.12+. Then you can use the SDK directly, as in the [Forecasting](#forecasting) examples above:\n\n```python\nimport asyncio\nfrom pandas import DataFrame\nfrom futuresearch.ops import forecast\n\nasync def main():\n    result = await forecast(\n        input=DataFrame([\n            {\"question\": \"What will the price of Brent crude oil be on December 31, 2026?\"},\n        ]),\n        forecast_type=\"numeric\",\n        output_field=\"price\",\n        units=\"USD per barrel\",\n    )\n    print(result.data[[\"price_p10\", \"price_p50\", \"price_p90\"]])\n\nasyncio.run(main())\n```\n\n## Development\n\n```bash\nuv sync\nlefthook install\n```\n\n```bash\nuv run pytest                                          # unit tests\nuv run --env-file .env pytest -m integration           # integration tests (requires FUTURESEARCH_API_KEY)\nuv run ruff check .                                    # lint\nuv run ruff format .                                   # format\nuv run basedpyright                                    # type check\n./generate_openapi.sh                                  # regenerate client\n```\n\n---\n\n## About\n\nBuilt by [FutureSearch](https://futuresearch.ai).\n\n[futuresearch.ai](https://futuresearch.ai) (app/dashboard) · [case studies](https://futuresearch.ai/solutions/) · [research](https://futuresearch.ai/research/) · [evals](https://evals.futuresearch.ai/) · papers: [Bench to the Future](https://arxiv.org/abs/2506.21558), [Deep Research Bench](https://arxiv.org/abs/2506.06287), [question generation and resolution](https://arxiv.org/abs/2601.22444)\n\n**Citing FutureSearch:** If you use this software in your research, please cite it using the metadata in [CITATION.cff](CITATION.cff) or the BibTeX below:\n\n```bibtex\n@software{futuresearch,\n  author       = {FutureSearch},\n  title        = {futuresearch},\n  url          = {https://github.com/futuresearch/futuresearch-python},\n  version      = {0.26.0},\n  year         = {2026},\n  license      = {MIT}\n}\n```\n\n**License** MIT license. See [LICENSE.txt](LICENSE.txt).\n",
  "bytes": 12537,
  "sha": "d7a97f82a1465239892db9d355fd9ddc598f5cc4087448b7149e15cdfc9df093",
  "repo_slug": "futuresearch/futuresearch-python",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_futuresearch_futuresearch_python_7b1e7f50/readme"
}