agentscope-runtime 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/PKG-INFO +74 -13
  2. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/README.md +65 -11
  3. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/pyproject.toml +10 -2
  4. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/agents/agentscope_agent/agent.py +1 -0
  5. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/agents/agno_agent.py +1 -0
  6. agentscope_runtime-0.1.1/src/agentscope_runtime/engine/agents/autogen_agent.py +245 -0
  7. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/schemas/agent_schemas.py +1 -1
  8. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/services/memory_service.py +2 -2
  9. agentscope_runtime-0.1.1/src/agentscope_runtime/engine/services/redis_memory_service.py +187 -0
  10. agentscope_runtime-0.1.1/src/agentscope_runtime/engine/services/redis_session_history_service.py +155 -0
  11. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/build.py +1 -1
  12. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/custom/custom_sandbox.py +0 -1
  13. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/custom/example.py +0 -1
  14. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/container_clients/__init__.py +2 -0
  15. agentscope_runtime-0.1.1/src/agentscope_runtime/sandbox/manager/container_clients/docker_client.py +412 -0
  16. agentscope_runtime-0.1.1/src/agentscope_runtime/sandbox/manager/container_clients/kubernetes_client.py +550 -0
  17. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/sandbox_manager.py +21 -82
  18. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/server/app.py +55 -24
  19. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/server/config.py +28 -16
  20. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/model/container.py +3 -1
  21. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/model/manager_config.py +19 -2
  22. agentscope_runtime-0.1.1/src/agentscope_runtime/sandbox/tools/tool.py +234 -0
  23. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/version.py +1 -1
  24. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime.egg-info/PKG-INFO +74 -13
  25. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime.egg-info/SOURCES.txt +4 -1
  26. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime.egg-info/requires.txt +9 -1
  27. agentscope_runtime-0.1.0/src/agentscope_runtime/sandbox/manager/container_clients/docker_client.py +0 -170
  28. agentscope_runtime-0.1.0/src/agentscope_runtime/sandbox/manager/utils.py +0 -78
  29. agentscope_runtime-0.1.0/src/agentscope_runtime/sandbox/tools/tool.py +0 -123
  30. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/LICENSE +0 -0
  31. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/setup.cfg +0 -0
  32. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/setup.py +0 -0
  33. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/__init__.py +0 -0
  34. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/__init__.py +0 -0
  35. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/agents/__init__.py +0 -0
  36. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/agents/agentscope_agent/__init__.py +0 -0
  37. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/agents/agentscope_agent/hooks.py +0 -0
  38. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/agents/base_agent.py +0 -0
  39. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/agents/langgraph_agent.py +0 -0
  40. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/agents/llm_agent.py +0 -0
  41. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/deployers/__init__.py +0 -0
  42. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/deployers/adapter/__init__.py +0 -0
  43. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/deployers/adapter/a2a/__init__.py +0 -0
  44. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/deployers/adapter/a2a/a2a_adapter_utils.py +0 -0
  45. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/deployers/adapter/a2a/a2a_agent_adapter.py +0 -0
  46. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/deployers/adapter/a2a/a2a_protocol_adapter.py +0 -0
  47. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/deployers/adapter/protocol_adapter.py +0 -0
  48. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/deployers/base.py +0 -0
  49. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/deployers/local_deployer.py +0 -0
  50. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/helpers/helper.py +0 -0
  51. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/llms/__init__.py +0 -0
  52. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/llms/base_llm.py +0 -0
  53. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/llms/qwen_llm.py +0 -0
  54. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/misc/__init__.py +0 -0
  55. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/runner.py +0 -0
  56. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/schemas/__init__.py +0 -0
  57. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/schemas/context.py +0 -0
  58. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/services/__init__.py +0 -0
  59. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/services/base.py +0 -0
  60. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/services/context_manager.py +0 -0
  61. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/services/environment_manager.py +0 -0
  62. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/services/manager.py +0 -0
  63. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/services/sandbox_service.py +0 -0
  64. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/services/session_history_service.py +0 -0
  65. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/tracing/__init__.py +0 -0
  66. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/tracing/base.py +0 -0
  67. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/tracing/local_logging_handler.py +0 -0
  68. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/tracing/tracing_metric.py +0 -0
  69. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/engine/tracing/wrapper.py +0 -0
  70. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/__init__.py +0 -0
  71. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/__init__.py +0 -0
  72. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/base/__init__.py +0 -0
  73. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/base/base_sandbox.py +0 -0
  74. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/base/box/__init__.py +0 -0
  75. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/browser/__init__.py +0 -0
  76. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/browser/box/__init__.py +0 -0
  77. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/browser/browser_sandbox.py +0 -0
  78. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/dummy/__init__.py +0 -0
  79. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/dummy/dummy_sandbox.py +0 -0
  80. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/filesystem/__init__.py +0 -0
  81. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/filesystem/box/__init__.py +0 -0
  82. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/filesystem/filesystem_sandbox.py +0 -0
  83. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/sandbox.py +0 -0
  84. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/shared/__init__.py +0 -0
  85. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/shared/app.py +0 -0
  86. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/shared/dependencies/__init__.py +0 -0
  87. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/shared/dependencies/deps.py +0 -0
  88. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/shared/routers/__init__.py +0 -0
  89. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/shared/routers/generic.py +0 -0
  90. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/shared/routers/mcp.py +0 -0
  91. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/shared/routers/mcp_utils.py +0 -0
  92. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/shared/routers/runtime_watcher.py +0 -0
  93. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/shared/routers/workspace.py +0 -0
  94. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/training_box/__init__.py +0 -0
  95. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/training_box/base.py +0 -0
  96. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/training_box/env_service.py +0 -0
  97. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/training_box/environments/__init__.py +0 -0
  98. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/training_box/environments/appworld/appworld_env.py +0 -0
  99. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/training_box/registry.py +0 -0
  100. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/training_box/src/trajectory.py +0 -0
  101. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/box/training_box/training_box.py +0 -0
  102. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/client/__init__.py +0 -0
  103. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/client/http_client.py +0 -0
  104. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/client/training_client.py +0 -0
  105. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/constant.py +0 -0
  106. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/custom/__init__.py +0 -0
  107. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/enums.py +0 -0
  108. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/__init__.py +0 -0
  109. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/collections/__init__.py +0 -0
  110. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/collections/base_mapping.py +0 -0
  111. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/collections/base_queue.py +0 -0
  112. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/collections/base_set.py +0 -0
  113. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/collections/in_memory_mapping.py +0 -0
  114. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/collections/in_memory_queue.py +0 -0
  115. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/collections/in_memory_set.py +0 -0
  116. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/collections/redis_mapping.py +0 -0
  117. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/collections/redis_queue.py +0 -0
  118. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/collections/redis_set.py +0 -0
  119. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/container_clients/base_client.py +0 -0
  120. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/server/__init__.py +0 -0
  121. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/server/models.py +0 -0
  122. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/storage/__init__.py +0 -0
  123. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/storage/data_storage.py +0 -0
  124. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/storage/local_storage.py +0 -0
  125. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/manager/storage/oss_storage.py +0 -0
  126. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/mcp_server.py +0 -0
  127. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/model/__init__.py +0 -0
  128. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/model/api.py +0 -0
  129. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/registry.py +0 -0
  130. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/tools/__init__.py +0 -0
  131. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/tools/base/__init__.py +0 -0
  132. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/tools/base/tool.py +0 -0
  133. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/tools/browser/__init__.py +0 -0
  134. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/tools/browser/tool.py +0 -0
  135. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/tools/filesystem/__init__.py +0 -0
  136. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/tools/filesystem/tool.py +0 -0
  137. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/tools/function_tool.py +0 -0
  138. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/tools/mcp_tool.py +0 -0
  139. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/tools/sandbox_tool.py +0 -0
  140. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime/sandbox/tools/utils.py +0 -0
  141. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime.egg-info/dependency_links.txt +0 -0
  142. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime.egg-info/entry_points.txt +0 -0
  143. {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.1}/src/agentscope_runtime.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentscope-runtime
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: A production-ready runtime framework for agent applications, providing secure sandboxed execution environments and scalable deployment solutions with multi-framework support.
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -17,14 +17,18 @@ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
17
17
  Requires-Dist: pre-commit>=4.2.0; extra == "dev"
