Skip to main content
Glama

Package

Python PyPI Total downloads PyPI monthly downloads

Agents

MCP server MCP Registry Claude Code plugin

Meta

License DOI

Testing

Build status codecov

Community

!discord !linkedin Forecasting Python

About skforecast-ai

The forecasting assistant that shows its work. Give skforecast-ai a time series: it profiles the data, chooses the model with deterministic rules, validates it and returns the forecast together with the skforecast script that produced it. Every decision comes from a rule you can read, the same data always gives the same result, and the script runs on its own with plain skforecast. An optional LLM explains every decision; it never makes them.

36-hour LightGBM forecast of hourly bike sharing users, with its 80% prediction interval against the held-out hours, and the answer of ask() that explains its metrics. Real skforecast-ai outputs, from the animation on ai.skforecast.org.

Related MCP server: timesfm-mcp

Installation

pip install skforecast-ai

The LLM layer is optional. To use it, install the extra ([bedrock] for AWS Bedrock):

pip install "skforecast-ai[llm]"

Requires Python 3.10 or newer. More options in the installation guide; to install from source, see the Contribution Guide.

Quick example

Open In Colab Try it without installing anything: Your first forecast runs in Google Colab, from the data to a validated forecast, with no API key.

from skforecast_ai import ForecastingAssistant
from skforecast.datasets import load_demo_dataset

# Download demo dataset (monthly)
data = load_demo_dataset(verbose=False)

# Profile the data, plan the model, generate the script and run it,
# evaluated on the last 12 months. No LLM needed.
assistant = ForecastingAssistant()
result = assistant.forecast(data=data, target="y", steps=12, test_size=12)

result.predictions.head()
#                 pred
# 2007-07-01  0.851486
# 2007-08-01  1.048000
# 2007-09-01  0.998147
# 2007-10-01  1.147577
# 2007-11-01  1.110845

result.metrics
#    mean_absolute_error  root_mean_squared_error  mean_absolute_scaled_error  \
# 0             0.078442                 0.094514                    0.802828
#
#    mean_absolute_percentage_error
# 0                        0.088608

print(result.code)  # the skforecast script that produced this result

That single call chose a ForecasterRecursive with a Ridge estimator, its lags and window features, and ran the script that result.code returns. result.profile and result.plan hold every decision and the rule behind it. Drop test_size to train on all the data and forecast the next 12 months.

# End-to-end forecast
skforecast-ai forecast data.csv --target y --date-column date --steps 12

# Only the standalone script, without running it
skforecast-ai forecast-code data.csv --target y --date-column date --steps 12 --output forecast.py

The CLI covers the whole pipeline, including ask() and the prompts of refine_plan() and create_cv(). See Using the CLI.

# pip install "skforecast-ai[llm]"
assistant = ForecastingAssistant(llm="openai:gpt-5.5")

answer = assistant.ask(
    "Is the MASE good, and why was this estimator chosen?",
    context=result,
)

ask() reads the object you pass and explains it, grounded in the skforecast agent skills. It never changes the result. The dataset is never sent: a result shares only its own predictions and metrics, with a warning. Providers, credentials and local models are covered in Configuring the LLM.

In Claude Code, install the server and its skill as a plugin:

/plugin marketplace add skforecast/skforecast-ai
/plugin install skforecast-ai@skforecast-ai

Then ask in plain language: "Forecast the next 12 months of data/sales.csv and tell me how accurate it is." The agent brings the language model and calls skforecast-ai as tools; every decision still comes from the same deterministic rules, every result comes with the script that produced it, and responses never carry rows of your data. The setups for Cursor, VS Code, Codex and Claude Desktop are in MCP server for coding agents.

A real Claude Code session with the server and its skill, from the agent check of skforecast-ai 0.5.0, abridged: the first three calls share a row, and an ellipsis marks every cut in a response or in the answer. The whole session shows every call, every message of the agent and its complete answer.

In VS Code, this button adds the server and asks for the directory with your data (it needs uv):

Install in VS Code

Features

A deterministic engine

  • Data profiling: frequency, missing values, exogenous and categorical variables, and the significant lags from the partial autocorrelation.

  • A plan with a rule for every decision: forecaster and estimator, lags, window and calendar features, prediction intervals, metric and cross-validation.

  • The code you see is the code that ran: forecast() and backtest() execute the same script that forecast_code() and backtest_code() return. Inspect it, version it or run it with plain skforecast.

  • Model selection with compare(): every candidate is backtested with the same data and cross-validation, and the ranking is a plain sort of the metric. For a single series, a seasonal naive baseline is ranked alongside them, so you also see whether a model beats the simplest reasonable forecast.

  • Reproducible: the same input always gives the same profile, plan, script and predictions.

  • Python or terminal: the CLI runs the same pipeline from a CSV file or URL.

  • Coding agents: an MCP server gives Claude Code, Cursor and other MCP clients the same pipeline as tools, with a skill that teaches them to use it. Responses never carry rows of your data.

