{"record":{"id":"87c9294b0012d74d","repo":"huggingface/smolagents","slug":"cannot-specify-both-messages-and-steps-paramet","errorCode":null,"errorMessage":"Cannot specify both 'messages' and 'steps' parameters. Use 'steps' instead.","messagePattern":"Cannot specify both 'messages' and 'steps' parameters\\. Use 'steps' instead\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/smolagents/agents.py","lineNumber":221,"sourceCode":"        token_usage (TokenUsage | None): Count of tokens used during the run.\n        timing (Timing): Timing details of the agent run: start time, end time, duration.\n        messages (list[dict]): The agent's memory, as a list of messages.\n            <Deprecated version=\"1.22.0\">\n            Parameter 'messages' is deprecated and will be removed in version 1.25. Please use 'steps' instead.\n            </Deprecated>\n    \"\"\"\n\n    output: Any | None\n    state: Literal[\"success\", \"max_steps_error\"]\n    steps: list[dict]\n    token_usage: TokenUsage | None\n    timing: Timing\n\n    def __init__(self, output=None, state=None, steps=None, token_usage=None, timing=None, messages=None):\n        # Handle deprecated 'messages' parameter\n        if messages is not None:\n            if steps is not None:\n                raise ValueError(\"Cannot specify both 'messages' and 'steps' parameters. Use 'steps' instead.\")\n            warnings.warn(\n                \"Parameter 'messages' is deprecated and will be removed in version 1.25. Please use 'steps' instead.\",\n                FutureWarning,\n                stacklevel=2,\n            )\n            steps = messages\n\n        # Initialize with dataclass fields\n        self.output = output\n        self.state = state\n        self.steps = steps\n        self.token_usage = token_usage\n        self.timing = timing\n\n    @property\n    def messages(self):\n        \"\"\"Backward compatibility property that returns steps.\"\"\"\n        warnings.warn(","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/huggingface/smolagents/blob/30bb1161095dbae2271e6bc3cc4c219cc3897a57/src/smolagents/agents.py#L203-L239","documentation":"RunResult (and similar result/output objects) accept a deprecated 'messages' parameter that was renamed to 'steps'. Passing both at once is ambiguous, so the constructor raises a ValueError and asks you to use 'steps' only.","triggerScenarios":"Constructing a result object with both keyword arguments, e.g. RunResult(messages=old_messages, steps=new_steps), typically while migrating pre-1.25 code that passed 'messages' and partially updated to the new API.","commonSituations":"Upgrading smolagents to >=1.25 where 'messages' was deprecated (removal slated for 1.25); copy-pasting new example code into old code that still passes messages=...; library wrappers that forward **kwargs and end up setting both.","solutions":["Remove the messages=... argument and pass only steps=...","If building kwargs dynamically, ensure the key is 'steps' and that 'messages' is not also set","Silence the FutureWarning path entirely by never using 'messages' once migrated"],"exampleFix":"# before\nresult = RunOutput(output=ans, messages=steps_list, steps=steps_list)\n\n# after\nresult = RunOutput(output=ans, steps=steps_list)","handlingStrategy":"validation","validationCode":"def build_result(output, steps, **legacy):\n    if legacy.get(\"messages\") and steps:\n        raise ValueError(\"pass only 'steps'\")\n    steps = steps or legacy.get(\"messages\")\n    return RunOutput(output=output, steps=steps)","typeGuard":null,"tryCatchPattern":"try:\n    result = RunOutput(output=o, steps=s)\nexcept ValueError as e:\n    if 'messages' in str(e):\n        # drop the messages= kwarg and rebuild with steps only\n        ...","preventionTips":["Grep codebase for messages= usage on RunOutput/agent results and migrate to steps=","Treat FutureWarning about 'messages' as a migration to-do, not noise"],"tags":["smolagents","deprecated-parameter","api-migration","valueerror"],"backgroundTag":"deprecated-parameter-conflict","analyzedSha":"30bb1161095dbae2271e6bc3cc4c219cc3897a57","analyzedAt":"2026-08-28T18:52:54.169Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}