18
18
  Requires-Dist: jupyter-book>=1.0.4.post1; extra == "dev"
19
19
  Requires-Dist: furo>=2025.7.19; extra == "dev"
20
+ Requires-Dist: pytest-cov>=6.2.1; extra == "dev"
21
+ Requires-Dist: fakeredis>=2.31.0; extra == "dev"
22
+ Requires-Dist: sphinx-autoapi>=3.6.0; extra == "dev"
20
23
  Provides-Extra: sandbox
21
24
  Requires-Dist: docker>=7.1.0; extra == "sandbox"
22
25
  Requires-Dist: steel-sdk>=0.1.0; extra == "sandbox"
23
26
  Requires-Dist: redis>=6.0.0b2; extra == "sandbox"
24
27
  Requires-Dist: oss2>=2.19.1; extra == "sandbox"
25
- Requires-Dist: requests>=2.32.4; extra == "sandbox"
26
28
  Requires-Dist: pydantic-settings>=2.9.1; extra == "sandbox"
27
29
  Requires-Dist: dotenv>=0.9.9; extra == "sandbox"
30
+ Requires-Dist: kubernetes>=33.1.0; extra == "sandbox"
31
+ Requires-Dist: shortuuid>=1.0.13; extra == "sandbox"
28
32
  Provides-Extra: agentscope
