Skip to content

additionalProperties should not be set for object types #608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PraveenKS30 opened this issue Apr 26, 2025 · 4 comments
Closed

additionalProperties should not be set for object types #608

PraveenKS30 opened this issue Apr 26, 2025 · 4 comments
Labels
question Question about using the SDK stale

Comments

@PraveenKS30
Copy link

Please read this first

  • Have you read the docs?Agents SDK docs
  • Have you searched for related issues? Others may have had similar requests

Question

I am trying to get structured output from the Agent using output_type .
My output would be in the JSON format and dynamic in nature so I kept the field as payload : dict.

class FHIRPayload(BaseModel):
    payload : dict

# define agent 
fhir_agent = Agent(
        name = "FHIR agent",
        instructions= fhir_system_prompt,
        model = "gpt-4o",
        output_type= FHIRPayload
    )

  response = Runner.run_sync(fhir_agent, input)
  print("Initial FHIR payload" + response.final_output)

But, keep getting this error :

agents.exceptions.UserError: additionalProperties should not be set for object types. This could be because you're using an older version of Pydantic, or because you configured additional properties to be allowed. If you really need this, update the function or output tool to not use a strict schema.

@PraveenKS30 PraveenKS30 added the question Question about using the SDK label Apr 26, 2025
@rogerioluizsi
Copy link

Sorry I didn't answer your question directly. But this might happen to others too. This error also comes up when you use **kwargs in the function signature.

@dkundel-openai
Copy link
Contributor

Hey @PraveenKS30,

overall Structured Outputs require additionalProperties to be set to false in the JSON schema.

You would have to modify your Agent to turn off strict output to be able to use use it with a more generic JSON.

fhir_agent = Agent(
        name = "FHIR agent",
        instructions= fhir_system_prompt,
        model = "gpt-4o",
        output_type= FHIRPayload
+       strict_json_schema=False
    )

Generally we don't recommend this though and if possible you should try to type the expected output as much as possible.

Copy link

github-actions bot commented May 7, 2025

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label May 7, 2025
Copy link

This issue was closed because it has been inactive for 3 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about using the SDK stale
Projects
None yet
Development

No branches or pull requests

3 participants