huggingface/smolagents · warning · FutureWarning

Parameter 'messages' is deprecated and will be removed in ve

Error message

Parameter 'messages' is deprecated and will be removed in version 1.25. Please use 'steps' instead.

What it means

MultiStepStep (agent memory step) renamed its 'messages' constructor parameter to 'steps'. Passing messages=... emits this FutureWarning (removal in 1.25) and copies the value into steps; passing both messages and steps raises a ValueError instead. It exists purely as a deprecation bridge.

Source

Thrown at src/smolagents/agents.py:222

        timing (Timing): Timing details of the agent run: start time, end time, duration.
        messages (list[dict]): The agent's memory, as a list of messages.
            <Deprecated version="1.22.0">
            Parameter 'messages' is deprecated and will be removed in version 1.25. Please use 'steps' instead.
            </Deprecated>
    """

    output: Any | None
    state: Literal["success", "max_steps_error"]
    steps: list[dict]
    token_usage: TokenUsage | None
    timing: Timing

    def __init__(self, output=None, state=None, steps=None, token_usage=None, timing=None, messages=None):
        # Handle deprecated 'messages' parameter
        if messages is not None:
            if steps is not None:
                raise ValueError("Cannot specify both 'messages' and 'steps' parameters. Use 'steps' instead.")
            warnings.warn(
                "Parameter 'messages' is deprecated and will be removed in version 1.25. Please use 'steps' instead.",
                FutureWarning,
                stacklevel=2,
            )
            steps = messages

        # Initialize with dataclass fields
        self.output = output
        self.state = state
        self.steps = steps
        self.token_usage = token_usage
        self.timing = timing

    @property
    def messages(self):
        """Backward compatibility property that returns steps."""
        warnings.warn(
            "Parameter 'messages' is deprecated and will be removed in version 1.25. Please use 'steps' instead.",

View on GitHub (pinned to 30bb116109)

Solutions

  1. Rename the keyword: pass steps=[...] instead of messages=[...]
  2. Silence during migration with warnings.filterwarnings('ignore', category=FutureWarning, module='smolagents')
  3. Update any persistence/serialization layer that writes the old 'messages' key

Example fix

# before
step = MultiStepStep(output=res, messages=messages)

# after
step = MultiStepStep(output=res, steps=messages)
Defensive patterns

Strategy: validation

Validate before calling

step = MultiStepStep(output=res, **{'steps' if 'messages' in kwargs else 'steps': kwargs.get('steps', kwargs.get('messages'))) if False else MultiStepStep(output=res, steps=kwargs.get('steps', kwargs.get('messages')))

Try / catch

import warnings
with warnings.catch_warnings():
    warnings.simplefilter('ignore', FutureWarning)
    step = MultiStepStep(output=res, messages=msgs)  # temporary shim

Prevention

When it happens

Trigger: Constructing MultiStepStep(output=..., messages=[...]) or copying old serialization dicts that include a 'messages' key, after upgrading smolagents.

Common situations: Upgrading from pre-rename smolagents; pickled/JSON-serialized memory steps rehydrated with old field names; tutorials with legacy code.

Related errors


AI-assisted analysis of huggingface/smolagents@30bb116109 (2026-08-28). Data as JSON: /api/errors/f46c706740bca998. Report an issue: GitHub.