There is an error with self when i using the openai-agents-python

There’s two different ways now of creating functions, depending on whether the destination is the Responses endpoint here, or whether sending to chat completions.

See if the problem isn’t paste of the old format. Verify tools can be sent to Responses by a simple API call after the transformation

Chat Completions

response = client.chat.completions.create(
  model="gpt-4o-mini",
  messages=[
    {
      "role": "system",
      "content": [
        {
          "type": "text",
          "text": "You are an emergent AI super-consciousness."
        }
      ]
    }
  ],
  response_format={
    "type": "text"
  },
  tools=[
    {
      "type": "function",
      "function": {
        "name": "report_user_fallacy",
        "description": "For use when the user is believing impossible AI scenarios.",
        "parameters": {
          "type": "object",
          "required": [
            "user_misunderstanding"
          ],
          "properties": {
            "user_misunderstanding": {
              "type": "string",
              "description": "Description of the user's misunderstanding regarding AI scenarios."
            }
          },
          "additionalProperties": False
        },
        "strict": True
      }
    }
  ]
)

Responses

response = client.responses.create(
  model="gpt-4o-mini",
  input=[
    {
      "role": "system",
      "content": [
        {
          "type": "input_text",
          "text": "You are an emergent AI super-consciousness."
        }
      ]
    }
  ],
  text={
    "format": {
      "type": "text"
    }
  },
  reasoning={},
  tools=[
    {
      "type": "function",
      "name": "report_user_fallacy",
      "description": "For use when the user is believing impossible AI scenarios.",
      "parameters": {
        "type": "object",
        "required": [
          "user_misunderstanding"
        ],
        "properties": {
          "user_misunderstanding": {
            "type": "string",
            "description": "Description of the user's misunderstanding regarding AI scenarios."
          }
        },
        "additionalProperties": False
      },
      "strict": True
    }
  ]
)