agentkit-sdk-python 0.8.6__tar.gz → 0.8.8__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.
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/PKG-INFO +1 -1
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/agent_server_app/agent_server_app.py +12 -2
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/langgraph_server_app/langgraph_server_app.py +74 -24
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/admin.py +9 -3
- agentkit_sdk_python-0.8.8/agentkit/plugins/__init__.py +5 -0
- agentkit_sdk_python-0.8.8/agentkit/plugins/llm_shield.py +392 -0
- agentkit_sdk_python-0.8.8/agentkit/sdk/runtime/gateway.py +90 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/runtime/types.py +22 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/tools/client.py +20 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/tools/types.py +54 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_config.py +14 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_runtime.py +144 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_tools.py +15 -2
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/agentkit_client.py +18 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/config_handler.py +14 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/strategy_configs.py +52 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/runners/ve_agentkit.py +68 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/strategies/cloud_strategy.py +14 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/strategies/hybrid_strategy.py +14 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/version.py +1 -1
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_sdk_python.egg-info/PKG-INFO +1 -1
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_sdk_python.egg-info/SOURCES.txt +3 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/pyproject.toml +1 -1
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/tests/test_version.py +1 -1
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/LICENSE +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/MANIFEST.in +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/README.md +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/a2a_app/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/a2a_app/a2a_app.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/a2a_app/telemetry.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/agent_server_app/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/agent_server_app/credential_service.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/agent_server_app/inbound_auth.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/agent_server_app/inbound_auth_adapter.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/agent_server_app/middleware.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/agent_server_app/origin.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/agent_server_app/telemetry.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/auth/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/auth/inbound.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/base_app.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/langgraph_server_app/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/mcp_app/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/mcp_app/mcp_app.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/mcp_app/telemetry.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/simple_app/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/simple_app/simple_app.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/simple_app/simple_app_handlers.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/simple_app/telemetry.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/apps/utils.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/_openapi.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/_redact.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/_sigv4.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/credential_hosting.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/errors.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/model_login.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/oauth.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/profile.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/providers.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/resolve.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/session.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/ssl_trust.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/sso.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/store.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/auth/sts.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/client/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/client/base_agentkit_client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/client/base_iam_client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/client/base_service_client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/errors.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/frameworks/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/frameworks/_common.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/frameworks/agentcore.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/frameworks/langchain.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/frameworks/langgraph.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/frameworks/migration.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/frameworks/model_replacement.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/frameworks/serving/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/frameworks/serving/fastapi_mount.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/frameworks/serving/langserve.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/frameworks/strands.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/identity/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/identity/_runtime_dependency.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/identity/client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/identity/context.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/identity/errors.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/identity/jwt.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/identity/middleware.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/identity/runtime.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/identity/transport.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/identity/types.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/platform/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/platform/configuration.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/platform/console_urls.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/platform/constants.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/platform/context.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/platform/provider.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/account/client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/account/types.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/identity/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/identity/auth.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/identity/client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/identity/types.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/knowledge/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/knowledge/client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/knowledge/types.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/mcp/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/mcp/client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/mcp/types.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/memory/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/memory/client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/memory/types.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/model_gateway/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/model_gateway/client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/model_gateway/types.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/runtime/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/runtime/client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/skills/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/skills/client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/skills/types.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/sdk/tools/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/builders/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/builders/base.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/builders/local_docker.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/builders/ve_pipeline.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/builders/ve_sandbox_pipeline.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/__main__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_add.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_auth.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_build.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_delete.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_deploy.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_destroy.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_init.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_invoke.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_knowledge.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_launch.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_list.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_logs.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_memory.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_model_gateway.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_skill.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_skills.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_skills_workflow.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_status.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/cli_version.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/console_reporter.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/interactive_config.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/a2a_client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_build.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_config.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_create.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_delete.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_exec.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_init.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_invoke.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_list.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_model_login.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_mount.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_run.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_scp.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_shell.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/cli_web.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/config_store.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/env_config.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/git_config.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/model_config.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/sandbox_client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/session_create.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/session_sync.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/tool_resolve.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/sandbox/tos_config.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/tool_lookup.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/cli/utils.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/choice_resolvers.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/cloud_provider.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/config.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/config_validator.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/constants.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/dataclass_utils.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/docker_build_config.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/global_config.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/region_defaults.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/region_resolver.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/config/utils.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/context.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/docker/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/docker/base_images.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/docker/container.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/docker/dockerfile/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/docker/dockerfile/manager.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/docker/dockerfile/metadata.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/docker/utils.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/errors.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/executors/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/executors/base_executor.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/executors/build_executor.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/executors/deploy_executor.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/executors/init_executor.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/executors/invoke_executor.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/executors/lifecycle_executor.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/executors/status_executor.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/harness/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/harness/config_builder.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/harness/deploy.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/harness/env_mapping.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/models.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/reporter.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/a2a.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/agent_server.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/basic.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/basic_stream.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/customer_support_assistant.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/eino_a2a/agent.go +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/eino_a2a/build.sh +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/eino_a2a/go.mod +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/eino_a2a/go.sum +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/eino_a2a/main.go +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/financial_analyst.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/langchain_basic_stream.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/simple_app_veadk.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/simple_mcp_veadk.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/veadk_go_a2a/agent.go +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/veadk_go_a2a/build.sh +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/veadk_go_a2a/go.mod +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/veadk_go_a2a/go.sum +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/veadk_go_a2a/main.go +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/veadk_go_basic/agent.go +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/veadk_go_basic/build.sh +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/veadk_go_basic/go.mod +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/veadk_go_basic/go.sum +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/samples/veadk_go_basic/main.go +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/templates/code-pipeline-sandbox-tos-cr-step.j2 +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/templates/code-pipeline-tos-cr-step.j2 +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/templates/golang/Dockerfile.j2 +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/templates/python/Dockerfile.j2 +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/templates/sandbox/Dockerfile.install-package +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/templates/sandbox/Dockerfile.install-skills +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/templates/sandbox/Dockerfile.web-server +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/wrappers/wrapper_basic.py.jinja2 +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/resources/wrappers/wrapper_stream.py.jinja2 +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/runners/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/runners/base.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/runners/local_docker.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/sdk/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/sdk/bindings/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/sdk/bindings/memory.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/sdk/builder.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/sdk/client.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/sdk/config.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/sdk/deployer.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/sdk/initializer.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/sdk/invoker.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/sdk/lifecycle.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/sdk/status.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/strategies/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/strategies/base_strategy.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/strategies/local_strategy.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/utils/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/utils/agent_parser.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/volcengine/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/volcengine/apmplus_logs.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/volcengine/code_pipeline.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/volcengine/cr.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/volcengine/iam.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/volcengine/services/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/volcengine/services/cr_service.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/volcengine/services/tos_service.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/volcengine/sts.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/volcengine/utils/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/toolkit/volcengine/utils/project_archiver.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/utils/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/utils/global_config_io.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/utils/http_defaults.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/utils/logging_config.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/utils/misc.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/utils/redact.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/utils/request.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/utils/template_utils.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit/utils/ve_sign.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_identity/__init__.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_identity/context.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_identity/errors.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_identity/jwt.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_identity/middleware.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_identity/py.typed +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_identity/runtime.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_identity/transport.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_identity/types.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_sdk_python.egg-info/dependency_links.txt +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_sdk_python.egg-info/entry_points.txt +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_sdk_python.egg-info/requires.txt +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/agentkit_sdk_python.egg-info/top_level.txt +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/setup.cfg +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/tests/test_client_uses_platform_context.py +0 -0
- {agentkit_sdk_python-0.8.6 → agentkit_sdk_python-0.8.8}/tests/test_error_hierarchy.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentkit-sdk-python
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.8
|
|
4
4
|
Summary: Python SDK for transforming any AI agent into a production-ready application. Framework-agnostic primitives for runtime, memory, authentication, and tools with volcengine-managed infrastructure.
|
|
5
5
|
Author-email: Xiangrui Cheng <innsdcc@gmail.com>, Yumeng Bao <baoyumeng.123@gmail.com>, Yaozheng Fang <fangyozheng@gmail.com>, Guodong Li <cu.eric.lee@gmail.com>
|
|
6
6
|
License: Apache License
|
|
@@ -126,13 +126,14 @@ def _resolve_memory_service(root_agent: BaseAgent) -> Any:
|
|
|
126
126
|
|
|
127
127
|
def _create_a2a_runner(
|
|
128
128
|
*,
|
|
129
|
-
|
|
129
|
+
entry: BaseAgent | App,
|
|
130
130
|
short_term_memory: BaseSessionService | Any | None,
|
|
131
131
|
session_service: BaseSessionService,
|
|
132
132
|
memory_service: Any,
|
|
133
133
|
artifact_service: InMemoryArtifactService,
|
|
134
134
|
credential_service: InMemoryCredentialService,
|
|
135
135
|
) -> Any:
|
|
136
|
+
root_agent = entry.root_agent if isinstance(entry, App) else entry
|
|
136
137
|
if VeadkRunner is not None and (
|
|
137
138
|
_is_veadk_agent(root_agent) or _is_veadk_short_term_memory(short_term_memory)
|
|
138
139
|
):
|
|
@@ -145,6 +146,15 @@ def _create_a2a_runner(
|
|
|
145
146
|
session_service=session_service,
|
|
146
147
|
memory_service=memory_service,
|
|
147
148
|
credential_service=credential_service,
|
|
149
|
+
**({"plugins": entry.plugins} if isinstance(entry, App) else {}),
|
|
150
|
+
)
|
|
151
|
+
if isinstance(entry, App):
|
|
152
|
+
return Runner(
|
|
153
|
+
app=entry,
|
|
154
|
+
session_service=session_service,
|
|
155
|
+
memory_service=memory_service,
|
|
156
|
+
artifact_service=artifact_service,
|
|
157
|
+
credential_service=credential_service,
|
|
148
158
|
)
|
|
149
159
|
return Runner(
|
|
150
160
|
agent=root_agent,
|
|
@@ -291,7 +301,7 @@ class AgentkitAgentServerApp(BaseAgentkitApp):
|
|
|
291
301
|
)
|
|
292
302
|
|
|
293
303
|
runner = _create_a2a_runner(
|
|
294
|
-
|
|
304
|
+
entry=entry,
|
|
295
305
|
short_term_memory=short_term_memory,
|
|
296
306
|
session_service=session_service,
|
|
297
307
|
memory_service=memory_service,
|
|
@@ -8,7 +8,7 @@ import logging
|
|
|
8
8
|
import os
|
|
9
9
|
import sys
|
|
10
10
|
from pathlib import Path
|
|
11
|
-
from typing import Any
|
|
11
|
+
from typing import TYPE_CHECKING, Any
|
|
12
12
|
from uuid import NAMESPACE_URL, uuid4, uuid5
|
|
13
13
|
|
|
14
14
|
import uvicorn
|
|
@@ -21,6 +21,9 @@ from typing_extensions import override
|
|
|
21
21
|
|
|
22
22
|
from agentkit.apps.base_app import BaseAgentkitApp
|
|
23
23
|
|
|
24
|
+
if TYPE_CHECKING:
|
|
25
|
+
from agentkit.plugins.llm_shield import LLMShieldPlugin
|
|
26
|
+
|
|
24
27
|
logger = logging.getLogger(__name__)
|
|
25
28
|
|
|
26
29
|
_OUTPUT_FIELD_KEYS = ("answer", "output", "final", "response", "text", "messages")
|
|
@@ -483,6 +486,7 @@ class AgentkitLangGraphServerApp(BaseAgentkitApp):
|
|
|
483
486
|
graph_id: str | None = None,
|
|
484
487
|
input_key: str | None = None,
|
|
485
488
|
allow_blocking: bool | None = None,
|
|
489
|
+
llm_shield: LLMShieldPlugin | None = None,
|
|
486
490
|
) -> None:
|
|
487
491
|
super().__init__()
|
|
488
492
|
self.config_path = Path(config_path).resolve()
|
|
@@ -490,6 +494,7 @@ class AgentkitLangGraphServerApp(BaseAgentkitApp):
|
|
|
490
494
|
self.config = _normalize_config_paths(self.config_path.parent, raw_config)
|
|
491
495
|
self.graph_id = _resolve_graph_id(self.config, graph_id)
|
|
492
496
|
self.input_key = input_key
|
|
497
|
+
self.llm_shield = llm_shield
|
|
493
498
|
_extend_python_path(self.config_path.parent, self.config)
|
|
494
499
|
_prepare_langgraph_environment(self.config_path, self.config, allow_blocking=allow_blocking)
|
|
495
500
|
_materialize_lazy_graph_exports(self.config.get("graphs"))
|
|
@@ -546,34 +551,79 @@ class AgentkitLangGraphServerApp(BaseAgentkitApp):
|
|
|
546
551
|
)
|
|
547
552
|
|
|
548
553
|
async def _stream_events(self, req: AgentkitRunRequest):
|
|
554
|
+
input_text = _content_text(req.new_message)
|
|
555
|
+
if self.llm_shield is not None:
|
|
556
|
+
replacement = await self.llm_shield.moderate_text(input_text, role="user")
|
|
557
|
+
if replacement is not None:
|
|
558
|
+
yield _agentkit_text_event(self.graph_id, replacement, partial=False)
|
|
559
|
+
return
|
|
549
560
|
await self._ensure_thread(req.app_name or self.graph_id, req.user_id, req.session_id)
|
|
550
561
|
accumulated_text = ""
|
|
551
562
|
final_text = ""
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
563
|
+
try:
|
|
564
|
+
async for chunk in self._client.runs.stream(
|
|
565
|
+
**self._run_kwargs(req),
|
|
566
|
+
stream_mode=["messages", "updates", "values"],
|
|
567
|
+
version="v2",
|
|
568
|
+
):
|
|
569
|
+
mode, data = _stream_chunk(chunk)
|
|
570
|
+
if mode == "messages" or mode.startswith("messages/"):
|
|
571
|
+
text = _stream_message_text(data)
|
|
572
|
+
delta = _chunk_delta(accumulated_text, text)
|
|
573
|
+
if delta:
|
|
574
|
+
buffered_text = accumulated_text + delta
|
|
575
|
+
if (
|
|
576
|
+
self.llm_shield is not None
|
|
577
|
+
and len(buffered_text.encode("utf-8")) > self.llm_shield.max_output_bytes
|
|
578
|
+
):
|
|
579
|
+
yield _agentkit_text_event(
|
|
580
|
+
self.graph_id,
|
|
581
|
+
self.llm_shield.unavailable_message,
|
|
582
|
+
partial=False,
|
|
583
|
+
)
|
|
584
|
+
return
|
|
585
|
+
accumulated_text = buffered_text
|
|
586
|
+
if self.llm_shield is None:
|
|
587
|
+
yield _agentkit_text_event(self.graph_id, delta, partial=True)
|
|
588
|
+
if text:
|
|
589
|
+
final_text = text
|
|
590
|
+
continue
|
|
591
|
+
if mode in {"updates", "values"}:
|
|
592
|
+
interrupt = _interrupt_payload(data)
|
|
593
|
+
if interrupt is not None:
|
|
594
|
+
yield _interrupt_event(self.graph_id, interrupt)
|
|
595
|
+
return
|
|
596
|
+
text = _update_output_text(data)
|
|
597
|
+
if text:
|
|
598
|
+
if (
|
|
599
|
+
self.llm_shield is not None
|
|
600
|
+
and len(text.encode("utf-8")) > self.llm_shield.max_output_bytes
|
|
601
|
+
):
|
|
602
|
+
yield _agentkit_text_event(
|
|
603
|
+
self.graph_id,
|
|
604
|
+
self.llm_shield.unavailable_message,
|
|
605
|
+
partial=False,
|
|
606
|
+
)
|
|
607
|
+
return
|
|
608
|
+
final_text = text
|
|
609
|
+
except Exception as exc:
|
|
610
|
+
if self.llm_shield is None:
|
|
611
|
+
raise
|
|
612
|
+
logger.warning(
|
|
613
|
+
"LangGraph Server stream failed while LLM Shield was enabled (%s)",
|
|
614
|
+
type(exc).__name__,
|
|
615
|
+
)
|
|
616
|
+
yield _agentkit_text_event(
|
|
617
|
+
self.graph_id,
|
|
618
|
+
self.llm_shield.unavailable_message,
|
|
619
|
+
partial=False,
|
|
620
|
+
)
|
|
621
|
+
return
|
|
575
622
|
final_text = final_text or accumulated_text
|
|
576
623
|
if final_text:
|
|
624
|
+
if self.llm_shield is not None:
|
|
625
|
+
replacement = await self.llm_shield.moderate_text(final_text, role="assistant")
|
|
626
|
+
final_text = replacement or final_text
|
|
577
627
|
yield _agentkit_text_event(self.graph_id, final_text, partial=False)
|
|
578
628
|
|
|
579
629
|
def _attach_agentkit_routes(self) -> None:
|
|
@@ -47,9 +47,15 @@ POLICY_NAME = "agentkit_cli_sandbox_access"
|
|
|
47
47
|
SANDBOX_ACCESS_POLICY = "AgentKitSandboxAccess"
|
|
48
48
|
WELL_KNOWN_KEY = ".well-known/agentkit-cli"
|
|
49
49
|
ROLE_ACTIONS = (
|
|
50
|
-
"agentkit:CreateSession",
|
|
51
|
-
"agentkit:
|
|
52
|
-
"agentkit:
|
|
50
|
+
"agentkit:CreateSession",
|
|
51
|
+
"agentkit:GetSession",
|
|
52
|
+
"agentkit:DeleteSession",
|
|
53
|
+
"agentkit:PauseSession",
|
|
54
|
+
"agentkit:ResumeSession",
|
|
55
|
+
"agentkit:GetSessionLogs",
|
|
56
|
+
"agentkit:SetSessionTtl",
|
|
57
|
+
"agentkit:ListTools",
|
|
58
|
+
"agentkit:GetTool",
|
|
53
59
|
)
|
|
54
60
|
|
|
55
61
|
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
"""LLM Shield integration for AgentKit migration runtimes."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import json
|
|
7
|
+
import logging
|
|
8
|
+
import os
|
|
9
|
+
from dataclasses import dataclass
|
|
10
|
+
from enum import Enum
|
|
11
|
+
from typing import Any, Literal
|
|
12
|
+
|
|
13
|
+
import requests
|
|
14
|
+
from google.adk.events import Event
|
|
15
|
+
from google.adk.plugins import BasePlugin
|
|
16
|
+
from google.genai import types
|
|
17
|
+
from volcengine.Credentials import Credentials as SigningCredentials
|
|
18
|
+
from volcengine.auth.SignerV4 import SignerV4
|
|
19
|
+
from volcengine.base.Request import Request as SigningRequest
|
|
20
|
+
|
|
21
|
+
from agentkit.platform.configuration import VolcConfiguration
|
|
22
|
+
from agentkit.utils.http_defaults import http_timeout
|
|
23
|
+
|
|
24
|
+
logger = logging.getLogger(__name__)
|
|
25
|
+
|
|
26
|
+
LLM_SHIELD_BLOCK_MESSAGE = (
|
|
27
|
+
"Your request has been blocked by the security policy. "
|
|
28
|
+
"Please modify it and try again."
|
|
29
|
+
)
|
|
30
|
+
LLM_SHIELD_UNAVAILABLE_MESSAGE = (
|
|
31
|
+
"The security service is unavailable. Please try again later."
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
_ACTION = "Moderate"
|
|
35
|
+
_API_VERSION = "2025-08-31"
|
|
36
|
+
_DEFAULT_REGION = "cn-beijing"
|
|
37
|
+
_SERVICE = "llmshield"
|
|
38
|
+
_PATH = "/v2/moderate"
|
|
39
|
+
_INVOCATION_STATE_KEY = "__agentkit_llm_shield__"
|
|
40
|
+
_TRUE_VALUES = frozenset({"1", "true", "yes", "on"})
|
|
41
|
+
_FALSE_VALUES = frozenset({"", "0", "false", "no", "off"})
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class _Decision(Enum):
|
|
45
|
+
ALLOW = "allow"
|
|
46
|
+
BLOCK = "block"
|
|
47
|
+
ERROR = "error"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass(frozen=True)
|
|
51
|
+
class _ModerationResult:
|
|
52
|
+
decision: _Decision
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class LLMShieldPlugin(BasePlugin):
|
|
56
|
+
"""Moderate AgentKit text boundaries with Volcengine LLM Shield.
|
|
57
|
+
|
|
58
|
+
Applications opt in by attaching the plugin to the ADK ``App.plugins``
|
|
59
|
+
boundary; :meth:`from_env` reads the migration runtime environment, where a
|
|
60
|
+
configured ``TOOL_LLM_SHIELD_APP_ID`` enables moderation and
|
|
61
|
+
``ENABLE_LLM_SHIELD`` only overrides that default. Existing AgentKit
|
|
62
|
+
applications are unchanged until they construct this plugin.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
unavailable_message = LLM_SHIELD_UNAVAILABLE_MESSAGE
|
|
66
|
+
|
|
67
|
+
def __init__(
|
|
68
|
+
self,
|
|
69
|
+
*,
|
|
70
|
+
app_id: str,
|
|
71
|
+
region: str = _DEFAULT_REGION,
|
|
72
|
+
timeout: float | None = None,
|
|
73
|
+
base_url: str | None = None,
|
|
74
|
+
max_output_bytes: int = 256 * 1024,
|
|
75
|
+
) -> None:
|
|
76
|
+
super().__init__(name="LLMShieldPlugin")
|
|
77
|
+
if not app_id.strip():
|
|
78
|
+
raise ValueError("LLM Shield app_id must not be empty")
|
|
79
|
+
if not region.strip():
|
|
80
|
+
raise ValueError("LLM Shield region must not be empty")
|
|
81
|
+
if max_output_bytes <= 0:
|
|
82
|
+
raise ValueError("max_output_bytes must be greater than zero")
|
|
83
|
+
|
|
84
|
+
self.app_id = app_id.strip()
|
|
85
|
+
self.region = region.strip()
|
|
86
|
+
self.timeout = timeout if timeout is not None else http_timeout()
|
|
87
|
+
self.base_url = (
|
|
88
|
+
base_url or f"https://{self.region}.sdk.access.llm-shield.omini-shield.com"
|
|
89
|
+
).rstrip("/")
|
|
90
|
+
self.max_output_bytes = max_output_bytes
|
|
91
|
+
self._configuration = VolcConfiguration(region=self.region)
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
def from_env(cls) -> LLMShieldPlugin | None:
|
|
95
|
+
"""Build the plugin from the migration runtime environment.
|
|
96
|
+
|
|
97
|
+
A configured ``TOOL_LLM_SHIELD_APP_ID`` is the enablement signal, so
|
|
98
|
+
migrations do not need a separate switch. ``ENABLE_LLM_SHIELD`` is an
|
|
99
|
+
optional override: ``0/false/no/off`` forces the plugin off even when an
|
|
100
|
+
App ID is configured, while ``1/true/yes/on`` requires an App ID and
|
|
101
|
+
fails fast without one. Most configurations require only the App ID;
|
|
102
|
+
request authentication uses AgentKit's AK/SK, STS, or Runtime IAM
|
|
103
|
+
credential chain.
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
raw_override = os.getenv("ENABLE_LLM_SHIELD", "").strip().lower()
|
|
107
|
+
app_id = os.getenv("TOOL_LLM_SHIELD_APP_ID", "").strip()
|
|
108
|
+
if os.getenv("TOOL_LLM_SHIELD_API_KEY", "").strip():
|
|
109
|
+
logger.warning(
|
|
110
|
+
"TOOL_LLM_SHIELD_API_KEY is deprecated and ignored; "
|
|
111
|
+
"LLM Shield authenticates with AgentKit credentials"
|
|
112
|
+
)
|
|
113
|
+
forced_off = bool(raw_override) and raw_override in _FALSE_VALUES
|
|
114
|
+
required_on = raw_override in _TRUE_VALUES
|
|
115
|
+
if raw_override and not (forced_off or required_on):
|
|
116
|
+
raise ValueError(
|
|
117
|
+
"ENABLE_LLM_SHIELD must be one of 1/true/yes/on or 0/false/no/off"
|
|
118
|
+
)
|
|
119
|
+
if forced_off:
|
|
120
|
+
return None
|
|
121
|
+
|
|
122
|
+
if not app_id:
|
|
123
|
+
if required_on:
|
|
124
|
+
raise ValueError(
|
|
125
|
+
"TOOL_LLM_SHIELD_APP_ID is required when ENABLE_LLM_SHIELD=true"
|
|
126
|
+
)
|
|
127
|
+
return None
|
|
128
|
+
|
|
129
|
+
region = os.getenv("TOOL_LLM_SHIELD_REGION", "").strip()
|
|
130
|
+
region = region or _DEFAULT_REGION
|
|
131
|
+
|
|
132
|
+
return cls(
|
|
133
|
+
app_id=app_id,
|
|
134
|
+
region=region,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
async def moderate_text(
|
|
138
|
+
self, text: str, *, role: Literal["user", "assistant"]
|
|
139
|
+
) -> str | None:
|
|
140
|
+
"""Return replacement text when content must not pass unchanged."""
|
|
141
|
+
|
|
142
|
+
if not text:
|
|
143
|
+
return None
|
|
144
|
+
if role not in {"user", "assistant"}:
|
|
145
|
+
raise ValueError("LLM Shield role must be 'user' or 'assistant'")
|
|
146
|
+
if role == "assistant" and len(text.encode("utf-8")) > self.max_output_bytes:
|
|
147
|
+
logger.warning("LLM Shield output exceeded the moderation size limit")
|
|
148
|
+
return LLM_SHIELD_UNAVAILABLE_MESSAGE
|
|
149
|
+
result = await asyncio.to_thread(self._moderate_sync, text, role)
|
|
150
|
+
if result.decision is _Decision.ALLOW:
|
|
151
|
+
return None
|
|
152
|
+
if result.decision is _Decision.BLOCK:
|
|
153
|
+
return LLM_SHIELD_BLOCK_MESSAGE
|
|
154
|
+
return LLM_SHIELD_UNAVAILABLE_MESSAGE
|
|
155
|
+
|
|
156
|
+
def _moderate_sync(
|
|
157
|
+
self, text: str, role: Literal["user", "assistant"]
|
|
158
|
+
) -> _ModerationResult:
|
|
159
|
+
body = json.dumps(
|
|
160
|
+
{
|
|
161
|
+
"Message": {
|
|
162
|
+
"Role": role,
|
|
163
|
+
"Content": text,
|
|
164
|
+
"ContentType": 1,
|
|
165
|
+
},
|
|
166
|
+
"Scene": self.app_id,
|
|
167
|
+
},
|
|
168
|
+
ensure_ascii=False,
|
|
169
|
+
)
|
|
170
|
+
try:
|
|
171
|
+
headers = self._request_headers(body)
|
|
172
|
+
response = requests.post(
|
|
173
|
+
f"{self.base_url}{_PATH}",
|
|
174
|
+
headers=headers,
|
|
175
|
+
params={"Action": _ACTION, "Version": _API_VERSION},
|
|
176
|
+
data=body,
|
|
177
|
+
timeout=self.timeout,
|
|
178
|
+
)
|
|
179
|
+
except requests.Timeout:
|
|
180
|
+
logger.warning("LLM Shield moderation request timed out")
|
|
181
|
+
return _ModerationResult(_Decision.ERROR)
|
|
182
|
+
except requests.RequestException:
|
|
183
|
+
logger.warning("LLM Shield moderation network request failed")
|
|
184
|
+
return _ModerationResult(_Decision.ERROR)
|
|
185
|
+
except Exception:
|
|
186
|
+
logger.warning("LLM Shield moderation authentication failed")
|
|
187
|
+
return _ModerationResult(_Decision.ERROR)
|
|
188
|
+
|
|
189
|
+
if response.status_code != 200:
|
|
190
|
+
logger.warning(
|
|
191
|
+
"LLM Shield moderation returned HTTP %s", response.status_code
|
|
192
|
+
)
|
|
193
|
+
return _ModerationResult(_Decision.ERROR)
|
|
194
|
+
try:
|
|
195
|
+
payload = response.json()
|
|
196
|
+
except ValueError:
|
|
197
|
+
logger.warning("LLM Shield moderation returned invalid JSON")
|
|
198
|
+
return _ModerationResult(_Decision.ERROR)
|
|
199
|
+
|
|
200
|
+
if not isinstance(payload, dict):
|
|
201
|
+
logger.warning("LLM Shield moderation returned an invalid response")
|
|
202
|
+
return _ModerationResult(_Decision.ERROR)
|
|
203
|
+
result = payload.get("Result")
|
|
204
|
+
decision = result.get("Decision") if isinstance(result, dict) else None
|
|
205
|
+
decision_type = (
|
|
206
|
+
decision.get("DecisionType") if isinstance(decision, dict) else None
|
|
207
|
+
)
|
|
208
|
+
try:
|
|
209
|
+
normalized_decision = int(decision_type)
|
|
210
|
+
except (TypeError, ValueError):
|
|
211
|
+
normalized_decision = None
|
|
212
|
+
if normalized_decision == 1:
|
|
213
|
+
return _ModerationResult(_Decision.ALLOW)
|
|
214
|
+
if normalized_decision == 2:
|
|
215
|
+
return _ModerationResult(_Decision.BLOCK)
|
|
216
|
+
logger.warning("LLM Shield moderation returned an unknown decision")
|
|
217
|
+
return _ModerationResult(_Decision.ERROR)
|
|
218
|
+
|
|
219
|
+
def _request_headers(self, body: str) -> dict[str, str]:
|
|
220
|
+
credentials = self._configuration.get_service_credentials("llm_shield")
|
|
221
|
+
host = self.base_url.split("://", 1)[-1].split("/", 1)[0]
|
|
222
|
+
request = SigningRequest()
|
|
223
|
+
request.set_schema("https")
|
|
224
|
+
request.set_method("POST")
|
|
225
|
+
request.set_host(host)
|
|
226
|
+
request.set_path(_PATH)
|
|
227
|
+
request.set_headers({"Content-Type": "application/json", "Host": host})
|
|
228
|
+
request.set_query({"Action": _ACTION, "Version": _API_VERSION})
|
|
229
|
+
request.set_body(body)
|
|
230
|
+
SignerV4.sign(
|
|
231
|
+
request,
|
|
232
|
+
SigningCredentials(
|
|
233
|
+
credentials.access_key,
|
|
234
|
+
credentials.secret_key,
|
|
235
|
+
_SERVICE,
|
|
236
|
+
self.region,
|
|
237
|
+
credentials.session_token or "",
|
|
238
|
+
),
|
|
239
|
+
)
|
|
240
|
+
request.headers.update({"X-Top-Service": _SERVICE, "X-Top-Region": self.region})
|
|
241
|
+
return dict(request.headers)
|
|
242
|
+
|
|
243
|
+
async def before_run_callback(self, *, invocation_context) -> types.Content | None:
|
|
244
|
+
text = _content_text(getattr(invocation_context, "user_content", None))
|
|
245
|
+
replacement = await self.moderate_text(text, role="user")
|
|
246
|
+
if replacement is None:
|
|
247
|
+
return None
|
|
248
|
+
_invocation_state(invocation_context)["terminal"] = True
|
|
249
|
+
return _model_content(replacement)
|
|
250
|
+
|
|
251
|
+
async def before_tool_callback(
|
|
252
|
+
self,
|
|
253
|
+
*,
|
|
254
|
+
tool: Any,
|
|
255
|
+
tool_args: dict[str, Any],
|
|
256
|
+
tool_context: Any,
|
|
257
|
+
) -> dict[str, Any] | None:
|
|
258
|
+
del tool, tool_context
|
|
259
|
+
text = _tool_payload_text(tool_args)
|
|
260
|
+
if text is None:
|
|
261
|
+
return {"result": LLM_SHIELD_UNAVAILABLE_MESSAGE}
|
|
262
|
+
replacement = await self.moderate_text(text, role="user")
|
|
263
|
+
return {"result": replacement} if replacement is not None else None
|
|
264
|
+
|
|
265
|
+
async def after_tool_callback(
|
|
266
|
+
self,
|
|
267
|
+
*,
|
|
268
|
+
tool: Any,
|
|
269
|
+
tool_args: dict[str, Any],
|
|
270
|
+
tool_context: Any,
|
|
271
|
+
result: dict[str, Any],
|
|
272
|
+
) -> dict[str, Any] | None:
|
|
273
|
+
del tool, tool_args, tool_context
|
|
274
|
+
text = _tool_payload_text(result)
|
|
275
|
+
if text is None:
|
|
276
|
+
return {"result": LLM_SHIELD_UNAVAILABLE_MESSAGE}
|
|
277
|
+
replacement = await self.moderate_text(text, role="assistant")
|
|
278
|
+
return {"result": replacement} if replacement is not None else None
|
|
279
|
+
|
|
280
|
+
async def on_event_callback(
|
|
281
|
+
self, *, invocation_context, event: Event
|
|
282
|
+
) -> Event | None:
|
|
283
|
+
state = _invocation_state(invocation_context)
|
|
284
|
+
if state.get("terminal"):
|
|
285
|
+
return event
|
|
286
|
+
if getattr(event, "author", None) == "user":
|
|
287
|
+
return event
|
|
288
|
+
content = getattr(event, "content", None)
|
|
289
|
+
if getattr(content, "role", None) == "user":
|
|
290
|
+
return event
|
|
291
|
+
text = _content_text(content)
|
|
292
|
+
if getattr(event, "partial", None) is True:
|
|
293
|
+
if text:
|
|
294
|
+
buffered = _merge_stream_text(str(state.get("output", "")), text)
|
|
295
|
+
if len(buffered.encode("utf-8")) > self.max_output_bytes:
|
|
296
|
+
state.pop("output", None)
|
|
297
|
+
state["overflowed"] = True
|
|
298
|
+
else:
|
|
299
|
+
state["output"] = buffered
|
|
300
|
+
return _replace_event_text(event, "") if text else event
|
|
301
|
+
|
|
302
|
+
buffered = str(state.pop("output", ""))
|
|
303
|
+
if state.pop("overflowed", False):
|
|
304
|
+
return _replace_event_text(event, LLM_SHIELD_UNAVAILABLE_MESSAGE)
|
|
305
|
+
final_text = _final_stream_text(buffered, text)
|
|
306
|
+
if not final_text:
|
|
307
|
+
return event
|
|
308
|
+
replacement = await self.moderate_text(final_text, role="assistant")
|
|
309
|
+
return _replace_event_text(event, replacement or final_text)
|
|
310
|
+
|
|
311
|
+
async def after_run_callback(self, *, invocation_context) -> None:
|
|
312
|
+
agent_states = getattr(invocation_context, "agent_states", None)
|
|
313
|
+
if isinstance(agent_states, dict):
|
|
314
|
+
agent_states.pop(_INVOCATION_STATE_KEY, None)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def _invocation_state(invocation_context: Any) -> dict[str, Any]:
|
|
318
|
+
"""Return state owned by this plugin for one ADK invocation."""
|
|
319
|
+
|
|
320
|
+
agent_states = getattr(invocation_context, "agent_states", None)
|
|
321
|
+
if not isinstance(agent_states, dict):
|
|
322
|
+
agent_states = {}
|
|
323
|
+
setattr(invocation_context, "agent_states", agent_states)
|
|
324
|
+
state = agent_states.get(_INVOCATION_STATE_KEY)
|
|
325
|
+
if not isinstance(state, dict):
|
|
326
|
+
state = {}
|
|
327
|
+
agent_states[_INVOCATION_STATE_KEY] = state
|
|
328
|
+
return state
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def _content_text(content: Any) -> str:
|
|
332
|
+
if content is None:
|
|
333
|
+
return ""
|
|
334
|
+
parts = getattr(content, "parts", None) or []
|
|
335
|
+
texts = [str(part.text) for part in parts if getattr(part, "text", None)]
|
|
336
|
+
return "\n".join(texts)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def _model_content(text: str) -> types.Content:
|
|
340
|
+
return types.Content(role="model", parts=[types.Part(text=text)])
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
def _tool_payload_text(value: Any) -> str | None:
|
|
344
|
+
try:
|
|
345
|
+
return json.dumps(
|
|
346
|
+
value,
|
|
347
|
+
ensure_ascii=False,
|
|
348
|
+
separators=(",", ":"),
|
|
349
|
+
default=str,
|
|
350
|
+
)
|
|
351
|
+
except (TypeError, ValueError, RecursionError):
|
|
352
|
+
logger.warning("LLM Shield could not serialize a tool payload")
|
|
353
|
+
return None
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
def _merge_stream_text(buffered: str, text: str) -> str:
|
|
357
|
+
if not buffered:
|
|
358
|
+
return text
|
|
359
|
+
if text.startswith(buffered):
|
|
360
|
+
return text
|
|
361
|
+
if buffered.endswith(text):
|
|
362
|
+
return buffered
|
|
363
|
+
return buffered + text
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
def _final_stream_text(buffered: str, final_text: str) -> str:
|
|
367
|
+
if not final_text:
|
|
368
|
+
return buffered
|
|
369
|
+
if final_text.startswith(buffered) or buffered.endswith(final_text):
|
|
370
|
+
return final_text if len(final_text) >= len(buffered) else buffered
|
|
371
|
+
return final_text
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def _replace_event_text(event: Event, text: str) -> Event:
|
|
375
|
+
updated = event.model_copy(deep=True)
|
|
376
|
+
content = getattr(updated, "content", None)
|
|
377
|
+
if content is None:
|
|
378
|
+
updated.content = _model_content(text)
|
|
379
|
+
return updated
|
|
380
|
+
|
|
381
|
+
replaced = False
|
|
382
|
+
parts = []
|
|
383
|
+
for part in content.parts or []:
|
|
384
|
+
if getattr(part, "text", None) is not None:
|
|
385
|
+
parts.append(part.model_copy(update={"text": text if not replaced else ""}))
|
|
386
|
+
replaced = True
|
|
387
|
+
else:
|
|
388
|
+
parts.append(part)
|
|
389
|
+
if not replaced:
|
|
390
|
+
parts.insert(0, types.Part(text=text))
|
|
391
|
+
updated.content = content.model_copy(update={"parts": parts})
|
|
392
|
+
return updated
|