agent-builder-sdk-aws-transform 1.0.2__tar.gz → 1.1.0__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.
- {agent_builder_sdk_aws_transform-1.0.2/src/agent_builder_sdk_aws_transform.egg-info → agent_builder_sdk_aws_transform-1.1.0}/PKG-INFO +43 -3
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/README.md +37 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/pyproject.toml +9 -3
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/_auth_token_refresher.py +40 -12
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agent_factory.py +88 -8
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agentic_framework/a2a_manager.py +71 -2
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agentic_framework/agent_lifecycle.py +72 -2
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agentic_framework/artifact_store.py +16 -6
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/agentic_framework/client_factory.py +183 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agentic_framework/common.py +38 -6
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agentic_framework/job_manager.py +21 -1
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/base_subagent/base_subagent.py +138 -5
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/botocore_models/transformagenticservice/2018-05-10/service-2.json +4 -2
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/botocore_models/transformagentsstreamingservice/2018-05-10/service-2.json +304 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/checkpoint/checkpoint_manager.py +30 -3
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/checkpoint/checkpoint_repository.py +154 -37
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/checkpoint/checkpoint_service.py +12 -4
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/constants.py +63 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/custom_types/server_types.py +1 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/entrypoints/simple_cli_agent_core.py +40 -2
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/entrypoints/simple_subagent_cli.py +47 -5
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/env_var.py +74 -16
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/errors.py +12 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/fastapi_server.py +6 -4
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/interfaces.py +36 -2
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/locale_utils.py +36 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/memory/file_memory_repository.py +38 -28
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/messages/message_handler.py +19 -6
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/metrics/metrics_helper.py +77 -37
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/orchestrator_strands/base_orchestrator.py +802 -0
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/orchestrator_strands/conversation/constants.py +36 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/conversation/file_repository.py +117 -82
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/evaluation/evaluate_agent_trajectory.py +0 -8
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/orchestrator_strands/hooks/blank_reply_hook_provider.py +188 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/hooks/conversation_hook_provider.py +16 -1
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/hooks/memory_hook_provider.py +8 -0
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/orchestrator_strands/tools/send_message_tools.py +375 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/request_handler/queue_handler.py +2 -2
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/server/agent_runtime_server.py +1082 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/server/base_server.py +228 -7
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/server/server_models.py +7 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/server/stateless_agent_runtime_server.py +15 -5
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/server/streaming_agent_pool.py +191 -0
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/streaming/__init__.py +49 -0
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/streaming/a2a_agui_adapter.py +603 -0
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/streaming/a2a_frame_utils.py +175 -0
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/streaming/config.py +43 -0
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/streaming/raw_a2a_emitter.py +247 -0
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/streaming/response_persist_hook.py +538 -0
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/streaming/sse_reader.py +205 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/subagent_cli.py +1 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/subagent_server.py +2 -1
- agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk/util/suggestions_manager.py +102 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/utils.py +213 -17
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0/src/agent_builder_sdk_aws_transform.egg-info}/PKG-INFO +43 -3
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk_aws_transform.egg-info/SOURCES.txt +13 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk_aws_transform.egg-info/requires.txt +5 -2
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_agent_factory.py +283 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_agent_runtime_server.py +751 -3
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_auth_token_refresher.py +91 -11
- agent_builder_sdk_aws_transform-1.1.0/tests/test_base_server.py +530 -0
- agent_builder_sdk_aws_transform-1.1.0/tests/test_constants.py +38 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_env_var.py +121 -0
- agent_builder_sdk_aws_transform-1.1.0/tests/test_locale_utils.py +64 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_message_handler.py +22 -4
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_utils.py +458 -0
- agent_builder_sdk_aws_transform-1.0.2/src/agent_builder_sdk/agentic_framework/client_factory.py +0 -125
- agent_builder_sdk_aws_transform-1.0.2/src/agent_builder_sdk/constants.py +0 -15
- agent_builder_sdk_aws_transform-1.0.2/src/agent_builder_sdk/orchestrator_strands/base_orchestrator.py +0 -465
- agent_builder_sdk_aws_transform-1.0.2/src/agent_builder_sdk/orchestrator_strands/conversation/constants.py +0 -18
- agent_builder_sdk_aws_transform-1.0.2/src/agent_builder_sdk/orchestrator_strands/tools/send_message_tools.py +0 -119
- agent_builder_sdk_aws_transform-1.0.2/src/agent_builder_sdk/server/agent_runtime_server.py +0 -627
- agent_builder_sdk_aws_transform-1.0.2/src/agent_builder_sdk/util/suggestions_manager.py +0 -59
- agent_builder_sdk_aws_transform-1.0.2/tests/test_base_server.py +0 -248
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/LICENSE.txt +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/NOTICE +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/THIRD-PARTY-NOTICES.txt +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/setup.cfg +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/_boto_client.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agent.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agent_state/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agent_state/agent_state.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agentic_framework/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agentic_framework/agent_registry.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agentic_framework/agentic_api_helper.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agentic_framework/api_model.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/agentic_framework/hitl.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/base_subagent/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/bedrock_model_factory.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/botocore_models/atxagentregistryexternal/2022-07-26/service-2.json +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/checkpoint/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/checkpoint/checkpoint_triggers.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/cli.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/custom_types/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/custom_types/agent_registry_types.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/custom_types/common_types.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/custom_types/extension_types.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/custom_types/notification_types.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/custom_types/orchestrator_agent_types.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/custom_types/response_types.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/custom_types/task_types.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/entrypoints/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/entrypoints/_simple_stateless_cli_agent_core.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/experimental/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/experimental/code_execution/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/experimental/code_execution/code_execution_tool.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/extensions/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/extensions/acknowledgments/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/extensions/acknowledgments/acknowledgment_handler.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/extensions/base_extension_handler.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/logging_config.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/mcp_client_factory.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/memory/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/memory/episodic_memory.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/memory/memory_manager.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/memory/memory_repository.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/memory/memory_types.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/message_queue/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/message_queue/interface.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/message_queue/local_queue.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/message_queue/service.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/messages/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/messages/a2a_message_helper.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/metrics/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/metrics/metrics_config.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/notification/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/notification/base_job_deletion_processor.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/notification/hitl_notifier.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/notification/notification_handler.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/notification/notification_processor.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/notification/notifier.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/notification/processors.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/observability/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/observability/trace_helper.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/_base_agent_server.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/conversation/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/conversation/message_type.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/conversation/repository.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/evaluation/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/evaluation/evaluation_card.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/evaluation/metrics_helper.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/hooks/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/tools/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/tools/approval.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/tools/example_tools.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/tools/memory_tool.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/orchestrator_strands/tools/subagent_registry_tools.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/prompts/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/prompts/base_guardrails.md +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/prompts/system_prompt.md +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/prompts/test_orchestrator_prompt.md +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/prompts/test_subagent_prompt.md +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/py.typed +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/request_handler/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/request_handler/context.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/request_handler/interface.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/server/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/server/request_context.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/session.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/skills/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/skills/skills_prompt.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/skills/skills_tool.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/task/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/task/example_task_manager.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/task/file_task_store.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/task/in_memory_task_store.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/task/task_manager.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/task/task_store.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/task_handler.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/tool.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/tool_use_prompts.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/ui_chat/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/ui_chat/deeplinks.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/ui_chat/sources.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/util/__init__.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk/util/decorators.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk_aws_transform.egg-info/dependency_links.txt +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk_aws_transform.egg-info/entry_points.txt +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/src/agent_builder_sdk_aws_transform.egg-info/top_level.txt +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test__boto_client.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_agent.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_agent_builder_sdk.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_base_subagent.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_bedrock_model_factory.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_cli.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_fastapi_get_task.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_fastapi_server.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_mcp_client_factory.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_notification_handler.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_orchestrator_agent_types.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_session.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_stateless_agent_runtime_server.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_subagent_cli.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_subagent_server.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_task_handler.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_tool.py +0 -0
- {agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/tests/test_tool_use_prompts.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-builder-sdk-aws-transform
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: Base agent SDK for building orchestrator and subagents on AWS Transform
|
|
5
5
|
Author: AWS Transform Team
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -14,12 +14,12 @@ Description-Content-Type: text/markdown
|
|
|
14
14
|
License-File: LICENSE.txt
|
|
15
15
|
License-File: NOTICE
|
|
16
16
|
License-File: THIRD-PARTY-NOTICES.txt
|
|
17
|
-
Requires-Dist: agent-builder-types-aws-transform>=1.
|
|
17
|
+
Requires-Dist: agent-builder-types-aws-transform>=1.1
|
|
18
18
|
Requires-Dist: agent-builder-mcp-client-aws-transform>=1.0
|
|
19
19
|
Requires-Dist: boto3>=1.28
|
|
20
20
|
Requires-Dist: botocore>=1.28
|
|
21
21
|
Requires-Dist: fastapi>=0.100
|
|
22
|
-
Requires-Dist: mcp
|
|
22
|
+
Requires-Dist: mcp<2.0,>=1.0
|
|
23
23
|
Requires-Dist: strands-agents>=1.30.0
|
|
24
24
|
Requires-Dist: strands-agents-tools>=0.2
|
|
25
25
|
Requires-Dist: uvicorn>=0.20
|
|
@@ -27,6 +27,9 @@ Requires-Dist: structlog
|
|
|
27
27
|
Requires-Dist: starlette_context
|
|
28
28
|
Requires-Dist: defusedxml
|
|
29
29
|
Requires-Dist: aws-embedded-metrics>=3.0
|
|
30
|
+
Requires-Dist: tenacity>=9.0
|
|
31
|
+
Requires-Dist: a2a-sdk<0.4,>=0.3.7
|
|
32
|
+
Requires-Dist: ag-ui-protocol<0.2,>=0.1.19
|
|
30
33
|
Provides-Extra: full
|
|
31
34
|
Requires-Dist: agent-builder-agentic-mcp-aws-transform>=1.0; extra == "full"
|
|
32
35
|
Requires-Dist: agent-builder-mcp-aws-transform>=1.0; extra == "full"
|
|
@@ -184,6 +187,43 @@ if __name__ == "__main__":
|
|
|
184
187
|
main()
|
|
185
188
|
```
|
|
186
189
|
|
|
190
|
+
## Streaming (opt-in)
|
|
191
|
+
|
|
192
|
+
By default an orchestrator serves one turn at a time through a buffered queue, and `message/stream` is rejected. Pass a `StreamingConfig` to stream turns live over SSE (reasoning, tool calls and text) and to serve many users of the same job concurrently:
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
from agent_builder_sdk.streaming.config import StreamingConfig
|
|
196
|
+
|
|
197
|
+
server = AgentRuntimeServer(
|
|
198
|
+
agent_factory=agent_factory,
|
|
199
|
+
host="0.0.0.0",
|
|
200
|
+
port=8080,
|
|
201
|
+
binary_location="agent-builder-agentic-mcp",
|
|
202
|
+
storage_dir="/tmp/my_agent",
|
|
203
|
+
# Omit or pass None to keep streaming off (the default).
|
|
204
|
+
streaming_config=StreamingConfig(
|
|
205
|
+
agent_idle_ttl_seconds=30 * 60, # optional; evict idle per-user agents
|
|
206
|
+
emit_reasoning=True, # optional; stream and persist reasoning (default True)
|
|
207
|
+
emit_tool_calls=True, # optional; stream and persist tool calls (default True)
|
|
208
|
+
),
|
|
209
|
+
)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
The `simple_cli_agent_core.py` entry point exposes the same option as `--concurrent-streaming` (plus `--emit-reasoning/--no-emit-reasoning` and `--emit-tool-calls/--no-emit-tool-calls`). AWS Transform only streams to agents whose agent card declares `capabilities.streaming: true`.
|
|
213
|
+
|
|
214
|
+
**How it works**: Strands runs one invocation at a time per `Agent`, so the server keeps a `StreamingAgentPool` with one agent per source (a user, or another agent that streams to yours). Agents are built on first use and evicted after `agent_idle_ttl_seconds`. Your factory runs once per source, so each pooled agent builds its own model client. The MCP client, the conversation repository and the `MemoryManager` stay shared, so a user's buffered and streamed turns see the same job history. A synchronous factory runs on a dedicated worker thread, one build at a time, so building a new user's agent does not stall live streams; it has no running event loop there. Each streamed final response is persisted back to the chat.
|
|
215
|
+
|
|
216
|
+
**Concurrency contract**: with streaming on, several users' turns run concurrently on one event loop. Tools and hooks must not keep per-request state in module-level or class-level mutable globals; use a `contextvars.ContextVar` or the per-request `ToolContext` / `invocation_state` instead.
|
|
217
|
+
|
|
218
|
+
**Factory requirement**: your agent factory must accept and forward `conversation_repository` and `memory_manager` (for example `def agent_factory(mcp_client, storage_dir, **kwargs)` passing both to `create_default_orchestrator`). The server checks this at startup.
|
|
219
|
+
|
|
220
|
+
**Subagents**: an agent that inherits `StreamingCapable` can stream too (`simple_subagent_cli.py --concurrent-streaming` builds one). Two opt-in tools, added through `custom_tools`, use a subagent's stream:
|
|
221
|
+
|
|
222
|
+
- `send_message_to_subagent_and_relay` streams the subagent's answer live to the user as the orchestrator's final answer, and ends the turn.
|
|
223
|
+
- `stream_message_to_subagent` returns the subagent's answer (its last model cycle) to the orchestrator without streaming it to the user, like `send_message_to_subagent`.
|
|
224
|
+
|
|
225
|
+
**History repair**: when a turn is interrupted (timeout, client disconnect, crash), the next history load gives the unanswered message a placeholder reply, so the next turn answers its own prompt. A turn ended by a terminating tool (`stop_event_loop`) stores its `force_stop_response` as the reply.
|
|
226
|
+
|
|
187
227
|
## Requirements
|
|
188
228
|
|
|
189
229
|
- Python 3.11+
|
|
@@ -147,6 +147,43 @@ if __name__ == "__main__":
|
|
|
147
147
|
main()
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
+
## Streaming (opt-in)
|
|
151
|
+
|
|
152
|
+
By default an orchestrator serves one turn at a time through a buffered queue, and `message/stream` is rejected. Pass a `StreamingConfig` to stream turns live over SSE (reasoning, tool calls and text) and to serve many users of the same job concurrently:
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
from agent_builder_sdk.streaming.config import StreamingConfig
|
|
156
|
+
|
|
157
|
+
server = AgentRuntimeServer(
|
|
158
|
+
agent_factory=agent_factory,
|
|
159
|
+
host="0.0.0.0",
|
|
160
|
+
port=8080,
|
|
161
|
+
binary_location="agent-builder-agentic-mcp",
|
|
162
|
+
storage_dir="/tmp/my_agent",
|
|
163
|
+
# Omit or pass None to keep streaming off (the default).
|
|
164
|
+
streaming_config=StreamingConfig(
|
|
165
|
+
agent_idle_ttl_seconds=30 * 60, # optional; evict idle per-user agents
|
|
166
|
+
emit_reasoning=True, # optional; stream and persist reasoning (default True)
|
|
167
|
+
emit_tool_calls=True, # optional; stream and persist tool calls (default True)
|
|
168
|
+
),
|
|
169
|
+
)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The `simple_cli_agent_core.py` entry point exposes the same option as `--concurrent-streaming` (plus `--emit-reasoning/--no-emit-reasoning` and `--emit-tool-calls/--no-emit-tool-calls`). AWS Transform only streams to agents whose agent card declares `capabilities.streaming: true`.
|
|
173
|
+
|
|
174
|
+
**How it works**: Strands runs one invocation at a time per `Agent`, so the server keeps a `StreamingAgentPool` with one agent per source (a user, or another agent that streams to yours). Agents are built on first use and evicted after `agent_idle_ttl_seconds`. Your factory runs once per source, so each pooled agent builds its own model client. The MCP client, the conversation repository and the `MemoryManager` stay shared, so a user's buffered and streamed turns see the same job history. A synchronous factory runs on a dedicated worker thread, one build at a time, so building a new user's agent does not stall live streams; it has no running event loop there. Each streamed final response is persisted back to the chat.
|
|
175
|
+
|
|
176
|
+
**Concurrency contract**: with streaming on, several users' turns run concurrently on one event loop. Tools and hooks must not keep per-request state in module-level or class-level mutable globals; use a `contextvars.ContextVar` or the per-request `ToolContext` / `invocation_state` instead.
|
|
177
|
+
|
|
178
|
+
**Factory requirement**: your agent factory must accept and forward `conversation_repository` and `memory_manager` (for example `def agent_factory(mcp_client, storage_dir, **kwargs)` passing both to `create_default_orchestrator`). The server checks this at startup.
|
|
179
|
+
|
|
180
|
+
**Subagents**: an agent that inherits `StreamingCapable` can stream too (`simple_subagent_cli.py --concurrent-streaming` builds one). Two opt-in tools, added through `custom_tools`, use a subagent's stream:
|
|
181
|
+
|
|
182
|
+
- `send_message_to_subagent_and_relay` streams the subagent's answer live to the user as the orchestrator's final answer, and ends the turn.
|
|
183
|
+
- `stream_message_to_subagent` returns the subagent's answer (its last model cycle) to the orchestrator without streaming it to the user, like `send_message_to_subagent`.
|
|
184
|
+
|
|
185
|
+
**History repair**: when a turn is interrupted (timeout, client disconnect, crash), the next history load gives the unanswered message a placeholder reply, so the next turn answers its own prompt. A turn ended by a terminating tool (`stop_event_loop`) stores its `force_stop_response` as the reply.
|
|
186
|
+
|
|
150
187
|
## Requirements
|
|
151
188
|
|
|
152
189
|
- Python 3.11+
|
{agent_builder_sdk_aws_transform-1.0.2 → agent_builder_sdk_aws_transform-1.1.0}/pyproject.toml
RENAMED
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "agent-builder-sdk-aws-transform"
|
|
7
|
-
version = "1.0
|
|
7
|
+
version = "1.1.0"
|
|
8
8
|
description = "Base agent SDK for building orchestrator and subagents on AWS Transform"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11,<3.14"
|
|
@@ -19,12 +19,14 @@ classifiers = [
|
|
|
19
19
|
"Operating System :: OS Independent",
|
|
20
20
|
]
|
|
21
21
|
dependencies = [
|
|
22
|
-
"agent-builder-types-aws-transform>=1.
|
|
22
|
+
"agent-builder-types-aws-transform>=1.1",
|
|
23
23
|
"agent-builder-mcp-client-aws-transform>=1.0",
|
|
24
24
|
"boto3>=1.28",
|
|
25
25
|
"botocore>=1.28",
|
|
26
26
|
"fastapi>=0.100",
|
|
27
|
-
|
|
27
|
+
# Pin to the mcp 1.x major the toolkit is tested against; mcp 2.0.0 is a
|
|
28
|
+
# breaking release (see issue #77). Widen once verified against 2.x.
|
|
29
|
+
"mcp>=1.0,<2.0",
|
|
28
30
|
"strands-agents>=1.30.0",
|
|
29
31
|
"strands-agents-tools>=0.2",
|
|
30
32
|
"uvicorn>=0.20",
|
|
@@ -32,6 +34,10 @@ dependencies = [
|
|
|
32
34
|
"starlette_context",
|
|
33
35
|
"defusedxml",
|
|
34
36
|
"aws-embedded-metrics>=3.0",
|
|
37
|
+
"tenacity>=9.0",
|
|
38
|
+
# Streaming: A2A task states and AG-UI events. Both are pre-1.0, so stay on the tested minor.
|
|
39
|
+
"a2a-sdk>=0.3.7,<0.4",
|
|
40
|
+
"ag-ui-protocol>=0.1.19,<0.2",
|
|
35
41
|
]
|
|
36
42
|
|
|
37
43
|
[project.optional-dependencies]
|
|
@@ -4,6 +4,7 @@ import datetime
|
|
|
4
4
|
import functools
|
|
5
5
|
import logging
|
|
6
6
|
import os
|
|
7
|
+
import signal
|
|
7
8
|
import time
|
|
8
9
|
from multiprocessing import Process
|
|
9
10
|
from typing import TYPE_CHECKING, Any, Dict, Optional
|
|
@@ -11,7 +12,7 @@ from typing import TYPE_CHECKING, Any, Dict, Optional
|
|
|
11
12
|
from botocore.client import BaseClient
|
|
12
13
|
|
|
13
14
|
from agent_builder_sdk.agentic_framework.api_model import AgenticApiRequestContext
|
|
14
|
-
from agent_builder_sdk.agentic_framework.client_factory import
|
|
15
|
+
from agent_builder_sdk.agentic_framework.client_factory import create_agentic_api_client
|
|
15
16
|
from agent_builder_sdk.env_var import (
|
|
16
17
|
ATX_AUTH_TOKEN_KEY,
|
|
17
18
|
ENV_KEY_AUTH_TOKEN_FILE,
|
|
@@ -33,6 +34,7 @@ DEFAULT_SESSION_DURATION = 43200 # 12 hours
|
|
|
33
34
|
|
|
34
35
|
# Token refresh timing constants (in seconds)
|
|
35
36
|
TOKEN_REFRESH_BUFFER_SECONDS = 40 # Buffer before token expiration to refresh
|
|
37
|
+
SAFETY_FACTOR = 0.5 # Refresh at 50% of token lifetime for hours of retry headroom
|
|
36
38
|
MIN_SLEEP_SECONDS = 60 # Minimum sleep time between refresh attempts
|
|
37
39
|
ERROR_RETRY_SECONDS = 60 # Retry interval when refresh fails
|
|
38
40
|
|
|
@@ -126,19 +128,36 @@ class AuthTokenRefresher:
|
|
|
126
128
|
Main function for the token refresh process.
|
|
127
129
|
Continuously refreshes the token and sleeps until next refresh.
|
|
128
130
|
"""
|
|
131
|
+
# Forked from the runtime process, this child inherits the parent's SIGTERM
|
|
132
|
+
# handler (the server's graceful-shutdown handler), which never terminates this
|
|
133
|
+
# stateless refresher. Restore the default disposition so Process.terminate()
|
|
134
|
+
# ends it immediately, instead of the parent waiting out the join timeout before
|
|
135
|
+
# falling back to SIGKILL — that wait added ~5s to every agent stop.
|
|
136
|
+
signal.signal(signal.SIGTERM, signal.SIG_DFL)
|
|
137
|
+
|
|
138
|
+
# Configure logging in the child process so logs are captured by
|
|
139
|
+
# the container log driver (CloudWatch).
|
|
140
|
+
logging.basicConfig(
|
|
141
|
+
level=logging.INFO,
|
|
142
|
+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
143
|
+
force=True,
|
|
144
|
+
)
|
|
145
|
+
|
|
129
146
|
logger.info("Starting token refresh process")
|
|
130
147
|
|
|
131
|
-
|
|
132
|
-
|
|
148
|
+
while True:
|
|
149
|
+
try:
|
|
133
150
|
time_to_sleep = self._refresh_token()
|
|
134
151
|
logger.info(f"Sleeping for {time_to_sleep} seconds before next token refresh")
|
|
135
152
|
time.sleep(time_to_sleep)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
153
|
+
except KeyboardInterrupt:
|
|
154
|
+
logger.info("Token refresh process interrupted, shutting down gracefully")
|
|
155
|
+
break
|
|
156
|
+
except Exception:
|
|
157
|
+
logger.warning("Token refresh process error, retrying: ", exc_info=True)
|
|
158
|
+
time.sleep(ERROR_RETRY_SECONDS)
|
|
159
|
+
|
|
160
|
+
logger.info("Token refresh process stopped")
|
|
142
161
|
|
|
143
162
|
def _refresh_token(self) -> int:
|
|
144
163
|
"""
|
|
@@ -165,7 +184,11 @@ class AuthTokenRefresher:
|
|
|
165
184
|
now = datetime.datetime.now(datetime.timezone.utc)
|
|
166
185
|
|
|
167
186
|
# Calculate time difference in seconds, with a buffer to refresh before token expires
|
|
168
|
-
|
|
187
|
+
remaining = (expiration_timestamp - now).total_seconds()
|
|
188
|
+
time_diff = min(
|
|
189
|
+
remaining * SAFETY_FACTOR,
|
|
190
|
+
remaining - self.token_refresh_buffer,
|
|
191
|
+
)
|
|
169
192
|
|
|
170
193
|
# Ensure we don't sleep for a negative amount of time
|
|
171
194
|
# and that we have at least minimum sleep time between refreshes
|
|
@@ -204,10 +227,15 @@ class AuthTokenRefresher:
|
|
|
204
227
|
"""
|
|
205
228
|
logger.info("Calling Agentic API to refresh token")
|
|
206
229
|
|
|
207
|
-
#
|
|
230
|
+
# Build a fresh, uncached client inside the child process. boto3 clients
|
|
231
|
+
# are not fork-safe (shared urllib3 connection pools / OpenSSL state can
|
|
232
|
+
# corrupt requests between parent and child), and the parent populates
|
|
233
|
+
# the module-level lru_cache before the fork — so calling the cached
|
|
234
|
+
# factory here would hand back the parent's client. See
|
|
235
|
+
# https://docs.aws.amazon.com/boto3/latest/guide/clients.html#caveats
|
|
208
236
|
if self.agentic_api_client is None:
|
|
209
237
|
logger.info("Creating agentic API client in child process")
|
|
210
|
-
self.agentic_api_client =
|
|
238
|
+
self.agentic_api_client = create_agentic_api_client()
|
|
211
239
|
|
|
212
240
|
if not all([self.workspace_id, self.job_id, self.agent_instance_id]):
|
|
213
241
|
context = get_agent_context_from_env()
|
|
@@ -8,6 +8,8 @@ import logging
|
|
|
8
8
|
import os
|
|
9
9
|
from typing import Any, Optional, Set, TypeVar, Union
|
|
10
10
|
|
|
11
|
+
from botocore.config import Config as BotocoreConfig
|
|
12
|
+
from strands.hooks import HookProvider
|
|
11
13
|
from strands.models.model import Model
|
|
12
14
|
from strands.tools.mcp.mcp_client import MCPClient
|
|
13
15
|
|
|
@@ -23,6 +25,9 @@ from agent_builder_sdk.orchestrator_strands.base_orchestrator import (
|
|
|
23
25
|
from agent_builder_sdk.orchestrator_strands.conversation.file_repository import (
|
|
24
26
|
FileMultiSourceConversationRepository,
|
|
25
27
|
)
|
|
28
|
+
from agent_builder_sdk.orchestrator_strands.hooks.blank_reply_hook_provider import (
|
|
29
|
+
BlankReplyHookProvider,
|
|
30
|
+
)
|
|
26
31
|
from agent_builder_sdk.orchestrator_strands.hooks.conversation_hook_provider import (
|
|
27
32
|
ConversationHookProvider,
|
|
28
33
|
)
|
|
@@ -52,6 +57,7 @@ def _create_default_orchestrator(
|
|
|
52
57
|
additional_custom_tools: Optional[list[Any]] = None,
|
|
53
58
|
model_id: str = "anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
54
59
|
model: Union[Model, str, None] = None,
|
|
60
|
+
boto_client_config: Optional[BotocoreConfig] = None,
|
|
55
61
|
with_base_guardrails: bool = False,
|
|
56
62
|
trace_attributes: Optional[dict[str, Any]] = None,
|
|
57
63
|
excluded_mcp_tool_names: Optional[Set[str]] = None,
|
|
@@ -59,16 +65,27 @@ def _create_default_orchestrator(
|
|
|
59
65
|
enable_skills: bool = False,
|
|
60
66
|
skills_dir: Optional[str] = None,
|
|
61
67
|
enable_code_execution: bool = False,
|
|
68
|
+
enable_blank_reply_continuation: bool = False,
|
|
69
|
+
enable_prompt_caching: bool = False,
|
|
70
|
+
locale: Optional[str] = None,
|
|
71
|
+
conversation_repository: Optional[FileMultiSourceConversationRepository] = None,
|
|
72
|
+
memory_manager: Optional[MemoryManager] = None,
|
|
62
73
|
) -> OrchestratorT:
|
|
63
74
|
logger.info("Creating default orchestrator with full feature set")
|
|
64
75
|
|
|
65
76
|
custom_tools: list[Any] = []
|
|
66
77
|
|
|
67
|
-
# Create memory components
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
# Create memory components. A shared MemoryManager may be injected (e.g. for concurrent
|
|
79
|
+
# streaming, so the shared singleton agent and per-user streaming agents use the SAME memory
|
|
80
|
+
# store for a job — otherwise each agent derives its own <storage_dir>/memories and the same
|
|
81
|
+
# job's message/send vs message/stream turns read/write disjoint stores). Memory is
|
|
82
|
+
# job-scoped (the same behavior as the existing shared singleton agent). When not injected,
|
|
83
|
+
# build a per-agent one as before (backward compatible).
|
|
84
|
+
if memory_manager is None:
|
|
85
|
+
memory_storage_path = os.path.join(storage_dir, "memories")
|
|
86
|
+
repository = FileSystemRepository(storage_path=memory_storage_path)
|
|
87
|
+
episodic_memory = EpisodicMemory(repository=repository)
|
|
88
|
+
memory_manager = MemoryManager(memories=[episodic_memory])
|
|
72
89
|
|
|
73
90
|
# Create memory tool
|
|
74
91
|
memory_tool = MemoryTool(memory_manager)
|
|
@@ -103,14 +120,20 @@ def _create_default_orchestrator(
|
|
|
103
120
|
if additional_custom_tools:
|
|
104
121
|
custom_tools.extend(additional_custom_tools)
|
|
105
122
|
|
|
106
|
-
# Create conversation repository
|
|
107
|
-
|
|
123
|
+
# Create conversation repository. A shared instance may be injected (e.g. for
|
|
124
|
+
# concurrent streaming, where per-user agents must all read/write the SAME history
|
|
125
|
+
# store — separate instances on one storage_dir would overwrite each other's saves).
|
|
126
|
+
# When not injected, build a per-agent one as before (backward compatible).
|
|
127
|
+
if conversation_repository is None:
|
|
128
|
+
conversation_repository = FileMultiSourceConversationRepository(storage_dir=storage_dir)
|
|
108
129
|
|
|
109
130
|
# Create hooks
|
|
110
|
-
hooks = [
|
|
131
|
+
hooks: list[HookProvider] = [
|
|
111
132
|
ConversationHookProvider(repository=conversation_repository),
|
|
112
133
|
MemoryHookProvider(memory_manager=memory_manager),
|
|
113
134
|
]
|
|
135
|
+
if enable_blank_reply_continuation:
|
|
136
|
+
hooks.append(BlankReplyHookProvider())
|
|
114
137
|
|
|
115
138
|
# Use provided system prompt or default
|
|
116
139
|
if system_prompt is None:
|
|
@@ -130,10 +153,13 @@ def _create_default_orchestrator(
|
|
|
130
153
|
custom_tools=custom_tools,
|
|
131
154
|
model_id=model_id,
|
|
132
155
|
model=model,
|
|
156
|
+
boto_client_config=boto_client_config,
|
|
133
157
|
trace_attributes=trace_attributes,
|
|
134
158
|
excluded_mcp_tool_names=excluded_mcp_tool_names,
|
|
135
159
|
metrics_config=metrics_config,
|
|
136
160
|
plugins=[skills_plugin] if skills_plugin else None,
|
|
161
|
+
locale=locale,
|
|
162
|
+
enable_prompt_caching=enable_prompt_caching,
|
|
137
163
|
)
|
|
138
164
|
|
|
139
165
|
logger.info("Default orchestrator created successfully with memory and conversation support")
|
|
@@ -150,6 +176,10 @@ def create_default_orchestrator(
|
|
|
150
176
|
with_base_guardrails: bool = False,
|
|
151
177
|
trace_attributes: Optional[dict[str, Any]] = None,
|
|
152
178
|
metrics_config: Optional[MetricsConfig] = None,
|
|
179
|
+
locale: Optional[str] = None,
|
|
180
|
+
conversation_repository: Optional[FileMultiSourceConversationRepository] = None,
|
|
181
|
+
memory_manager: Optional[MemoryManager] = None,
|
|
182
|
+
boto_client_config: Optional[BotocoreConfig] = None,
|
|
153
183
|
) -> BaseOrchestrator:
|
|
154
184
|
"""
|
|
155
185
|
Create a BaseOrchestrator instance with full memory and conversation support.
|
|
@@ -187,9 +217,13 @@ def create_default_orchestrator(
|
|
|
187
217
|
additional_custom_tools=custom_tools,
|
|
188
218
|
model_id=model_id,
|
|
189
219
|
model=model,
|
|
220
|
+
boto_client_config=boto_client_config,
|
|
190
221
|
with_base_guardrails=with_base_guardrails,
|
|
191
222
|
trace_attributes=trace_attributes,
|
|
192
223
|
metrics_config=metrics_config,
|
|
224
|
+
locale=locale,
|
|
225
|
+
conversation_repository=conversation_repository,
|
|
226
|
+
memory_manager=memory_manager,
|
|
193
227
|
)
|
|
194
228
|
|
|
195
229
|
|
|
@@ -202,6 +236,10 @@ def create_default_async_orchestrator(
|
|
|
202
236
|
model: Union[Model, str, None] = None,
|
|
203
237
|
with_base_guardrails: bool = False,
|
|
204
238
|
metrics_config: Optional[MetricsConfig] = None,
|
|
239
|
+
locale: Optional[str] = None,
|
|
240
|
+
conversation_repository: Optional[FileMultiSourceConversationRepository] = None,
|
|
241
|
+
memory_manager: Optional[MemoryManager] = None,
|
|
242
|
+
boto_client_config: Optional[BotocoreConfig] = None,
|
|
205
243
|
) -> AsyncBaseOrchestrator:
|
|
206
244
|
"""Create a AsyncBaseOrchestrator instance with full memory and conversation support.
|
|
207
245
|
|
|
@@ -235,8 +273,12 @@ def create_default_async_orchestrator(
|
|
|
235
273
|
additional_custom_tools=custom_tools,
|
|
236
274
|
model_id=model_id,
|
|
237
275
|
model=model,
|
|
276
|
+
boto_client_config=boto_client_config,
|
|
238
277
|
with_base_guardrails=with_base_guardrails,
|
|
239
278
|
metrics_config=metrics_config,
|
|
279
|
+
locale=locale,
|
|
280
|
+
conversation_repository=conversation_repository,
|
|
281
|
+
memory_manager=memory_manager,
|
|
240
282
|
)
|
|
241
283
|
|
|
242
284
|
|
|
@@ -249,6 +291,10 @@ def create_default_orchestrator_with_subagent(
|
|
|
249
291
|
model: Union[Model, str, None] = None,
|
|
250
292
|
with_base_guardrails: bool = False,
|
|
251
293
|
metrics_config: Optional[MetricsConfig] = None,
|
|
294
|
+
locale: Optional[str] = None,
|
|
295
|
+
conversation_repository: Optional[FileMultiSourceConversationRepository] = None,
|
|
296
|
+
memory_manager: Optional[MemoryManager] = None,
|
|
297
|
+
boto_client_config: Optional[BotocoreConfig] = None,
|
|
252
298
|
) -> BaseOrchestrator:
|
|
253
299
|
"""Create a BaseOrchestrator instance with full memory and conversation support and subagent tools.
|
|
254
300
|
|
|
@@ -287,8 +333,12 @@ def create_default_orchestrator_with_subagent(
|
|
|
287
333
|
additional_custom_tools=custom_tools,
|
|
288
334
|
model_id=model_id,
|
|
289
335
|
model=model,
|
|
336
|
+
boto_client_config=boto_client_config,
|
|
290
337
|
with_base_guardrails=with_base_guardrails,
|
|
291
338
|
metrics_config=metrics_config,
|
|
339
|
+
locale=locale,
|
|
340
|
+
conversation_repository=conversation_repository,
|
|
341
|
+
memory_manager=memory_manager,
|
|
292
342
|
)
|
|
293
343
|
|
|
294
344
|
|
|
@@ -306,6 +356,12 @@ def create_default_async_orchestrator_with_subagent(
|
|
|
306
356
|
enable_skills: bool = False,
|
|
307
357
|
skills_dir: Optional[str] = None,
|
|
308
358
|
enable_code_execution: bool = False,
|
|
359
|
+
locale: Optional[str] = None,
|
|
360
|
+
conversation_repository: Optional[FileMultiSourceConversationRepository] = None,
|
|
361
|
+
memory_manager: Optional[MemoryManager] = None,
|
|
362
|
+
enable_blank_reply_continuation: bool = False,
|
|
363
|
+
enable_prompt_caching: bool = False,
|
|
364
|
+
boto_client_config: Optional[BotocoreConfig] = None,
|
|
309
365
|
) -> AsyncBaseOrchestrator:
|
|
310
366
|
"""Create a AsyncBaseOrchestrator instance with full memory and conversation support and subagent tools.
|
|
311
367
|
|
|
@@ -337,6 +393,10 @@ def create_default_async_orchestrator_with_subagent(
|
|
|
337
393
|
enable_code_execution: Enable experimental local Python code execution tool.
|
|
338
394
|
WARNING: Code executes locally without sandboxing. Use with caution.
|
|
339
395
|
For sandboxed execution, AgentCore Code Interpreter integration is planned.
|
|
396
|
+
enable_blank_reply_continuation: Ask the model once more for its reply when a turn ends
|
|
397
|
+
empty right after tool results (see BlankReplyHookProvider).
|
|
398
|
+
enable_prompt_caching: Turn on Bedrock prompt caching for the orchestrator's model (see
|
|
399
|
+
AsyncBaseOrchestrator). Off by default.
|
|
340
400
|
|
|
341
401
|
Returns:
|
|
342
402
|
Configured AsyncBaseOrchestrator instance with memory, hooks, and tools
|
|
@@ -363,6 +423,7 @@ def create_default_async_orchestrator_with_subagent(
|
|
|
363
423
|
additional_custom_tools=custom_tools,
|
|
364
424
|
model_id=model_id,
|
|
365
425
|
model=model,
|
|
426
|
+
boto_client_config=boto_client_config,
|
|
366
427
|
with_base_guardrails=with_base_guardrails,
|
|
367
428
|
trace_attributes=trace_attributes,
|
|
368
429
|
excluded_mcp_tool_names=excluded_mcp_tool_names,
|
|
@@ -370,6 +431,11 @@ def create_default_async_orchestrator_with_subagent(
|
|
|
370
431
|
enable_skills=enable_skills,
|
|
371
432
|
skills_dir=skills_dir,
|
|
372
433
|
enable_code_execution=enable_code_execution,
|
|
434
|
+
enable_blank_reply_continuation=enable_blank_reply_continuation,
|
|
435
|
+
enable_prompt_caching=enable_prompt_caching,
|
|
436
|
+
locale=locale,
|
|
437
|
+
conversation_repository=conversation_repository,
|
|
438
|
+
memory_manager=memory_manager,
|
|
373
439
|
)
|
|
374
440
|
|
|
375
441
|
|
|
@@ -403,6 +469,7 @@ def create_default_subagent(
|
|
|
403
469
|
model: Union[Model, str, None] = None,
|
|
404
470
|
custom_tools: Optional[list[Any]] = None,
|
|
405
471
|
metrics_config: Optional[MetricsConfig] = None,
|
|
472
|
+
**kwargs: Any,
|
|
406
473
|
) -> BaseSubagent:
|
|
407
474
|
"""Create a BaseSubagent instance with minimal configuration.
|
|
408
475
|
|
|
@@ -417,6 +484,12 @@ def create_default_subagent(
|
|
|
417
484
|
model: Optional Strands Model instance or model ID string
|
|
418
485
|
custom_tools: Optional list of additional custom tools to add to the subagent
|
|
419
486
|
metrics_config: Optional MetricsConfig for CloudWatch metrics (default: disabled)
|
|
487
|
+
**kwargs: Compatibility shim — accepted and ignored. A runtime server calls every agent
|
|
488
|
+
factory with the *same* keyword arguments, and with streaming enabled that set includes
|
|
489
|
+
``conversation_repository`` / ``memory_manager`` (the shared stores an orchestrator
|
|
490
|
+
needs). A sub-agent is stateless and uses neither, but the factory must still accept
|
|
491
|
+
them or the server's call would raise ``TypeError``; ``**kwargs`` absorbs them so one
|
|
492
|
+
call signature works for both agent types.
|
|
420
493
|
|
|
421
494
|
Returns:
|
|
422
495
|
Configured BaseSubagent instance
|
|
@@ -438,6 +511,7 @@ def create_default_async_subagent(
|
|
|
438
511
|
model: Union[Model, str, None] = None,
|
|
439
512
|
custom_tools: Optional[list[Any]] = None,
|
|
440
513
|
metrics_config: Optional[MetricsConfig] = None,
|
|
514
|
+
**kwargs: Any,
|
|
441
515
|
) -> AsyncBaseSubagent:
|
|
442
516
|
"""Create an AsyncBaseSubagent instance with minimal configuration.
|
|
443
517
|
|
|
@@ -449,6 +523,12 @@ def create_default_async_subagent(
|
|
|
449
523
|
model: Optional Strands Model instance or model ID string
|
|
450
524
|
custom_tools: Optional list of additional custom tools to add to the subagent
|
|
451
525
|
metrics_config: Optional MetricsConfig for CloudWatch metrics (default: disabled)
|
|
526
|
+
**kwargs: Compatibility shim — accepted and ignored. A runtime server calls every agent
|
|
527
|
+
factory with the *same* keyword arguments, and with streaming enabled that set includes
|
|
528
|
+
``conversation_repository`` / ``memory_manager`` (the shared stores an orchestrator
|
|
529
|
+
needs). A sub-agent is stateless and uses neither, but the factory must still accept
|
|
530
|
+
them or the server's call would raise ``TypeError``; ``**kwargs`` absorbs them so one
|
|
531
|
+
call signature works for both agent types.
|
|
452
532
|
|
|
453
533
|
Returns:
|
|
454
534
|
Configured AsyncBaseSubagent instance
|
|
@@ -5,13 +5,17 @@ A2A Manager for SendMessage and GetTask operations.
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
import logging
|
|
8
|
+
import threading
|
|
8
9
|
from functools import lru_cache
|
|
9
|
-
from typing import Any, Dict
|
|
10
|
+
from typing import Any, Dict, Iterator
|
|
10
11
|
|
|
11
12
|
from botocore.exceptions import ClientError
|
|
12
13
|
|
|
13
14
|
from agent_builder_sdk.agentic_framework.agentic_api_helper import AgenticApiHelper
|
|
14
|
-
from agent_builder_sdk.agentic_framework.client_factory import
|
|
15
|
+
from agent_builder_sdk.agentic_framework.client_factory import (
|
|
16
|
+
get_agentic_api_client,
|
|
17
|
+
get_streaming_agentic_api_client,
|
|
18
|
+
)
|
|
15
19
|
from agent_builder_sdk.custom_types.common_types import A2AMessage
|
|
16
20
|
from agent_builder_sdk.custom_types.task_types import A2ATask
|
|
17
21
|
from agent_builder_sdk.env_var import get_agent_context_from_env
|
|
@@ -19,9 +23,21 @@ from agent_builder_sdk.env_var import get_agent_context_from_env
|
|
|
19
23
|
logger = logging.getLogger(__name__)
|
|
20
24
|
|
|
21
25
|
|
|
26
|
+
# stream_send_message runs in worker threads; this keeps concurrent first calls from each building
|
|
27
|
+
# the streaming client (lru_cache does not lock).
|
|
28
|
+
_streaming_client_lock = threading.Lock()
|
|
29
|
+
|
|
30
|
+
|
|
22
31
|
class A2AManager(AgenticApiHelper):
|
|
23
32
|
"""Manager for A2A protocol operations (SendMessage, GetTask)."""
|
|
24
33
|
|
|
34
|
+
def __init__(self, streaming_client: Any = None, **kwargs: Any) -> None:
|
|
35
|
+
"""``streaming_client`` is the separate ConverseStream (``transformagentsstreamingservice``)
|
|
36
|
+
client used only by ``stream_send_message``; the sync ``client`` (base class) serves every
|
|
37
|
+
other op. Built on first use when not provided."""
|
|
38
|
+
super().__init__(**kwargs)
|
|
39
|
+
self.streaming_client = streaming_client
|
|
40
|
+
|
|
25
41
|
def send_message(
|
|
26
42
|
self,
|
|
27
43
|
agent_instance_id: str,
|
|
@@ -60,6 +76,59 @@ class A2AManager(AgenticApiHelper):
|
|
|
60
76
|
logger.exception(f"Failed to send A2A message to agent {agent_instance_id}: {e}")
|
|
61
77
|
raise
|
|
62
78
|
|
|
79
|
+
def stream_send_message(
|
|
80
|
+
self,
|
|
81
|
+
agent_instance_id: str,
|
|
82
|
+
message: A2AMessage,
|
|
83
|
+
) -> Iterator[Dict[str, Any]]:
|
|
84
|
+
"""Send a message via the A2A ConverseStream API and stream the reply as A2A frames.
|
|
85
|
+
|
|
86
|
+
The streaming counterpart of ``send_message``: instead of one buffered reply, the callee's
|
|
87
|
+
response comes back as a live SSE stream of A2A frames, which this returns as an iterator of
|
|
88
|
+
frame dicts (parsed by ``sse_reader``).
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
agent_instance_id: The agent instance ID to send the message to
|
|
92
|
+
message: The A2AMessage object to send
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
An iterator of A2A frame dicts. NOTE: the ``converse_stream`` call is issued eagerly, but
|
|
96
|
+
frames (and any mid-stream transport error, e.g. a dropped connection) surface while
|
|
97
|
+
iterating, not at call time.
|
|
98
|
+
|
|
99
|
+
Raises:
|
|
100
|
+
ClientError: If the initial ConverseStream call fails.
|
|
101
|
+
"""
|
|
102
|
+
from agent_builder_sdk.streaming import sse_reader
|
|
103
|
+
|
|
104
|
+
# ConverseStream lives in the separate `transformagentsstreamingservice`, not the sync
|
|
105
|
+
# client (`self.client`), which has no such operation.
|
|
106
|
+
# Built on first use so buffered-only callers never need the streaming service model.
|
|
107
|
+
if self.streaming_client is None:
|
|
108
|
+
with _streaming_client_lock:
|
|
109
|
+
if self.streaming_client is None:
|
|
110
|
+
self.streaming_client = get_streaming_agentic_api_client()
|
|
111
|
+
|
|
112
|
+
request_data = {
|
|
113
|
+
"agentInstanceId": agent_instance_id,
|
|
114
|
+
"params": {"message": message.to_dict()},
|
|
115
|
+
}
|
|
116
|
+
request_with_context = self._inject_request_context(request_data)
|
|
117
|
+
|
|
118
|
+
try:
|
|
119
|
+
logger.info(
|
|
120
|
+
f"Opening A2A stream to agent {agent_instance_id} with context_id={message.contextId}"
|
|
121
|
+
)
|
|
122
|
+
response = self.streaming_client.converse_stream(**request_with_context)
|
|
123
|
+
logger.info(f"A2A stream opened to agent {agent_instance_id}")
|
|
124
|
+
except ClientError as e:
|
|
125
|
+
logger.exception(f"Failed to open A2A stream to agent {agent_instance_id}: {e}")
|
|
126
|
+
raise
|
|
127
|
+
|
|
128
|
+
# The @httpPayload streaming blob surfaces as a StreamingBody under "stream" (see
|
|
129
|
+
# ConverseStreamResponse in the transformagentsstreamingservice model).
|
|
130
|
+
return sse_reader.iter_frames(response["stream"])
|
|
131
|
+
|
|
63
132
|
def send_task(
|
|
64
133
|
self,
|
|
65
134
|
agent_instance_id: str,
|