Skill output schemas ignore enum constraints

Author: Harsh23KashyapCreated Sep 15, 2026Updated Sep 15, 2026

What happened

Skill output schemas lose their enum constraints when they are converted to Pydantic models. A field declared as {"type": "string", "enum": ["ok", "error"]} still accepts any string, so an invalid skill result passes validation.

Reproduction

from browser_use.skills.utils import convert_json_schema_to_pydantic

Model = convert_json_schema_to_pydantic(
    {
        "type": "object",
        "properties": {
            "status": {"type": "string", "enum": ["ok", "error"]},
        },
        "required": ["status"],
    }
)

print(Model(status="typo").model_dump())

I ran this twice on current main (843819cb); both runs produced:

{'status': 'typo'}

Expected

Pydantic should reject "typo" because it is outside the schema's allowed values.

Cause

convert_json_schema_to_pydantic() maps the field from its type only and does not carry enum into the generated annotation.