29
33
  Requires-Dist: agentscope==1.0.0; extra == "agentscope"
30
34
  Provides-Extra: langgraph
@@ -33,17 +37,30 @@ Provides-Extra: agno
33
37
  Requires-Dist: agno>=1.7.5; extra == "agno"
34
38
  Provides-Extra: a2a
35
39
  Requires-Dist: a2a-sdk>=0.3.0; extra == "a2a"
40
+ Provides-Extra: autogen
41
+ Requires-Dist: autogen-agentchat>=0.7.4; extra == "autogen"
42
+ Requires-Dist: autogen-ext[openai]>=0.7.4; extra == "autogen"
36
43
  Dynamic: license-file
37
44
 
38
45
  <div align="center">
39
46
 
40
47
  # AgentScope Runtime
41
48
 
42
- [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
43
- [![Version](https://img.shields.io/badge/version-0.1.0-green.svg)](https://github.com/agentscope-ai/agentscope-runtime)
44
- [![License](https://img.shields.io/badge/license-Apache%202.0-yellow.svg)](LICENSE)
45
- [![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
46
-
49
+ [![PyPI](https://img.shields.io/pypi/v/agentscope-runtime?label=PyPI&color=brightgreen&logo=python)](https://pypi.org/project/agentscope-runtime/)
50
+ [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg?logo=python&label=Python)](https://python.org)
51
+ [![License](https://img.shields.io/badge/license-Apache%202.0-red.svg?logo=apache&label=Liscnese)](LICENSE)
52
+ [![Code Style](https://img.shields.io/badge/code%20style-black-black.svg?logo=python&label=CodeStyle)](https://github.com/psf/black)
53
+ [![GitHub Stars](https://img.shields.io/github/stars/agentscope-ai/agentscope-runtime?style=flat&logo=github&color=yellow&label=Stars)](https://github.com/agentscope-ai/agentscope-runtime/stargazers)
54
+ [![GitHub Forks](https://img.shields.io/github/forks/agentscope-ai/agentscope-runtime?style=flat&logo=github&color=purple&label=Forks)](https://github.com/agentscope-ai/agentscope-runtime/network)
55
+ [![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg?logo=githubactions&label=Build)](https://github.com/agentscope-ai/agentscope-runtime/actions)
56
+ [![Cookbook](https://img.shields.io/badge/📚_Cookbook-English|中文-teal.svg)](https://runtime.agentscope.io)
57
+ [![DeepWiki](https://img.shields.io/badge/DeepWiki-agentscope--runtime-navy.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==)](https://deepwiki.com/agentscope-ai/agentscope-runtime)
58
+ [![A2A](https://img.shields.io/badge/A2A-Agent_to_Agent-blue.svg?label=A2A)](https://a2a-protocol.org/)
59
+ [![MCP](https://img.shields.io/badge/MCP-Model_Context_Protocol-purple.svg?logo=plug&label=MCP)](https://modelcontextprotocol.io/)
60
+ [![Discord](https://img.shields.io/badge/Discord-Join_Us-blueviolet.svg?logo=discord)](https://discord.gg/eYMpfnkG8h)
61
+ [![DingTalk](https://img.shields.io/badge/DingTalk-Join_Us-orange.svg)](https://qr.dingtalk.com/action/joingroup?code=v1,k1,OmDlBXpjW+I2vWjKDsjvI9dhcXjGZi3bQiojOq3dlDw=&_dt_no_comment=1&origin=11)
62
+
63
+ [[Cookbook]](https://runtime.agentscope.io/)
47
64
  [[中文README]](README_zh.md)
48
65
 
49
66
  **A Production-Ready Runtime Framework for Intelligent Agent Applications**
@@ -81,7 +98,7 @@ Welcome to join our community on
81
98
 
82
99
  - [🚀 Quick Start](#-quick-start)
83
100
  - [📚 Cookbook](#-cookbook)
84
- - [🔌Agent Framework Integration](#-agent-framework-integration)
101
+ - [🔌 Agent Framework Integration](#-agent-framework-integration)
85
102
  - [🏗️ Deployment](#️-deployment)
86
103
  - [🤝 Contributing](#-contributing)
87
104
  - [📄 License](#-license)
@@ -96,14 +113,30 @@ Welcome to join our community on
96
113
 
97
114
  ### Installation
98
115
 
116
+ From PyPI:
117
+
99
118
  ```bash
100
- # Install dependencies
119
+ # Install core dependencies
101
120
  pip install agentscope-runtime
102
121
 
103
122
  # Install sandbox dependencies
104
123
  pip install "agentscope-runtime[sandbox]"
105
124
  ```
106
125
 
126
+ (Optional) From source:
127
+
128
+ ```bash
129
+ # Pull the source code from GitHub
130
+ git clone -b main https://github.com/agentscope-ai/agentscope-runtime.git
131
+ cd agentscope-runtime
132
+
133
+ # Install core dependencies
134
+ pip install -e .
135
+
136
+ # Install sandbox dependencies
137
+ pip install -e ".[sandbox]"
138
+ ```
139
+
107
140
  ### Basic Agent Usage Example
108
141
 
109
142
  This example demonstrates how to create a simple LLM agent using AgentScope Runtime and stream responses from the Qwen model.
@@ -164,14 +197,19 @@ with BaseSandbox() as box:
164
197
  print(box.run_shell_command(command="echo hello"))
165
198
  ```
166
199
 
200
+ > [!NOTE]
201
+ >
202
+ > Current version requires Docker or Kubernetes to be installed and running on your system. Please refer to [this tutorial](https://runtime.agentscope.io/en/sandbox.html) for more details.
203
+
167
204
  ---
168
205
 
169
206
  ## 📚 Cookbook
170
207
 
171
- - **[📖 Cookbook](/cookbook/en/intro.md)**: Comprehensive tutorials
172
- - **[💡 Concept](/cookbook/en/concept.md)**: Core concepts and architecture overview
173
- - **[🚀 Quick Start](/cookbook/en/quickstart.md)**: Quick start tutorial
174
- - **[🏠 Demo House](/cookbook/en/demohouse.md)**: Rich example projects
208
+ - **[📖 Cookbook](https://runtime.agentscope.io/en/intro.html)**: Comprehensive tutorials
209
+ - **[💡 Concept](https://runtime.agentscope.io/en/concept.html)**: Core concepts and architecture overview
210
+ - **[🚀 Quick Start](https://runtime.agentscope.io/en/quickstart.html)**: Quick start tutorial
211
+ - **[🏠 Demo House](https://runtime.agentscope.io/en/demohouse.html)**: Rich example projects
212
+ - **[📋 API Reference](https://runtime.agentscope.io/en/api/index.html)**: Complete API documentation
175
213
 
176
214
  ---
177
215
 
@@ -180,6 +218,7 @@ with BaseSandbox() as box:
180
218
  ### AgentScope Integration
181
219
 
182
220
  ```python
221
+ # pip install "agentscope-runtime[agentscope]"
183
222
  import os
184
223
 
185
224
  from agentscope.agent import ReActAgent
@@ -202,6 +241,7 @@ agent = AgentScopeAgent(
202
241
  ### Agno Integration
203
242
 
204
243
  ```python
244
+ # pip install "agentscope-runtime[agno]"
205
245
  from agno.agent import Agent
206
246
  from agno.models.openai import OpenAIChat
207
247
  from agentscope_runtime.engine.agents.agno_agent import AgnoAgent
@@ -218,9 +258,30 @@ agent = AgnoAgent(
218
258
  )
219
259
  ```
220
260
 
261
+ ### AutoGen Integration
262
+
263
+ ```python
264
+ # pip install "agentscope-runtime[autogen]"
265
+ from autogen_agentchat.agents import AssistantAgent
266
+ from autogen_ext.models.openai import OpenAIChatCompletionClient
267
+ from agentscope_runtime.engine.agents.autogen_agent import AutogenAgent
268
+
269
+ agent = AutogenAgent(
270
+ name="Friday",
271
+ model=OpenAIChatCompletionClient(
272
+ model="gpt-4",
273
+ ),
274
+ agent_config={
275
+ "system_message": "You're a helpful assistant",
276
+ },
277
+ agent_builder=AssistantAgent,
278
+ )
279
+ ```
280
+
221
281
  ### LangGraph Integration
222
282
 
223
283
  ```python
284
+ # pip install "agentscope-runtime[langgraph]"
224
285
  from typing import TypedDict
225
286
  from langgraph import graph, types
226
287
  from agentscope_runtime.engine.agents.langgraph_agent import LangGraphAgent
@@ -2,11 +2,21 @@
2
2
 
3
3
  # AgentScope Runtime
4
4
 
5
- [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
6
- [![Version](https://img.shields.io/badge/version-0.1.0-green.svg)](https://github.com/agentscope-ai/agentscope-runtime)
7
- [![License](https://img.shields.io/badge/license-Apache%202.0-yellow.svg)](LICENSE)
8
- [![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
9
-
5
+ [![PyPI](https://img.shields.io/pypi/v/agentscope-runtime?label=PyPI&color=brightgreen&logo=python)](https://pypi.org/project/agentscope-runtime/)
6
+ [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg?logo=python&label=Python)](https://python.org)
7
+ [![License](https://img.shields.io/badge/license-Apache%202.0-red.svg?logo=apache&label=Liscnese)](LICENSE)
8
+ [![Code Style](https://img.shields.io/badge/code%20style-black-black.svg?logo=python&label=CodeStyle)](https://github.com/psf/black)
9
+ [![GitHub Stars](https://img.shields.io/github/stars/agentscope-ai/agentscope-runtime?style=flat&logo=github&color=yellow&label=Stars)](https://github.com/agentscope-ai/agentscope-runtime/stargazers)
10
+ [![GitHub Forks](https://img.shields.io/github/forks/agentscope-ai/agentscope-runtime?style=flat&logo=github&color=purple&label=Forks)](https://github.com/agentscope-ai/agentscope-runtime/network)
11
+ [![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg?logo=githubactions&label=Build)](https://github.com/agentscope-ai/agentscope-runtime/actions)
12
+ [![Cookbook](https://img.shields.io/badge/📚_Cookbook-English|中文-teal.svg)](https://runtime.agentscope.io)
13
+ [![DeepWiki](https://img.shields.io/badge/DeepWiki-agentscope--runtime-navy.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==)](https://deepwiki.com/agentscope-ai/agentscope-runtime)
14
+ [![A2A](https://img.shields.io/badge/A2A-Agent_to_Agent-blue.svg?label=A2A)](https://a2a-protocol.org/)
15
+ [![MCP](https://img.shields.io/badge/MCP-Model_Context_Protocol-purple.svg?logo=plug&label=MCP)](https://modelcontextprotocol.io/)
16
+ [![Discord](https://img.shields.io/badge/Discord-Join_Us-blueviolet.svg?logo=discord)](https://discord.gg/eYMpfnkG8h)
17
+ [![DingTalk](https://img.shields.io/badge/DingTalk-Join_Us-orange.svg)](https://qr.dingtalk.com/action/joingroup?code=v1,k1,OmDlBXpjW+I2vWjKDsjvI9dhcXjGZi3bQiojOq3dlDw=&_dt_no_comment=1&origin=11)
18
+
19
+ [[Cookbook]](https://runtime.agentscope.io/)
10
20
  [[中文README]](README_zh.md)
11
21
 
12
22
  **A Production-Ready Runtime Framework for Intelligent Agent Applications**
@@ -44,7 +54,7 @@ Welcome to join our community on
44
54
 
45
55
  - [🚀 Quick Start](#-quick-start)
46
56
  - [📚 Cookbook](#-cookbook)
47
- - [🔌Agent Framework Integration](#-agent-framework-integration)
57
+ - [🔌 Agent Framework Integration](#-agent-framework-integration)
48
58
  - [🏗️ Deployment](#️-deployment)
49
59
  - [🤝 Contributing](#-contributing)
50
60
  - [📄 License](#-license)
@@ -59,14 +69,30 @@ Welcome to join our community on
59
69
 
60
70
  ### Installation
61
71
 
72
+ From PyPI:
73
+
62
74
  ```bash
63
- # Install dependencies
75
+ # Install core dependencies
64
76
  pip install agentscope-runtime
65
77
 
66
78
  # Install sandbox dependencies
67
79
  pip install "agentscope-runtime[sandbox]"
68
80
  ```
69
81
 
82
+ (Optional) From source:
83
+
84
+ ```bash
85
+ # Pull the source code from GitHub
86
+ git clone -b main https://github.com/agentscope-ai/agentscope-runtime.git
87
+ cd agentscope-runtime
88
+
89
+ # Install core dependencies
90
+ pip install -e .
91
+
92
+ # Install sandbox dependencies
93
+ pip install -e ".[sandbox]"
94
+ ```
95
+
70
96
  ### Basic Agent Usage Example
71
97
 
72
98
  This example demonstrates how to create a simple LLM agent using AgentScope Runtime and stream responses from the Qwen model.
@@ -127,14 +153,19 @@ with BaseSandbox() as box:
127
153
  print(box.run_shell_command(command="echo hello"))
128
154
  ```
129
155
 
156
+ > [!NOTE]
157
+ >
158
+ > Current version requires Docker or Kubernetes to be installed and running on your system. Please refer to [this tutorial](https://runtime.agentscope.io/en/sandbox.html) for more details.
159
+
130
160
  ---
131
161
 
132
162
  ## 📚 Cookbook
133
163
 
134
- - **[📖 Cookbook](/cookbook/en/intro.md)**: Comprehensive tutorials
135
- - **[💡 Concept](/cookbook/en/concept.md)**: Core concepts and architecture overview
136
- - **[🚀 Quick Start](/cookbook/en/quickstart.md)**: Quick start tutorial
137
- - **[🏠 Demo House](/cookbook/en/demohouse.md)**: Rich example projects
164
+ - **[📖 Cookbook](https://runtime.agentscope.io/en/intro.html)**: Comprehensive tutorials
165
+ - **[💡 Concept](https://runtime.agentscope.io/en/concept.html)**: Core concepts and architecture overview
166
+ - **[🚀 Quick Start](https://runtime.agentscope.io/en/quickstart.html)**: Quick start tutorial
167
+ - **[🏠 Demo House](https://runtime.agentscope.io/en/demohouse.html)**: Rich example projects
168
+ - **[📋 API Reference](https://runtime.agentscope.io/en/api/index.html)**: Complete API documentation
138
169
 
139
170
  ---
140
171
 
@@ -143,6 +174,7 @@ with BaseSandbox() as box:
143
174
  ### AgentScope Integration
144
175
 
145
176
  ```python
177
+ # pip install "agentscope-runtime[agentscope]"
146
178
  import os
147
179
 
148
180
  from agentscope.agent import ReActAgent
@@ -165,6 +197,7 @@ agent = AgentScopeAgent(
165
197
  ### Agno Integration
166
198
 
167
199
  ```python
200
+ # pip install "agentscope-runtime[agno]"
168
201
  from agno.agent import Agent
169
202
  from agno.models.openai import OpenAIChat
170
203
  from agentscope_runtime.engine.agents.agno_agent import AgnoAgent
@@ -181,9 +214,30 @@ agent = AgnoAgent(
181
214
  )
182
215
  ```
183
216
 
217
+ ### AutoGen Integration
218
+
219
+ ```python
220
+ # pip install "agentscope-runtime[autogen]"
221
+ from autogen_agentchat.agents import AssistantAgent
222
+ from autogen_ext.models.openai import OpenAIChatCompletionClient
223
+ from agentscope_runtime.engine.agents.autogen_agent import AutogenAgent
224
+
225
+ agent = AutogenAgent(
226
+ name="Friday",
227
+ model=OpenAIChatCompletionClient(
228
+ model="gpt-4",
229
+ ),
230
+ agent_config={
231
+ "system_message": "You're a helpful assistant",
232
+ },
233
+ agent_builder=AssistantAgent,
234
+ )
235
+ ```
236
+
184
237
  ### LangGraph Integration
185
238
 
186
239
  ```python
240
+ # pip install "agentscope-runtime[langgraph]"
187
241
  from typing import TypedDict
188
242
  from langgraph import graph, types
189
243
  from agentscope_runtime.engine.agents.langgraph_agent import LangGraphAgent
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agentscope-runtime"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "A production-ready runtime framework for agent applications, providing secure sandboxed execution environments and scalable deployment solutions with multi-framework support."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -32,6 +32,9 @@ dev = [
32
32
  "pre-commit>=4.2.0",
33
33
  "jupyter-book>=1.0.4.post1",
34
34
  "furo>=2025.7.19",
35
+ "pytest-cov>=6.2.1",
36
+ "fakeredis>=2.31.0",
37
+ "sphinx-autoapi>=3.6.0",
35
38
  ]
36
39
 
37
40
  sandbox = [
@@ -39,9 +42,10 @@ sandbox = [
39
42
  "steel-sdk>=0.1.0",
40
43
  "redis>=6.0.0b2",
41
44
  "oss2>=2.19.1",
42
- "requests>=2.32.4",
43
45
  "pydantic-settings>=2.9.1",
44
46
  "dotenv>=0.9.9",
47
+ "kubernetes>=33.1.0",
48
+ "shortuuid>=1.0.13",
45
49
  ]
46
50
 
47
51
  agentscope = [
@@ -58,3 +62,7 @@ agno = [
58
62
  a2a = [
59
63
  "a2a-sdk>=0.3.0",
60
64
  ]
65
+ autogen = [
66
+ "autogen-agentchat>=0.7.4",
67
+ "autogen-ext[openai]>=0.7.4",
68
+ ]
@@ -85,6 +85,7 @@ class AgentScopeContextAdapter:
85
85
 
86
86
  @staticmethod
87
87
  def converter(message: Message):
88
+ # TODO: support more message type
88
89
  if message.role not in ["user", "system", "assistant"]:
89
90
  role_label = "user"
90
91
  else:
@@ -53,6 +53,7 @@ class AgnoContextAdapter:
53
53
 
54
54
  @staticmethod
55
55
  def converter(message: Message):
56
+ # TODO: support more message type
56
57
  return dict(message)
57
58
 
58
59
  async def adapt_new_message(self):
@@ -0,0 +1,245 @@
1
+ # -*- coding: utf-8 -*-
2
+ from typing import Optional, Type
3
+
4
+ from autogen_core.models import ChatCompletionClient
5
+ from autogen_core.tools import FunctionTool
6
+ from autogen_agentchat.agents import AssistantAgent
7
+ from autogen_agentchat.messages import (
8
+ TextMessage,
9
+ ToolCallExecutionEvent,
10
+ ToolCallRequestEvent,
11
+ ModelClientStreamingChunkEvent,
12
+ )
13
+
14
+ from ..agents import Agent
15
+ from ..schemas.context import Context
16
+ from ..schemas.agent_schemas import (
17
+ Message,
18
+ TextContent,
19
+ DataContent,
20
+ FunctionCall,
21
+ FunctionCallOutput,
22
+ MessageType,
23
+ RunStatus,
24
+ )
25
+
26
+
27
+ class AutogenContextAdapter:
28
+ def __init__(self, context: Context, attr: dict):
29
+ self.context = context
30
+ self.attr = attr
31
+
32
+ # Adapted attribute
33
+ self.toolkit = None
34
+ self.model = None
35
+ self.memory = None
36
+ self.new_message = None
37
+
38
+ async def initialize(self):
39
+ self.model = await self.adapt_model()
40
+ self.memory = await self.adapt_memory()
41
+ self.new_message = await self.adapt_new_message()
42
+ self.toolkit = await self.adapt_tools()
43
+
44
+ async def adapt_memory(self):
45
+ messages = []
46
+
47
+ # Build context
48
+ for msg in self.context.session.messages[:-1]: # Exclude the last one
49
+ messages.append(AutogenContextAdapter.converter(msg))
50
+
51
+ return messages
52
+
53
+ @staticmethod
54
+ def converter(message: Message):
55
+ # TODO: support more message type
56
+ return TextMessage.load(
57
+ {
58
+ "id": message.id,
59
+ "source": message.role,
60
+ "content": message.content[0].text if message.content else "",
61
+ },
62
+ )
63
+
64
+ async def adapt_new_message(self):
65
+ last_message = self.context.session.messages[-1]
66
+
67
+ return AutogenContextAdapter.converter(last_message)
68
+
69
+ async def adapt_model(self):
70
+ return self.attr["model"]
71
+
72
+ async def adapt_tools(self):
73
+ toolkit = self.attr["agent_config"].get("toolkit", [])
74
+ tools = self.attr["tools"]
75
+
76
+ # in case, tools is None and tools == []
77
+ if not tools:
78
+ return toolkit
79
+
80
+ if self.context.activate_tools:
81
+ # Only add activated tool
82
+ activated_tools = self.context.activate_tools
83
+ else:
84
+ from ...sandbox.tools.utils import setup_tools
85
+
86
+ activated_tools = setup_tools(
87
+ tools=self.attr["tools"],
88
+ environment_manager=self.context.environment_manager,
89
+ session_id=self.context.session.id,
90
+ user_id=self.context.session.user_id,
91
+ include_schemas=False,
92
+ )
93
+
94
+ for tool in activated_tools:
95
+ func = FunctionTool(
96
+ func=tool.make_function(),
97
+ description=tool.schema["function"]["description"],
98
+ name=tool.name,
99
+ )
100
+ toolkit.append(func)
101
+
102
+ return toolkit
103
+
104
+
105
+ class AutogenAgent(Agent):
106
+ def __init__(
107
+ self,
108
+ name: str,
109
+ model: ChatCompletionClient,
110
+ tools=None,
111
+ agent_config=None,
112
+ agent_builder: Optional[Type[AssistantAgent]] = AssistantAgent,
113
+ ):
114
+ super().__init__(name=name, agent_config=agent_config)
115
+
116
+ assert isinstance(
117
+ model,
118
+ ChatCompletionClient,
119
+ ), "model must be a subclass of ChatCompletionClient in autogen"
120
+
121
+ # Set default agent_builder
122
+ if agent_builder is None:
123
+ agent_builder = AssistantAgent
124
+
125
+ assert issubclass(
126
+ agent_builder,
127
+ AssistantAgent,
128
+ ), "agent_builder must be a subclass of AssistantAgent in autogen"
129
+
130
+ # Replace name if not exists
131
+ self.agent_config["name"] = self.agent_config.get("name") or name
132
+
133
+ self._attr = {
134
+ "model": model,
135
+ "tools": tools,
136
+ "agent_config": self.agent_config,
137
+ "agent_builder": agent_builder,
138
+ }
139
+ self._agent = None
140
+ self.tools = tools
141
+
142
+ def copy(self) -> "AutogenAgent":
143
+ return AutogenAgent(**self._attr)
144
+
145
+ def build(self, as_context):
146
+ self._agent = self._attr["agent_builder"](
147
+ **self._attr["agent_config"],
148
+ model_client=as_context.model,
149
+ tools=as_context.toolkit,
150
+ )
151
+
152
+ return self._agent
153
+
154
+ async def run(self, context):
155
+ ag_context = AutogenContextAdapter(context=context, attr=self._attr)
156
+ await ag_context.initialize()
157
+
158
+ # We should always build a new agent since the state is manage outside
159
+ # the agent
160
+ self._agent = self.build(ag_context)
161
+
162
+ resp = self._agent.run_stream(
163
+ task=ag_context.memory + [ag_context.new_message],
164
+ )
165
+
166
+ text_message = Message(
167
+ type=MessageType.MESSAGE,
168
+ role="assistant",
169
+ status=RunStatus.InProgress,
170
+ )
171
+ yield text_message
172
+
173
+ text_delta_content = TextContent(delta=True)
174
+ is_text_delta = False
175
+ stream_mode = False
176
+ async for event in resp:
177
+ if getattr(event, "source", "user") == "user":
178
+ continue
179
+
180
+ if isinstance(event, TextMessage):
181
+ if stream_mode:
182
+ continue
183
+ is_text_delta = True
184
+ text_delta_content.text = event.content
185
+ text_delta_content = text_message.add_delta_content(
186
+ new_content=text_delta_content,
187
+ )
188
+ yield text_delta_content
189
+ elif isinstance(event, ModelClientStreamingChunkEvent):
190
+ stream_mode = True
191
+ is_text_delta = True
192
+ text_delta_content.text = event.content
193
+ text_delta_content = text_message.add_delta_content(
194
+ new_content=text_delta_content,
195
+ )
196
+ yield text_delta_content
197
+ elif isinstance(event, ToolCallRequestEvent):
198
+ data = DataContent(
199
+ data=FunctionCall(
200
+ call_id=event.id,
201
+ name=event.content[0].name,
202
+ arguments=event.content[0].arguments,
203
+ ).model_dump(),
204
+ )
205
+ message = Message(
206
+ type=MessageType.PLUGIN_CALL,
207
+ role="assistant",
208
+ status=RunStatus.Completed,
209
+ content=[data],
210
+ )
211
+ yield message
212
+ elif isinstance(event, ToolCallExecutionEvent):
213
+ data = DataContent(
214
+ data=FunctionCallOutput(
215
+ call_id=event.id,
216
+ output=event.content[0].content,
217
+ ).model_dump(),
218
+ )
219
+ message = Message(
220
+ type=MessageType.PLUGIN_CALL_OUTPUT,
221
+ role="assistant",
222
+ status=RunStatus.Completed,
223
+ content=[data],
224
+ )
225
+ yield message
226
+
227
+ # Add to message
228
+ is_text_delta = True
229
+ text_delta_content.text = event.content[0].content
230
+ text_delta_content = text_message.add_delta_content(
231
+ new_content=text_delta_content,
232
+ )
233
+ yield text_delta_content
234
+
235
+ if is_text_delta:
236
+ yield text_message.content_completed(text_delta_content.index)
237
+ yield text_message.completed()
238
+
239
+ async def run_async(
240
+ self,
241
+ context,
242
+ **kwargs,
243
+ ):
244
+ async for event in self.run(context):
245
+ yield event
@@ -210,7 +210,7 @@ class Content(Event):
210
210
  delta: Optional[bool] = False
211
211
  """Whether this content is a delta."""
212
212
 
213
- msg_id: str = None
213
+ msg_id: Optional[str] = None
214
214
  """message unique id"""
215
215
 
216
216
 
@@ -58,8 +58,8 @@ class MemoryService(ServiceWithLifecycleManager):
58
58
  Args:
59
59
  user_id: The user id.
60
60
  messages: The user query or the query with history messages,
61
- both in the format of list of messages. If messages is a list,
62
- the search will be based on the content of the last message.
61
+ both in the format of list of messages. If messages is a list,
62
+ the search will be based on the content of the last message.
63
63
  filters: The filters used to search memory
64
64
  """
65
65