### Summary: 1. Add the MCP dep for python 3.10, since it doesn't support 3.9 and below 2. Create MCPServer, which is the agents SDK representation of an MCP server 3. Create implementations for HTTP-SSE and StdIO servers, directly copying the [MCP SDK example](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/clients/simple-chatbot/mcp_simple_chatbot/main.py) 4. Add a util to transform MCP tools into Agent SDK tools Note: I added optional caching support to the servers. That way, if you happen to know a server's tools don't change, you can just cache them. ### Test Plan: Checks pass. I added tests at the end of the stack.
132 lines
3.2 KiB
TOML
132 lines
3.2 KiB
TOML
[project]
|
|
name = "openai-agents"
|
|
version = "0.0.6"
|
|
description = "OpenAI Agents SDK"
|
|
readme = "README.md"
|
|
requires-python = ">=3.9"
|
|
license = "MIT"
|
|
authors = [{ name = "OpenAI", email = "support@openai.com" }]
|
|
dependencies = [
|
|
"openai>=1.66.5",
|
|
"pydantic>=2.10, <3",
|
|
"griffe>=1.5.6, <2",
|
|
"typing-extensions>=4.12.2, <5",
|
|
"requests>=2.0, <3",
|
|
"types-requests>=2.0, <3",
|
|
"mcp; python_version >= '3.10'",
|
|
]
|
|
classifiers = [
|
|
"Typing :: Typed",
|
|
"Intended Audience :: Developers",
|
|
"Programming Language :: Python :: 3",
|
|
"Programming Language :: Python :: 3.9",
|
|
"Programming Language :: Python :: 3.10",
|
|
"Programming Language :: Python :: 3.11",
|
|
"Programming Language :: Python :: 3.12",
|
|
"Intended Audience :: Developers",
|
|
"Operating System :: OS Independent",
|
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
"License :: OSI Approved :: MIT License",
|
|
]
|
|
|
|
[project.urls]
|
|
Homepage = "https://github.com/openai/openai-agents-python"
|
|
Repository = "https://github.com/openai/openai-agents-python"
|
|
|
|
[project.optional-dependencies]
|
|
voice = ["numpy>=2.2.0, <3; python_version>='3.10'", "websockets>=15.0, <16"]
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"mypy",
|
|
"ruff==0.9.2",
|
|
"pytest",
|
|
"pytest-asyncio",
|
|
"pytest-mock>=3.14.0",
|
|
"rich",
|
|
"mkdocs>=1.6.0",
|
|
"mkdocs-material>=9.6.0",
|
|
"mkdocstrings[python]>=0.28.0",
|
|
"coverage>=7.6.12",
|
|
"playwright==1.50.0",
|
|
"inline-snapshot>=0.20.7",
|
|
"pynput",
|
|
"types-pynput",
|
|
"sounddevice",
|
|
"pynput",
|
|
"textual",
|
|
"websockets",
|
|
]
|
|
[tool.uv.workspace]
|
|
members = ["agents"]
|
|
|
|
[tool.uv.sources]
|
|
agents = { workspace = true }
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["src/agents"]
|
|
|
|
|
|
[tool.ruff]
|
|
line-length = 100
|
|
target-version = "py39"
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
"E", # pycodestyle errors
|
|
"W", # pycodestyle warnings
|
|
"F", # pyflakes
|
|
"I", # isort
|
|
"B", # flake8-bugbear
|
|
"C4", # flake8-comprehensions
|
|
"UP", # pyupgrade
|
|
]
|
|
isort = { combine-as-imports = true, known-first-party = ["agents"] }
|
|
|
|
[tool.ruff.lint.pydocstyle]
|
|
convention = "google"
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
"examples/**/*.py" = ["E501"]
|
|
|
|
[tool.mypy]
|
|
strict = true
|
|
disallow_incomplete_defs = false
|
|
disallow_untyped_defs = false
|
|
disallow_untyped_calls = false
|
|
|
|
[[tool.mypy.overrides]]
|
|
module = "sounddevice.*"
|
|
ignore_missing_imports = true
|
|
|
|
[tool.coverage.run]
|
|
source = ["tests", "src/agents"]
|
|
|
|
[tool.coverage.report]
|
|
show_missing = true
|
|
sort = "-Cover"
|
|
exclude_also = [
|
|
# This is only executed while typechecking
|
|
"if TYPE_CHECKING:",
|
|
"@abc.abstractmethod",
|
|
"raise NotImplementedError",
|
|
"logger.debug",
|
|
]
|
|
|
|
[tool.pytest.ini_options]
|
|
asyncio_mode = "auto"
|
|
asyncio_default_fixture_loop_scope = "session"
|
|
filterwarnings = [
|
|
# This is a warning that is expected to happen: we have an async filter that raises an exception
|
|
"ignore:coroutine 'test_async_input_filter_fails.<locals>.invalid_input_filter' was never awaited:RuntimeWarning",
|
|
]
|
|
markers = [
|
|
"allow_call_model_methods: mark test as allowing calls to real model implementations",
|
|
]
|
|
|
|
[tool.inline-snapshot]
|
|
format-command = "ruff format --stdin-filename {filename}"
|