Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Accept a JSON Schema document as `output_type`

Abierto
#5,344 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
ai

Línea de trabajo

Start from AgentOutputSchema and the AgentOutputSchemaBase interface it implements, specifically json_schema(), is_strict_json_schema() and validate_json(), plus how ModelBehaviorError is raised during output parsing. Decide the validation approach first, since the issue leaves open whether to add jsonschema as an optional extra or skip local validation when strict=True. Done means a JsonSchemaOutput class that passes its schema through unchanged when strict=False, returns a parsed dict, and raises ModelBehaviorError on invalid JSON or schema violations, with tests for both modes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Please read this first
  • Have you read the docs? Yes
  • Have you searched for related issues? Yes
Describe the feature

AgentOutputSchema takes a Python type, so an agent whose response schema arrives at runtime as JSON Schema (user-defined agents in agent-builder products, schemas stored in config) needs a hand-written AgentOutputSchemaBase subclass that re-implements json_schema(), is_strict_json_schema() and validate_json(), with its own JSON parsing, validation and ModelBehaviorError mapping.

Proposal: a built-in output schema that takes the document directly, e.g.

Agent(..., output_type=JsonSchemaOutput(schema, name="ticket", strict=False))
  • strict=True runs ensure_strict_json_schema as AgentOutputSchema does; strict=False sends the schema as given, since user-authored schemas often fall outside the strict subset.
  • validate_json parses and validates against the schema and raises ModelBehaviorError on invalid JSON or a schema violation, so retries and error handling match typed outputs.
  • It returns the parsed dict.

Validation could use jsonschema as an optional extra, or skip local validation when strict=True, where the provider already enforces the schema.

Lenguaje dominante
Python
Estrellas
29.9k
Forks
4.8k
Merge medio
1 d 3 min
PR fusionados (30 d)
213

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de openai/openai-agents-python

Todos los issues de openai/openai-agents-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.