agentscope-runtime 0.1.0__tar.gz → 0.1.2__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.
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/PKG-INFO +79 -13
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/README.md +65 -11
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/pyproject.toml +17 -2
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/agents/agentscope_agent/agent.py +1 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/agents/agno_agent.py +1 -0
- agentscope_runtime-0.1.2/src/agentscope_runtime/engine/agents/autogen_agent.py +245 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/schemas/agent_schemas.py +1 -1
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/services/context_manager.py +28 -1
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/services/memory_service.py +2 -2
- agentscope_runtime-0.1.2/src/agentscope_runtime/engine/services/rag_service.py +101 -0
- agentscope_runtime-0.1.2/src/agentscope_runtime/engine/services/redis_memory_service.py +187 -0
- agentscope_runtime-0.1.2/src/agentscope_runtime/engine/services/redis_session_history_service.py +155 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/training_box/env_service.py +1 -1
- agentscope_runtime-0.1.2/src/agentscope_runtime/sandbox/box/training_box/environments/bfcl/bfcl_dataprocess.py +216 -0
- agentscope_runtime-0.1.2/src/agentscope_runtime/sandbox/box/training_box/environments/bfcl/bfcl_env.py +380 -0
- agentscope_runtime-0.1.2/src/agentscope_runtime/sandbox/box/training_box/environments/bfcl/env_handler.py +934 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/training_box/training_box.py +139 -9
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/build.py +1 -1
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/custom/custom_sandbox.py +0 -1
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/custom/example.py +0 -1
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/enums.py +2 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/container_clients/__init__.py +2 -0
- agentscope_runtime-0.1.2/src/agentscope_runtime/sandbox/manager/container_clients/docker_client.py +422 -0
- agentscope_runtime-0.1.2/src/agentscope_runtime/sandbox/manager/container_clients/kubernetes_client.py +605 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/sandbox_manager.py +112 -113
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/server/app.py +96 -28
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/server/config.py +28 -16
- agentscope_runtime-0.1.2/src/agentscope_runtime/sandbox/model/__init__.py +8 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/model/container.py +3 -1
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/model/manager_config.py +21 -15
- agentscope_runtime-0.1.2/src/agentscope_runtime/sandbox/tools/tool.py +234 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/version.py +1 -1
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime.egg-info/PKG-INFO +79 -13
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime.egg-info/SOURCES.txt +8 -1
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime.egg-info/requires.txt +15 -1
- agentscope_runtime-0.1.0/src/agentscope_runtime/sandbox/manager/container_clients/docker_client.py +0 -170
- agentscope_runtime-0.1.0/src/agentscope_runtime/sandbox/manager/utils.py +0 -78
- agentscope_runtime-0.1.0/src/agentscope_runtime/sandbox/model/__init__.py +0 -12
- agentscope_runtime-0.1.0/src/agentscope_runtime/sandbox/tools/tool.py +0 -123
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/LICENSE +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/setup.cfg +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/setup.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/agents/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/agents/agentscope_agent/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/agents/agentscope_agent/hooks.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/agents/base_agent.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/agents/langgraph_agent.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/agents/llm_agent.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/deployers/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/deployers/adapter/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/deployers/adapter/a2a/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/deployers/adapter/a2a/a2a_adapter_utils.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/deployers/adapter/a2a/a2a_agent_adapter.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/deployers/adapter/a2a/a2a_protocol_adapter.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/deployers/adapter/protocol_adapter.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/deployers/base.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/deployers/local_deployer.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/helpers/helper.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/llms/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/llms/base_llm.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/llms/qwen_llm.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/misc/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/runner.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/schemas/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/schemas/context.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/services/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/services/base.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/services/environment_manager.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/services/manager.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/services/sandbox_service.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/services/session_history_service.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/tracing/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/tracing/base.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/tracing/local_logging_handler.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/tracing/tracing_metric.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/engine/tracing/wrapper.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/base/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/base/base_sandbox.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/base/box/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/browser/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/browser/box/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/browser/browser_sandbox.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/dummy/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/dummy/dummy_sandbox.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/filesystem/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/filesystem/box/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/filesystem/filesystem_sandbox.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/sandbox.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/shared/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/shared/app.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/shared/dependencies/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/shared/dependencies/deps.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/shared/routers/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/shared/routers/generic.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/shared/routers/mcp.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/shared/routers/mcp_utils.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/shared/routers/runtime_watcher.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/shared/routers/workspace.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/training_box/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/training_box/base.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/training_box/environments/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/training_box/environments/appworld/appworld_env.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/training_box/registry.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/box/training_box/src/trajectory.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/client/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/client/http_client.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/client/training_client.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/constant.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/custom/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/collections/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/collections/base_mapping.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/collections/base_queue.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/collections/base_set.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/collections/in_memory_mapping.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/collections/in_memory_queue.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/collections/in_memory_set.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/collections/redis_mapping.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/collections/redis_queue.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/collections/redis_set.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/container_clients/base_client.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/server/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/server/models.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/storage/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/storage/data_storage.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/storage/local_storage.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/manager/storage/oss_storage.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/mcp_server.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/model/api.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/registry.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/tools/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/tools/base/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/tools/base/tool.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/tools/browser/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/tools/browser/tool.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/tools/filesystem/__init__.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/tools/filesystem/tool.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/tools/function_tool.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/tools/mcp_tool.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/tools/sandbox_tool.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime/sandbox/tools/utils.py +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime.egg-info/dependency_links.txt +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/src/agentscope_runtime.egg-info/entry_points.txt +0 -0
- {agentscope_runtime-0.1.0 → agentscope_runtime-0.1.2}/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.
|
|
3
|
+
Version: 0.1.2
|
|
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,35 @@ 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"
|
|
43
|
+
Provides-Extra: langchain-rag
|
|
44
|
+
Requires-Dist: langchain>=0.3.25; extra == "langchain-rag"
|
|
45
|
+
Requires-Dist: pymilvus>=2.6.0; extra == "langchain-rag"
|
|
46
|
+
Requires-Dist: langchain-community>=0.3.27; extra == "langchain-rag"
|
|
47
|
+
Requires-Dist: langchain-milvus>=0.2.1; extra == "langchain-rag"
|
|
36
48
|
Dynamic: license-file
|
|
37
49
|
|
|
38
50
|
<div align="center">
|
|
39
51
|
|
|
40
52
|
# AgentScope Runtime
|
|
41
53
|
|
|
42
|
-
[](https://pypi.org/project/agentscope-runtime/)
|
|
55
|
+
[](https://python.org)
|
|
56
|
+
[](LICENSE)
|
|
57
|
+
[](https://github.com/psf/black)
|
|
58
|
+
[](https://github.com/agentscope-ai/agentscope-runtime/stargazers)
|
|
59
|
+
[](https://github.com/agentscope-ai/agentscope-runtime/network)
|
|
60
|
+
[](https://github.com/agentscope-ai/agentscope-runtime/actions)
|
|
61
|
+
[](https://runtime.agentscope.io)
|
|
62
|
+
[](https://deepwiki.com/agentscope-ai/agentscope-runtime)
|
|
63
|
+
[](https://a2a-protocol.org/)
|
|
64
|
+
[](https://modelcontextprotocol.io/)
|
|
65
|
+
[](https://discord.gg/eYMpfnkG8h)
|
|
66
|
+
[](https://qr.dingtalk.com/action/joingroup?code=v1,k1,OmDlBXpjW+I2vWjKDsjvI9dhcXjGZi3bQiojOq3dlDw=&_dt_no_comment=1&origin=11)
|
|
67
|
+
|
|
68
|
+
[[Cookbook]](https://runtime.agentscope.io/)
|
|
47
69
|
[[中文README]](README_zh.md)
|
|
48
70
|
|
|
49
71
|
**A Production-Ready Runtime Framework for Intelligent Agent Applications**
|
|
@@ -81,7 +103,7 @@ Welcome to join our community on
|
|
|
81
103
|
|
|
82
104
|
- [🚀 Quick Start](#-quick-start)
|
|
83
105
|
- [📚 Cookbook](#-cookbook)
|
|
84
|
-
- [🔌Agent Framework Integration](#-agent-framework-integration)
|
|
106
|
+
- [🔌 Agent Framework Integration](#-agent-framework-integration)
|
|
85
107
|
- [🏗️ Deployment](#️-deployment)
|
|
86
108
|
- [🤝 Contributing](#-contributing)
|
|
87
109
|
- [📄 License](#-license)
|
|
@@ -96,14 +118,30 @@ Welcome to join our community on
|
|
|
96
118
|
|
|
97
119
|
### Installation
|
|
98
120
|
|
|
121
|
+
From PyPI:
|
|
122
|
+
|
|
99
123
|
```bash
|
|
100
|
-
# Install dependencies
|
|
124
|
+
# Install core dependencies
|
|
101
125
|
pip install agentscope-runtime
|
|
102
126
|
|
|
103
127
|
# Install sandbox dependencies
|
|
104
128
|
pip install "agentscope-runtime[sandbox]"
|
|
105
129
|
```
|
|
106
130
|
|
|
131
|
+
(Optional) From source:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Pull the source code from GitHub
|
|
135
|
+
git clone -b main https://github.com/agentscope-ai/agentscope-runtime.git
|
|
136
|
+
cd agentscope-runtime
|
|
137
|
+
|
|
138
|
+
# Install core dependencies
|
|
139
|
+
pip install -e .
|
|
140
|
+
|
|
141
|
+
# Install sandbox dependencies
|
|
142
|
+
pip install -e ".[sandbox]"
|
|
143
|
+
```
|
|
144
|
+
|
|
107
145
|
### Basic Agent Usage Example
|
|
108
146
|
|
|
109
147
|
This example demonstrates how to create a simple LLM agent using AgentScope Runtime and stream responses from the Qwen model.
|
|
@@ -164,14 +202,19 @@ with BaseSandbox() as box:
|
|
|
164
202
|
print(box.run_shell_command(command="echo hello"))
|
|
165
203
|
```
|
|
166
204
|
|
|
205
|
+
> [!NOTE]
|
|
206
|
+
>
|
|
207
|
+
> 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.
|
|
208
|
+
|
|
167
209
|
---
|
|
168
210
|
|
|
169
211
|
## 📚 Cookbook
|
|
170
212
|
|
|
171
|
-
- **[📖 Cookbook](/
|
|
172
|
-
- **[💡 Concept](/
|
|
173
|
-
- **[🚀 Quick Start](/
|
|
174
|
-
- **[🏠 Demo House](/
|
|
213
|
+
- **[📖 Cookbook](https://runtime.agentscope.io/en/intro.html)**: Comprehensive tutorials
|
|
214
|
+
- **[💡 Concept](https://runtime.agentscope.io/en/concept.html)**: Core concepts and architecture overview
|
|
215
|
+
- **[🚀 Quick Start](https://runtime.agentscope.io/en/quickstart.html)**: Quick start tutorial
|
|
216
|
+
- **[🏠 Demo House](https://runtime.agentscope.io/en/demohouse.html)**: Rich example projects
|
|
217
|
+
- **[📋 API Reference](https://runtime.agentscope.io/en/api/index.html)**: Complete API documentation
|
|
175
218
|
|
|
176
219
|
---
|
|
177
220
|
|
|
@@ -180,6 +223,7 @@ with BaseSandbox() as box:
|
|
|
180
223
|
### AgentScope Integration
|
|
181
224
|
|
|
182
225
|
```python
|
|
226
|
+
# pip install "agentscope-runtime[agentscope]"
|
|
183
227
|
import os
|
|
184
228
|
|
|
185
229
|
from agentscope.agent import ReActAgent
|
|
@@ -202,6 +246,7 @@ agent = AgentScopeAgent(
|
|
|
202
246
|
### Agno Integration
|
|
203
247
|
|
|
204
248
|
```python
|
|
249
|
+
# pip install "agentscope-runtime[agno]"
|
|
205
250
|
from agno.agent import Agent
|
|
206
251
|
from agno.models.openai import OpenAIChat
|
|
207
252
|
from agentscope_runtime.engine.agents.agno_agent import AgnoAgent
|
|
@@ -218,9 +263,30 @@ agent = AgnoAgent(
|
|
|
218
263
|
)
|
|
219
264
|
```
|
|
220
265
|
|
|
266
|
+
### AutoGen Integration
|
|
267
|
+
|
|
268
|
+
```python
|
|
269
|
+
# pip install "agentscope-runtime[autogen]"
|
|
270
|
+
from autogen_agentchat.agents import AssistantAgent
|
|
271
|
+
from autogen_ext.models.openai import OpenAIChatCompletionClient
|
|
272
|
+
from agentscope_runtime.engine.agents.autogen_agent import AutogenAgent
|
|
273
|
+
|
|
274
|
+
agent = AutogenAgent(
|
|
275
|
+
name="Friday",
|
|
276
|
+
model=OpenAIChatCompletionClient(
|
|
277
|
+
model="gpt-4",
|
|
278
|
+
),
|
|
279
|
+
agent_config={
|
|
280
|
+
"system_message": "You're a helpful assistant",
|
|
281
|
+
},
|
|
282
|
+
agent_builder=AssistantAgent,
|
|
283
|
+
)
|
|
284
|
+
```
|
|
285
|
+
|
|
221
286
|
### LangGraph Integration
|
|
222
287
|
|
|
223
288
|
```python
|
|
289
|
+
# pip install "agentscope-runtime[langgraph]"
|
|
224
290
|
from typing import TypedDict
|
|
225
291
|
from langgraph import graph, types
|
|
226
292
|
from agentscope_runtime.engine.agents.langgraph_agent import LangGraphAgent
|
|
@@ -2,11 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
# AgentScope Runtime
|
|
4
4
|
|
|
5
|
-
[](https://pypi.org/project/agentscope-runtime/)
|
|
6
|
+
[](https://python.org)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://github.com/psf/black)
|
|
9
|
+
[](https://github.com/agentscope-ai/agentscope-runtime/stargazers)
|
|
10
|
+
[](https://github.com/agentscope-ai/agentscope-runtime/network)
|
|
11
|
+
[](https://github.com/agentscope-ai/agentscope-runtime/actions)
|
|
12
|
+
[](https://runtime.agentscope.io)
|
|
13
|
+
[](https://deepwiki.com/agentscope-ai/agentscope-runtime)
|
|
14
|
+
[](https://a2a-protocol.org/)
|
|
15
|
+
[](https://modelcontextprotocol.io/)
|
|
16
|
+
[](https://discord.gg/eYMpfnkG8h)
|
|
17
|
+
[](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](/
|
|
135
|
-
- **[💡 Concept](/
|
|
136
|
-
- **[🚀 Quick Start](/
|
|
137
|
-
- **[🏠 Demo House](/
|
|
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.
|
|
3
|
+
version = "0.1.2"
|
|
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,14 @@ 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
|
+
]
|
|
69
|
+
|
|
70
|
+
langchain_rag=[
|
|
71
|
+
"langchain>=0.3.25",
|
|
72
|
+
"pymilvus>=2.6.0",
|
|
73
|
+
"langchain-community>=0.3.27",
|
|
74
|
+
"langchain-milvus>=0.2.1",
|
|
75
|
+
]
|
|
@@ -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
|