The engine chooses among the forecasters of skforecast: recursive and direct, multi-series and multivariate, statistical (ARIMA) and foundation models.

An optional LLM layer

  • Explains a forecast, a backtest, a comparison, a plan or a script in plain language with ask(), or answers a general forecasting question.

  • Refines lags and window features from your domain knowledge with refine_plan(prompt=...).

  • Translates a deployment scenario into a backtesting strategy with create_cv(prompt=...).

  • Validated before it runs: every LLM output is checked by a Pydantic model; if it is not valid, you get the deterministic result and a warning.

  • Any provider through pydantic-ai: OpenAI, Anthropic, Google, Groq, AWS Bedrock, Ollama for local models, or any OpenAI-compatible endpoint.

Methods

All methods work without an LLM except ask(). A prompt is always explicit: nothing is sent to an LLM unless you ask for it.

Method

What it does

LLM

profile()

Inspects the data and recommends a forecaster and an estimator

no

plan()

Builds the plan: lags, window and calendar features, interval, metric

no

refine_plan()

Changes a plan with explicit overrides, or with a prompt

optional

create_cv()

Builds the cross-validation strategy, or translates a prompt into one

optional

forecast(), forecast_code()

Runs the forecast, or returns its script without running it

no

backtest(), backtest_code()

Runs the backtest, or returns its script without running it

no

compare()

Backtests several configurations and ranks them

no

ask()

Explains a profile, plan, script or result, or answers a question

required

How it works

skforecast-ai has two ways in, on the same engine. The fast path goes from data to a forecast or a backtest in one call. The step-by-step path returns each intermediate object (profile, plan, cross-validation) so you can inspect it, change it or refine it with the LLM before running anything. Both branch into forecasting and backtesting, compare() picks the best configuration from measured performance, and ask() explains any object along the way.

Read more in Agentic forecasting and Agentic forecasting step by step.

Documentation

The full documentation is available at https://ai.skforecast.org.

Documentation

Quick start

Install skforecast-ai, run your first forecast and ask the assistant

Agentic forecasting

The fast path: profile, forecast, backtest, compare and ask

Step by step

Every intermediate object, and how to change it

Configuring the LLM

Providers, credentials, local models and what is sent

Using the CLI

The same pipeline from the terminal

MCP server for coding agents

The same pipeline as tools for Claude Code, Cursor and other MCP clients

API Reference

ForecastingAssistant, its results, schemas and the CLI

Releases

What changed in each version

Part of the skforecast family

Skforecast Docs GitHub Skforecast Studio

  • skforecast: the forecasting library that runs every forecast of skforecast-ai. Machine learning, statistical and foundation models, backtesting and tuning.

  • Skforecast Studio: a no-code application to build forecasting models visually, which generates production-ready Python code.

Contributing

Bug reports, feature requests, code, tests and documentation are all welcome. Open an issue on GitHub Issues or read the Contribution Guide and the Code of Conduct to get started.

skforecast-ai is created and maintained by Joaquín Amat Rodrigo and Javier Escobar Ortiz, together with everyone who has contributed to it (about the project).

Citation

If you use skforecast-ai in a scientific publication, please cite the version you used: each version has its own DOI and ready-made citations on Zenodo. To cite skforecast-ai in general, use the DOI that always resolves to the latest release.

APA:

Amat Rodrigo, J., & Escobar Ortiz, J. skforecast-ai [Computer software]. https://doi.org/10.5281/zenodo.21338159

BibTeX:

