huggingface/smolagents · error · ValueError

Unsupported action type: {action_type}

Error message

Unsupported action type: {action_type}

What it means

Raised by run_smolagent in the smolagents CLI when --action-type is neither 'code' (CodeAgent) nor 'tool_calling' (ToolCallingAgent). It is the final else of the agent-type dispatch and guards against unsupported agent paradigms.

Source

Thrown at src/smolagents/cli.py:257

            description = f"Tool loaded from Hugging Face Space: {tool_name}"
            available_tools.append(Tool.from_space(space_id=tool_name, name=space_name, description=description))
        else:
            if tool_name in TOOL_MAPPING:
                available_tools.append(TOOL_MAPPING[tool_name]())
            else:
                raise ValueError(f"Tool {tool_name} is not recognized either as a default tool or a Space.")

    if action_type == "code":
        agent = CodeAgent(
            tools=available_tools,
            model=model,
            additional_authorized_imports=imports,
            stream_outputs=True,
        )
    elif action_type == "tool_calling":
        agent = ToolCallingAgent(tools=available_tools, model=model, stream_outputs=True)
    else:
        raise ValueError(f"Unsupported action type: {action_type}")

    agent.run(prompt)


def main() -> None:
    args = parse_arguments()

    # Check if we should run in interactive mode
    # Interactive mode is triggered when no prompt is provided
    if args.prompt is None:
        prompt, tools, model_type, model_id, provider, api_base, api_key, imports, action_type = interactive_mode()
    else:
        prompt = args.prompt
        tools = args.tools
        model_type = args.model_type
        model_id = args.model_id
        provider = args.provider
        api_base = args.api_base

View on GitHub (pinned to 30bb116109)

Solutions

  1. Use one of the two supported values: --action-type code or --action-type tool_calling.
  2. For other agent types, build the agent programmatically with smolagents' Python API instead of the CLI.

Example fix

# before
smolagent --action-type react ...
# after
smolagent --action-type tool_calling ...
Defensive patterns

Strategy: validation

Validate before calling

if action_type not in {'code','tool_calling'}: raise SystemExit('action-type must be code or tool_calling')

Prevention

When it happens

Trigger: Running `smolagent --action-type <something other than 'code' or 'tool_calling'>`, e.g. 'react', 'json', or a typo like 'toolcall'.

Common situations: Assuming the CLI supports the same breadth of agent types as the library API, or copy-pasting an action type from outdated docs.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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