{"id":27579,"library":"agent-framework-openai","title":"Agent Framework OpenAI","description":"Provides OpenAI model integrations for the Microsoft Agent Framework. Current version 1.3.0, weekly releases on PyPI. Requires Python >=3.10.","status":"active","version":"1.3.0","language":"python","source_language":"en","source_url":"https://github.com/microsoft/agent-framework-openai","tags":["openai","agent-framework","microsoft","ai","chatgpt"],"install":[{"cmd":"pip install agent-framework-openai","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for OpenAI API calls","package":"openai","optional":false},{"reason":"Core library providing base classes (Agent, Tool, etc.)","package":"agent-framework-core","optional":false}],"imports":[{"note":"Before v1.0.0 the correct import was from a submodule. Now it's directly from the top-level package.","wrong":"from agent_framework_openai.agents import OpenAIAgent","symbol":"OpenAIAgent","correct":"from agent_framework_openai import OpenAIAgent"},{"note":"","wrong":"","symbol":"OpenAIToolSet","correct":"from agent_framework_openai import OpenAIToolSet"}],"quickstart":{"code":"import os\nfrom agent_framework_openai import OpenAIAgent\n\nagent = OpenAIAgent(\n    api_key=os.environ.get('OPENAI_API_KEY', ''),\n    model='gpt-4o'\n)\nresponse = agent.run(\"Hello\")\nprint(response)","lang":"python","description":"Create an OpenAI-powered agent using the default GPT-4o model."},"warnings":[{"fix":"Replace `openai_api_key=...` with `api_key=...` when initializing OpenAIAgent.","message":"Breaking change: In v1.0.0 the OpenAIAgent constructor changed from accepting `openai_api_key` to `api_key`. Existing code using the old parameter name will fail.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Replace `from agent_framework_openai.tools import ToolSet` with `from agent_framework_openai import ToolSet`.","message":"Deprecated: `agent_framework_openai.tools` submodule is deprecated; use `agent_framework_openai.ToolSet` directly.","severity":"deprecated","affected_versions":">=1.2.0,<2.0.0"},{"fix":"Use models from the Chat Completions API (e.g., gpt-4, gpt-4o, gpt-3.5-turbo).","message":"The library only supports OpenAI models; attempting to pass a non-OpenAI model will raise a ValueError. Common mistake: using model names like 'gpt-3.5-turbo-instruct' which are not supported by the ChatCompletion endpoint.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Upgrade to latest version: `pip install --upgrade agent-framework-openai`. Then use `from agent_framework_openai import OpenAIAgent`.","cause":"Outdated library version or wrong import path.","error":"ImportError: cannot import name 'OpenAIAgent' from 'agent_framework_openai'"},{"fix":"Use a ChatCompletion model like 'gpt-4' or 'gpt-3.5-turbo'.","cause":"The library only supports models that use the Chat Completions API. Instruct models are not compatible.","error":"ValueError: Model 'gpt-3.5-turbo-instruct' is not supported. Only ChatCompletion models are allowed."},{"fix":"Change parameter name to `api_key`.","cause":"Breaking change in v1.0.0: parameter renamed from `openai_api_key` to `api_key`.","error":"TypeError: __init__() got an unexpected keyword argument 'openai_api_key'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}