[build-system] requires = ["hatchling", "hatch-vcs"] build-backend = "hatchling.build" [project] name = "strands-agents" dynamic = ["version"] # Version determined by git tags description = "A model-driven approach to building AI agents in just a few lines of code" readme = "README.md" requires-python = ">=3.10" license = {text = "Apache-2.0"} license-files = ["LICENSE", "NOTICE"] authors = [ {name = "AWS", email = "opensource@amazon.com"}, ] classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Software Development :: Libraries :: Python Modules", ] dependencies = [ "boto3>=1.26.0,<2.0.0", "botocore>=1.29.0,<2.0.0", "docstring_parser>=0.15,<1.0", "httpx>=0.28.1,<1.0.0", "jsonschema>=4.0.0,<5.0.0", "mcp>=1.23.0,<2.4", "pydantic>=2.4.0,<3.0.0", "typing-extensions>=4.13.2,<5.0.0", "pyyaml>=6.0.0,<7.0.0", "watchdog>=6.0.0,<7.0.0", "opentelemetry-api>=1.30.0,<2.0.0", "opentelemetry-sdk>=1.30.0,<2.0.0", "opentelemetry-instrumentation-threading>=0.51b0,<1.00b0", ] [project.optional-dependencies] anthropic = ["anthropic>=0.21.0,<3.0.0"] gemini = ["google-genai>=1.68.0,<3.0.0"] # Ceiling is the last known-good release rather than the major: 1.107.0 was a compromised # build (credential stealer, removed from PyPI 2026-10-21). Given that history the cap moves # only via a reviewed Dependabot bump, never an automatic in-range resolve. litellm = ["litellm>=1.75.9,<1.107.0", "openai>=1.68.0,<4.0.0"] llamaapi = ["llama-api-client>=0.1.0,<1.0.0"] mistral = ["mistralai>=2.0.0,<4.0.0"] ollama = ["ollama>=0.5.0,<1.0.0"] web-fetch = ["markdownify>=1.2.0,<2.0.0", "beautifulsoup4>=4.13.0,<5.0.0"] openai = ["openai>=1.68.0,<4.0.0", "aws-bedrock-token-generator>=1.1.0,<2.0.0"] writer = ["writer-sdk>=2.2.0,<4.0.0"] sagemaker = [ "boto3-stubs[sagemaker-runtime]>=1.26.0,<2.0.0", "openai>=1.68.0,<4.0.0", # SageMaker uses OpenAI-compatible interface ] otel = [ "opentelemetry-exporter-otlp-proto-http>=1.30.0,<2.0.0", "opentelemetry-processor-baggage>=0.51b0,<1.00b0", ] docs = [ "sphinx>=5.0.0,<10.0.0", "sphinx-rtd-theme>=1.0.0,<4.0.0", "sphinx-autodoc-typehints>=1.12.0,<4.0.0", ] a2a = [ "a2a-sdk>=0.3.0,<0.4.0", "a2a-sdk[sql]>=0.3.0,<0.4.0", "uvicorn>=0.34.2,<1.0.0", "httpx>=0.28.1,<1.0.0", "fastapi>=0.133.0,<1.0.0", "starlette>=1.0.0,<2.0.0", ] cedar = ["cedarpy==4.12.2", "cedar-policy-mcp-schema-generator==0.7.0"] bidi = [ "aws_sdk_bedrock_runtime[awscrt]>=0.11.0,<0.12.0; python_version>='3.12'", "awscrt==0.32.2; python_version>='3.12'", "smithy-aws-core>=0.11.0,<0.12.0; python_version>='3.12'", "smithy-core>=0.8.0,<0.9.0; python_version>='3.12'", "smithy-http[awscrt]==0.5.0; python_version>='3.12'", ] bidi-io = ["prompt_toolkit>=3.0.0,<4.0.0", "rich>=15.0.0,<16.0.0"] bidi-google = ["google-genai>=2.0.0,<3.0.0"] bidi-openai = ["websockets>=16.0.0,<17.0.0"] # Live requires OpenAI 3.x; keep it separate from the aggregate extras. bidi-openai-live = ["openai[realtime]>=3.35.1,<4.0.0"] bidi-aec = ["pywebrtc-audio>=0.2.0,<0.3.0", "numpy>=2.0.0,<3.0.0"] # Excluded from aggregate extras because PyAudio requires PortAudio as a system level install. bidi-pyaudio = ["pyaudio>=0.2.0,<0.3.0"] bidi-all = ["strands-agents[a2a,bidi,bidi-aec,bidi-google,bidi-io,bidi-openai,docs,otel]"] all = [ "strands-agents[a2a,anthropic,bidi-all,cedar,docs,gemini,litellm,llamaapi,mistral,ollama,openai,writer,sagemaker,otel,web-fetch]" ] dev = [ "commitizen>=4.4.0,<5.0.0", "hatch>=1.0.0,<2.0.0", "moto>=5.1.0,<6.0.0", "mypy>=1.15.0,<2.4.0", "pre-commit>=3.2.0,<4.7.0", "pytest>=9.0.0,<10.0.0", "pytest-cov>=7.0.0,<8.0.0", "pytest-asyncio>=1.0.0,<1.5.0", "pytest-timeout>=2.0.0,<3.0.0", "pytest-xdist>=3.0.0,<4.0.0", "ruff>=0.16.0,<0.18.0", "tenacity>=9.0.0,<10.0.0", ] [project.urls] Homepage = "https://github.com/strands-agents/harness-sdk" "Bug Tracker" = "https://github.com/strands-agents/harness-sdk/issues" Documentation = "https://strandsagents.com" [tool.hatch.build] # The copy the build hook writes is git-ignored, so it is named here to ship in the wheel *and* sdist anyway. artifacts = ["src/strands/models/model_info.json"] [tool.hatch.build.targets.wheel] packages = ["src/strands"] [tool.hatch.build.hooks.custom] path = "hatch_build.py" [tool.hatch.version] source = "vcs" raw-options.root = ".." raw-options.tag_regex = "^python/v(?P.+)$" raw-options.git_describe_command = ["git", "describe", "--dirty", "--tags", "--long", "--match", "python/v*"] [tool.hatch.envs.hatch-static-analysis] installer = "uv" features = ["all"] dependencies = [ # mypy 2.4 has inference failures for async hooks and reversed message lists. "mypy>=1.15.0,<2.4.0", "ruff>=0.16.0,<0.18.0", # Include required package dependencies for mypy "boto3-stubs[bedrock-agent,bedrock-agent-runtime,s3]>=1.26.0,<2.0.0", "strands-agents @ {root:uri}", "types-pyaudio>=0.2.16,<0.3.0", ] python = "3.10" # Define static-analysis scripts so we can include mypy as part of the linting check [tool.hatch.envs.hatch-static-analysis.scripts] format-check = [ "ruff format --check" ] format-fix = [ "ruff format" ] lint-check = [ "ruff check", "mypy ./src ./tests_typing" ] lint-fix = [ "ruff check --fix" ] [tool.hatch.envs.hatch-test] installer = "uv" features = ["all"] extra-args = ["-n", "auto", "-vv"] dependencies = [ "pytest>=9.0.0,<10.0.0", "pytest-cov>=7.0.0,<8.0.0", "pytest-asyncio>=1.0.0,<1.5.0", "pytest-timeout>=2.0.0,<3.0.0", "pytest-xdist>=3.0.0,<4.0.0", "pytest-rerunfailures>=15.0,<16.0", "moto>=5.1.0,<6.0.0", ] [[tool.hatch.envs.hatch-test.matrix]] python = ["3.14", "3.13", "3.12", "3.11", "3.10"] # The dependency range spans both `mcp` majors and resolves to 2.x. Setting STRANDS_TEST_MCP_V1=1 caps the env at # 1.x so the 1.x-era MCP tests can run against the real package (the mcp-1x scope in python-integration-test.yml). # Likewise, the `anthropic` range spans 0.x through 2.x and resolves to 2.x. Setting STRANDS_TEST_ANTHROPIC_V0=1 # caps the env at 0.x so the AnthropicModel tests run against the SDK generation that still takes sampling kwargs. [tool.hatch.envs.hatch-test.overrides] env.STRANDS_TEST_MCP_V1.dependencies = [ { value = "mcp>=1.23.0,<2.0.0", if = ["1"] }, ] env.STRANDS_TEST_ANTHROPIC_V0.dependencies = [ { value = "anthropic>=0.21.0,<1.0.0", if = ["1"] }, ] [tool.hatch.envs.hatch-test.scripts] run = "pytest{env:HATCH_TEST_ARGS:} {args}" # Run with: hatch test run-cov = "pytest{env:HATCH_TEST_ARGS:} {args} --cov --cov-config=pyproject.toml --cov-report html --cov-report xml {args}" # Run with: hatch test -c cov-combine = [] cov-report = [] [tool.hatch.envs.default] installer = "uv" dev-mode = true features = ["all"] dependencies = [ "commitizen>=4.4.0,<5.0.0", "complexipy>=6.2.0,<7.0.0", "hatch>=1.0.0,<2.0.0", "pre-commit>=3.2.0,<4.7.0", ] [tool.hatch.envs.default.scripts] list = "echo 'Scripts commands available for default env:'; hatch env show --json | jq --raw-output '.default.scripts | keys[]'" format = "hatch fmt --formatter" test-format = "hatch fmt --formatter --check" lint = "hatch fmt --linter" test-lint = "hatch fmt --linter --check" test = "hatch test {args}" test-integ = "hatch test tests_integ {args}" # Report the cognitive complexity of functions this branch changes, matching # what the PR labeler will apply. Run from the repo root so both SDKs are seen. complexity = "cd .. && node .github/scripts/pr-metrics/run-analysis.mjs {args}" prepare = [ "hatch run format", "hatch run lint", "hatch run test-lint", "hatch test --all" ] [tool.mypy] python_version = "3.10" # TODO: Remove the Live exclusion and import override when CI supports OpenAI 3.x. exclude = ['src/strands/bidi/models/openai/live\.py$'] warn_return_any = true warn_unused_configs = true disallow_untyped_defs = true disallow_incomplete_defs = true check_untyped_defs = true disallow_untyped_decorators = true no_implicit_optional = true warn_redundant_casts = true warn_unused_ignores = true warn_no_return = true warn_unreachable = true follow_untyped_imports = true ignore_missing_imports = false [[tool.mypy.overrides]] module = "strands.bidi.models.openai.live" follow_imports = "skip" [[tool.mypy.overrides]] module = [ "aws_sdk_bedrock_runtime.*", "cedarpy", "cedar_mcp_schema_generator", "smithy_aws_core.*", "smithy_core.*", "smithy_http.*", ] ignore_missing_imports = true [[tool.mypy.overrides]] # These modules branch on which mcp major line is installed; mypy only ever sees one line's types, so each branch's # per-line ignores are "unused" when checked against the other line. module = [ "strands.tools.mcp._compat", "strands.tools.mcp.mcp_client", "strands.tools.mcp.mcp_instrumentation", "strands.tools.mcp.mcp_tasks", ] warn_unused_ignores = false [tool.ruff] line-length = 120 include = ["examples/**/*.py", "src/**/*.py", "tests/**/*.py", "tests_integ/**/*.py", "tests_typing/**/*.py"] [tool.ruff.lint] select = [ "B", # flake8-bugbear "D", # pydocstyle "E", # pycodestyle "F", # pyflakes "G", # logging format "I", # isort "LOG", # logging "UP" # pyupgrade ] [tool.ruff.lint.per-file-ignores] "!src/**/*.py" = ["D"] [tool.ruff.lint.pydocstyle] convention = "google" [tool.pytest.ini_options] testpaths = ["tests"] asyncio_default_fixture_loop_scope = "function" addopts = "--junit-xml=build/test-results.xml" timeout = 90 [tool.coverage.run] branch = true source = ["src"] context = "thread" parallel = true concurrency = ["thread", "multiprocessing"] [tool.coverage.report] show_missing = true [tool.coverage.html] directory = "build/coverage/html" [tool.coverage.xml] output = "build/coverage/coverage.xml" [tool.commitizen] name = "cz_conventional_commits" tag_format = "v$version" bump_message = "chore(release): bump version $current_version -> $new_version" version_files = ["pyproject.toml:version"] update_changelog_on_bump = true style = [ ["qmark", "fg:#ff9d00 bold"], ["question", "bold"], ["answer", "fg:#ff9d00 bold"], ["pointer", "fg:#ff9d00 bold"], ["highlighted", "fg:#ff9d00 bold"], ["selected", "fg:#cc5454"], ["separator", "fg:#cc5454"], ["instruction", ""], ["text", ""], ["disabled", "fg:#858585 italic"] ]