@software{skforecast-ai,
  author  = {Amat Rodrigo, Joaquin and Escobar Ortiz, Javier},
  title   = {skforecast-ai},
  license = {Apache-2.0},
  url     = {https://ai.skforecast.org/},
  doi     = {10.5281/zenodo.21338159}
}

The citation metadata is also in CITATION.cff (GitHub's "Cite this repository" button).

Sponsorship and funding

skforecast-ai is built by the skforecast team. skforecast is free, open-source software supported by the Sovereign Tech Fund and by the organizations that sponsor it. If your company relies on skforecast or skforecast-ai, see Sponsorship and funding for sponsorship tiers, support agreements, feature sponsorship and training.

Individuals can support the project through Open Collective, Buy Me a Coffee, GitHub Sponsors (Joaquín Amat Rodrigo, Javier Escobar Ortiz) or PayPal.

License

skforecast-ai software: Apache License 2.0. The underlying skforecast engine is distributed under its own BSD-3-Clause License.

skforecast-ai documentation: CC BY-NC-SA 4.0

Trademark: The trademark skforecast is registered with the European Union Intellectual Property Office (EUIPO) under the application number 019109684. Unauthorized use of this trademark, its logo, or any associated visual identity elements is strictly prohibited without the express consent of the owner.

Available Tools

11 tools
backtestA

Backtest one plan with a cv id of create_cv: metrics over the folds, with the predictions and metrics in CSV files named by the new id, so no run overwrites another. To rank several configurations, use compare. Returns a backtest id.

Inputs: cv_id (required), plan_id, confirm_cost. Returns: Envelope returned by the tools that create an object, and by `describe_object`.…

compareA

Backtest several configurations on the folds of a cv id of create_cv and rank them by metric; for one plan, use backtest. Reports progress per candidate and can be cancelled between candidates. Returns a comparison id and the plan of the winner in links.best_plan_id, which forecast takes.

Inputs: cv_id (required), metric, baseline, interval, +2 more. Returns: Envelope returned by the tools that create an object, and by `describe_object`.…

create_cvA

Build a time series cross-validation strategy (TimeSeriesFold) for a plan id. Returns a cv id, which backtest and compare take, and its cost in cost: read it before running them.

Inputs: plan_id (required), gap, refit, skip_folds, +4 more. Returns: Envelope returned by the tools that create an object, and by `describe_object`.…

describe_objectA
Read-only

Return again the response that created an object (summary, links, notices, files), from an id of any response or of list_objects.

Inputs: object_id (required). Returns: Envelope returned by the tools that create an object, and by `describe_object`.…

forecastA

Run a plan: forecast the future, or evaluate on a test set with test_size. Predictions and metrics go to CSV files. A forecast of the future has no error measure: backtest or compare the plan first. Returns a forecast id.

Inputs: plan_id (required), exog_path, test_size. Returns: Envelope returned by the tools that create an object, and by `describe_object`.…

get_codeA
Read-only

Return the Python script of an object and the packages it needs: the one that ran, or that would run for a plan (a profile has none). For a run that failed, use get_failure.

Inputs: object_id (required), candidate. Returns: Script of an object, returned by the `get_code` tool. Attributes ---------- id…

get_failureA
Read-only

Return the traceback and the code of a failed run (the details.failure_id of an error) or of a failed candidate of a comparison. The id of an object that did not fail is invalid_argument; for the script of a run that worked, use get_code.

Inputs: object_id (required), candidate. Returns: Full description of a failure, returned by the `get_failure` tool. Attributes -…

list_objectsA
Read-only

List the ids of the profiles, plans, strategies and runs the server keeps, most recently used first; beyond its limits the least recently used are removed, and none survives a restart. Use describe_object to read one.

Inputs: kind. Returns: Objects registered in the server, returned by `list_objects`. Attributes ------…

planA

Build a forecasting plan (lags, window features, metric, preprocessing, interval) from a profile id and a horizon. Returns a plan id, which create_cv and forecast take. To change a decision of an existing plan, use refine_plan.

Inputs: steps (required), profile_id (required), lags, metric, +10 more. Returns: Envelope returned by the tools that create an object, and by `describe_object`.…

profileA

Profile a CSV file: frequency, series, exogenous columns and the recommended forecaster and estimator. The first step: returns a profile id, which plan takes.

Inputs: data_path (required), sep, target, decimal, +5 more. Returns: Envelope returned by the tools that create an object, and by `describe_object`.…

refine_planA

Build a new plan from an existing one, changing some of its decisions and keeping the others: use it instead of plan to change a plan. Returns a new plan id; the original plan is kept.

Inputs: plan_id (required), overrides (required). Returns: Envelope returned by the tools that create an object, and by `describe_object`.…

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 11 tools

    Disambiguation4/5

    Each tool has a fairly distinct role in the pipeline, and the descriptions explicitly resolve the riskiest pairs (get_failure vs get_code, plan vs refine_plan, backtest vs compare, list_objects vs describe_object). Residual overlap remains between backtest and compare, and between profile/plan/forecast as bare nouns, but the descriptions steer selection well.

    Naming Consistency3/5

    Most names are snake_case, but the convention is split: verb_noun for retrieval/utility tools (get_failure, list_objects, describe_object, refine_plan, create_cv) and bare nouns for the modeling steps (profile, plan, backtest, compare, forecast). It is readable and semi-predictable (nouns create objects, verbs retrieve them), but not a uniform pattern.

    Tool Count5/5

    Eleven tools map cleanly onto a short ML workflow (profile → plan → cv → backtest/compare → forecast) plus inspection helpers, with no redundant entries. Each tool earns its place and the set stays within a comfortable range.

    Completeness4/5

    The core forecasting lifecycle is covered end-to-end, including refinement, cross-validation, ranking, and script/failure retrieval. Minor gaps: no way to delete or clean up objects and no cancel operation, even though compare is described as cancellable, and artifact CSVs must be read outside the server.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Local MCP server for GPU-backed TimesFM 2.5 forecasting, enabling zero-shot time-series forecasting, covariate forecasting, anomaly detection, and CSV forecasting via MCP tools.
      2
      Apache 2.0
    • F
      license
      A
      quality
      D
      maintenance
      Enables demand forecasting and replenishment recommendations using statistical models (Syntetos-Boylan classification, AutoETS, TSB) and provides tools for forecasting, evaluation, and order quantity calculation.
      6
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables users to perform deterministic time series forecasting through Claude by running reproducible Python statistical and foundation models, providing tools for loading data, cross-validation, forecasting, anomaly detection, and exporting re-runnable manifests without any LLM involvement.
      8
      MIT