diff --git a/python/packages/main/pyproject.toml b/python/packages/main/pyproject.toml index c73d6c528a..5c5068466c 100644 --- a/python/packages/main/pyproject.toml +++ b/python/packages/main/pyproject.toml @@ -42,6 +42,9 @@ foundry = [ workflow = [ "agent-framework-workflow" ] +runtime = [ + "agent-framework-runtime" +] [tool.uv] prerelease = "if-necessary-or-explicit" diff --git a/python/packages/runtime/LICENSE b/python/packages/runtime/LICENSE new file mode 100644 index 0000000000..9e841e7a26 --- /dev/null +++ b/python/packages/runtime/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/python/packages/runtime/README.md b/python/packages/runtime/README.md new file mode 100644 index 0000000000..6662f28e11 --- /dev/null +++ b/python/packages/runtime/README.md @@ -0,0 +1,9 @@ +# Get Started with Microsoft Agent Framework Runtime + +Please install this package as the extra for `agent-framework`: + +```bash +pip install agent-framework[runtime] +``` + +and see the [README](https://github.com/microsoft/agent-framework/tree/main/python/README.md) for more information. diff --git a/python/packages/runtime/agent_framework_runtime/__init__.py b/python/packages/runtime/agent_framework_runtime/__init__.py new file mode 100644 index 0000000000..581306f1a4 --- /dev/null +++ b/python/packages/runtime/agent_framework_runtime/__init__.py @@ -0,0 +1,10 @@ +# Copyright (c) Microsoft. All rights reserved. + +# Agent Runtime - Python Implementation + +from .agent_actor import ActorId, RequestStatus + +__all__ = [ + "ActorId", + "RequestStatus", +] diff --git a/python/packages/runtime/agent_framework_runtime/agent_actor.py b/python/packages/runtime/agent_framework_runtime/agent_actor.py new file mode 100644 index 0000000000..b436c8b32d --- /dev/null +++ b/python/packages/runtime/agent_framework_runtime/agent_actor.py @@ -0,0 +1,26 @@ +# Copyright (c) Microsoft. All rights reserved. + +"""Core actor abstractions for the Python actor runtime.""" + +from dataclasses import dataclass +from enum import Enum + + +@dataclass(frozen=True, kw_only=True) +class ActorId: + """Unique identifier for an actor instance.""" + + type_name: str + instance_id: str + + def __str__(self) -> str: + """Return the string representation of the actor ID.""" + return f"{self.type_name}/{self.instance_id}" + + +class RequestStatus(Enum): + """Status of a request being processed by an actor.""" + + PENDING = "pending" + COMPLETED = "completed" + FAILED = "failed" diff --git a/python/packages/runtime/pyproject.toml b/python/packages/runtime/pyproject.toml new file mode 100644 index 0000000000..8fddae25d0 --- /dev/null +++ b/python/packages/runtime/pyproject.toml @@ -0,0 +1,91 @@ +[project] +name = "agent-framework-runtime" +description = "Runtime integration for Microsoft Agent Framework." +authors = [{ name = "Microsoft", email = "SK-Support@microsoft.com"}] +readme = "README.md" +requires-python = ">=3.10" +version = "0.1.0b1" +license-files = ["LICENSE"] +urls.homepage = "https://learn.microsoft.com/en-us/semantic-kernel/overview/" +urls.source = "https://github.com/microsoft/agent-framework/tree/main/python" +urls.release_notes = "https://github.com/microsoft/agent-framework/releases?q=tag%3Apython-1&expanded=true" +urls.issues = "https://github.com/microsoft/agent-framework/issues" +classifiers = [ + "License :: OSI Approved :: MIT License", + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Framework :: Pydantic :: 2", + "Typing :: Typed", +] +dependencies = [ + "agent-framework", +] + +[tool.uv] +prerelease = "if-necessary-or-explicit" +environments = [ + "sys_platform == 'darwin'", + "sys_platform == 'linux'", + "sys_platform == 'win32'" +] + +[tool.uv-dynamic-versioning] +fallback-version = "0.0.0" +[tool.pytest.ini_options] +testpaths = 'tests' +addopts = "-ra -q -r fEX" +asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "function" +filterwarnings = [] +timeout = 120 + +[tool.ruff] +extend = "../../pyproject.toml" + +[tool.coverage.run] +omit = [ + "**/__init__.py" +] + +[tool.pyright] +extend = "../../pyproject.toml" +exclude = ['tests'] + +[tool.mypy] +plugins = ['pydantic.mypy'] +strict = true +python_version = "3.10" +ignore_missing_imports = true +disallow_untyped_defs = true +no_implicit_optional = true +check_untyped_defs = true +warn_return_any = true +show_error_codes = true +warn_unused_ignores = false +disallow_incomplete_defs = true +disallow_untyped_decorators = true +disallow_any_unimported = true + +[tool.bandit] +targets = ["agent_framework_runtime"] +exclude_dirs = ["tests"] + +[tool.poe] +executor.type = "uv" +include = "../../shared_tasks.toml" +[tool.poe.tasks] +mypy = "mypy --config-file $POE_ROOT/pyproject.toml agent_framework_runtime" +test = "pytest --cov=agent_framework_runtime --cov-report=term-missing:skip-covered tests" + +[tool.uv.build-backend] +module-name = "agent_framework_runtime" +module-root = "" + +[build-system] +requires = ["uv_build>=0.8.2,<0.9.0"] +build-backend = "uv_build" \ No newline at end of file diff --git a/python/pyproject.toml b/python/pyproject.toml index 6c46a9ab8f..0b04f3dd21 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -64,6 +64,7 @@ agent-framework = { workspace = true } agent-framework-azure = { workspace = true } agent-framework-foundry = { workspace = true } agent-framework-workflow = { workspace = true } +agent-framework-runtime = { workspace = true } [tool.ruff] line-length = 120 diff --git a/python/uv.lock b/python/uv.lock index 2b9ba9e045..765cde665e 100644 --- a/python/uv.lock +++ b/python/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 2 requires-python = ">=3.10" resolution-markers = [ "python_full_version >= '3.11' and sys_platform == 'darwin'", @@ -21,6 +21,7 @@ members = [ "agent-framework-azure", "agent-framework-foundry", "agent-framework-project", + "agent-framework-runtime", "agent-framework-workflow", ] @@ -197,6 +198,17 @@ dev = [ { name = "uv", specifier = ">=0.8.2,<0.9.0" }, ] +[[package]] +name = "agent-framework-runtime" +version = "0.1.0b1" +source = { editable = "packages/runtime" } +dependencies = [ + { name = "agent-framework", marker = "sys_platform == 'darwin' or sys_platform == 'linux' or sys_platform == 'win32'" }, +] + +[package.metadata] +requires-dist = [{ name = "agent-framework", editable = "packages/main" }] + [[package]] name = "agent-framework-workflow" version = "0.1.0b1" @@ -2612,6 +2624,7 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b5/89/06600980aefcc535c758414da969f37a5194ea4cdb73b745223f6af3acfb/pyzmq-27.0.2-cp312-abi3-win_amd64.whl", hash = "sha256:734be4f44efba0aa69bf5f015ed13eb69ff29bf0d17ea1e21588b095a3147b8e", size = 619281, upload-time = "2025-08-21T04:21:39.909Z" }, { url = "https://files.pythonhosted.org/packages/30/84/df8a5c089552d17c9941d1aea4314b606edf1b1622361dae89aacedc6467/pyzmq-27.0.2-cp312-abi3-win_arm64.whl", hash = "sha256:41f0bd56d9279392810950feb2785a419c2920bbf007fdaaa7f4a07332ae492d", size = 552680, upload-time = "2025-08-21T04:21:41.571Z" }, { url = "https://files.pythonhosted.org/packages/b4/7b/b79e976508517ab80dc800f7021ef1fb602a6d55e4caa2d47fb3dca5d8b6/pyzmq-27.0.2-cp313-cp313-android_24_arm64_v8a.whl", hash = "sha256:7f01118133427cd7f34ee133b5098e2af5f70303fa7519785c007bca5aa6f96a", size = 1122259, upload-time = "2025-08-21T04:21:43.063Z" }, + { url = "https://files.pythonhosted.org/packages/2b/1c/777217b9940ebcb7e71c924184ca5f31e410580a58d9fd93798589f0d31c/pyzmq-27.0.2-cp313-cp313-android_24_x86_64.whl", hash = "sha256:e4b860edf6379a7234ccbb19b4ed2c57e3ff569c3414fadfb49ae72b61a8ef07", size = 1156113, upload-time = "2025-08-21T04:21:44.566Z" }, { url = "https://files.pythonhosted.org/packages/59/7d/654657a4c6435f41538182e71b61eac386a789a2bbb6f30171915253a9a7/pyzmq-27.0.2-cp313-cp313t-macosx_10_15_universal2.whl", hash = "sha256:cb77923ea163156da14295c941930bd525df0d29c96c1ec2fe3c3806b1e17cb3", size = 1341437, upload-time = "2025-08-21T04:21:46.019Z" }, { url = "https://files.pythonhosted.org/packages/20/a0/5ed7710037f9c096017adc748bcb1698674a2d297f8b9422d38816f7b56a/pyzmq-27.0.2-cp313-cp313t-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:61678b7407b04df8f9423f188156355dc94d0fb52d360ae79d02ed7e0d431eea", size = 897888, upload-time = "2025-08-21T04:21:47.362Z" }, { url = "https://files.pythonhosted.org/packages/2c/8a/6e4699a60931c17e7406641d201d7f2c121e2a38979bc83226a6d8f1ba32/pyzmq-27.0.2-cp313-cp313t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e3c824b70925963bdc8e39a642672c15ffaa67e7d4b491f64662dd56d6271263", size = 660727, upload-time = "2025-08-21T04:21:48.734Z" },