Skip to content

Error while trying to use Custom function tools #1023

Open
@Uzair-DeVops

Description

@Uzair-DeVops

🐛 Incident Report: BadRequestError from OpenAI Agent SDK

📄 Summary

While executing a synchronous agent run using Runner.run_sync(), the following error was encountered:

openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid schema for function 'process_user': In context=(), 'additionalProperties' is required to be supplied and to be false.", ...}}

🔍 Root Cause

The error originates from the OpenAI Agents SDK when trying to validate the function schema (tools[0].parameters) passed to the model. Specifically:

"Invalid schema for function 'process_user': In context=(), 'additionalProperties' is required to be supplied and to be false."

Explanation:

  • When defining a tool (function) schema in the Agent SDK, the parameters must follow strict JSON Schema rules.

  • The schema is missing the required property:

    "additionalProperties": false
  • Without this, OpenAI cannot validate the input contract and throws a 400 Bad Request error.


📌 Action Items

  • Review the tool schema for process_user
  • Ensure proper JSON Schema generation with additionalProperties: false
  • Re-test with Runner.run_sync()

💡 Tip

Use a JSON Schema validator (like https://jsonschemavalidator.net/) to confirm your function schema before registering it in the SDK.


Let me know if you'd like me to inspect your tool definition and rewrite it properly with the correct schema!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions