Skip to main content

xrtm-forecast v0.12.0

PyPI

License Python

The Runtime Engine for XRTM.

xrtm-forecast provides the agents, providers, topologies, and orchestration to build AI forecasting systems. It's a composable framework — import the pieces you need and wire them together.

What's new in v0.12

  • Baselines: MarketImpliedBaseline (the honest benchmark for prediction markets), BaseRateBaseline, and ConstantBaseline.
  • Lexical retrieval: zero-dependency BM25 LexicalRetriever for archive search/dedup without embedding models.

What's new in v0.11

  • Search-result cache: CachedSearchTool caches tool results with a TTL, cutting external API calls and making backtests reproducible.

What's new in v0.10

  • Reasoning-model ready: thinking-mode toggle, reasoning_content handling, and explicit EmptyContentError (plus a larger-max_tokens retry) instead of silent parse failures.
  • Structured output + telemetry: provider-enforced JSON, parse_status, token usage (including cached/reasoning tokens), and model/prompt provenance on every forecast.
  • Typed decisions: DecisionProvider (LLM and TypeSafe Jev) with an escalation router for cheap System-One gating.
  • Cost policies: currency-aware pricing (DeepSeek CNY preset), cost ledgers, hard budgets, and off-peak scheduling.
  • Reliability: token-bucket rate limiting, jittered retries, cache TTL, and deterministic-only caching by default.

Installation

pip install xrtm-forecast

Quick Start

from xrtm.forecast.kit.agents.specialists.analyst import ForecastingAnalyst
from xrtm.forecast.core.config.inference import OpenAIConfig
from xrtm.forecast.providers.inference.factory import ModelFactory

# Use any OpenAI-compatible endpoint


config = OpenAIConfig(
    model_id="your-model",
    base_url="$OPENAI_BASE_URL",
    api_key="your-api-key",
)
provider = ModelFactory.get_provider(config)
analyst = ForecastingAnalyst(model=provider, name="forecaster")

# Ask a forecasting question
from xrtm.data import ForecastQuestion
question = ForecastQuestion(
    id="fed-march-2025",
    title="Will the Fed raise rates in March 2025?",
)
forecast = await analyst.run(question)
print(f"Probability: {forecast.probability:.2f}")

What's Included

OpenAI-compatible Provider

One provider that works with any OpenAI-compatible API: any OpenAI-compatible endpoint. Set base_url to point anywhere.

Agents

  • ForecastingAnalyst — Full forecast agent: structured prompts, causal reasoning traces, JSON output parsing
  • LLMAgent — Base agent with tool retrieval, output parsing
  • RoutingAgent — FAST/SMART tiered routing for cost optimization
  • ToolAgent / GraphAgent — Wrap functions or sub-graphs as agents

Topologies

Composable multi-agent patterns in kit/topologies/:

  • RecursiveConsensus — Parallel analysts → aggregate → supervisor → loop
  • create_debate_graph() — Pro/Con/Judge debate pattern
  • create_fanout_graph() — Parallel workers → aggregator

Orchestration

  • Orchestrator — DAG state machine for workflow graphs
  • AsyncRuntime — Chronos-aware async runtime

Infrastructure

  • InferenceCache — SQLite cache for LLM responses (enabled by default)
  • Retry with backoff — 2 retries on API errors
  • LeakageGuardian — Temporal leakage prevention for backtests

XRTM Ecosystem

Part of the XRTM forecasting stack:

Package Role Version
xrtm-data Schemas & question sources 0.3.0
xrtm-eval Scoring (Brier, ECE, LogScore) 0.3.0
xrtm-forecast Runtime engine (this package) 0.7.0
xrtm-train Backtesting & optimization 0.3.0
xrtm Product CLI 0.9.0

License

Apache 2.0

Metadata

Release files for xrtm-forecast 0.13.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xrtm-forecast 0.13.1
File Size Uploaded Provenance
xrtm_forecast-0.13.1.tar.gz 88.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for xrtm-forecast 0.13.1
File Interpreter ABI Platform
xrtm_forecast-0.13.1-py3-none-any.whl Python 3 none any Details

Total release size: 229.2 kB

Release files / xrtm_forecast-0.13.1.tar.gz

Download URL xrtm_forecast-0.13.1.tar.gz
Size 88.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2093b2c0d15d99f98e31298401c39d4652a6a879b5bb59ed39fb22cda86ea6ba
BLAKE2b-256 checksum
How to use checksums
f965c925fea4a8416f9cd3b59be62ef927b9d5f1b9743b094ac79a6e7ff0233c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / xrtm_forecast-0.13.1-py3-none-any.whl

Download URL xrtm_forecast-0.13.1-py3-none-any.whl
Size 140.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d66ecae0cecfd6d596e75cdd15cf9356e05d15672d26dfdb3d803f3fed6bbbc
BLAKE2b-256 checksum
How to use checksums
99b0ea24f55904d08a3faabf02204c342b8dc0b15db898df91e9221f64e68c8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Security for xrtm-forecast 0.13.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for xrtm_forecast-0.13.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.13.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page