microsoft-agents-hosting-core 0.9.0.dev5__tar.gz → 0.9.0.dev7__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.
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/PKG-INFO +4 -2
- microsoft_agents_hosting_core-0.9.0.dev7/VERSION.txt +1 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/agent_application.py +95 -66
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py +54 -38
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py +9 -3
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/app/oauth/telemetry/__init__.py +0 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/app/oauth/telemetry/constants.py +7 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/app/oauth/telemetry/spans.py +113 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/app/telemetry/__init__.py +0 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/app/telemetry/constants.py +12 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/app/telemetry/metrics.py +23 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/app/telemetry/spans.py +109 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/authorization/agent_auth_configuration.py +14 -18
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/authorization/telemetry/__init__.py +0 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/authorization/telemetry/constants.py +18 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/authorization/telemetry/metrics.py +17 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/authorization/telemetry/spans.py +110 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/channel_service_adapter.py +71 -57
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/client/connector_client.py +229 -181
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/connector/client/user_token_client.py +370 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/connector/telemetry/__init__.py +0 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/connector/telemetry/_request_span_wrapper.py +33 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/connector/telemetry/connector_spans.py +159 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/connector/telemetry/constants.py +29 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/connector/telemetry/metrics.py +29 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/connector/telemetry/user_token_client_spans.py +141 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/http/_http_adapter_base.py +40 -36
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/rest_channel_service_client_factory.py +59 -43
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/storage/storage.py +21 -11
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/storage/telemetry/__init__.py +0 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/storage/telemetry/constants.py +9 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/storage/telemetry/metrics.py +16 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/storage/telemetry/spans.py +69 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/__init__.py +41 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/adapter/__init__.py +0 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/adapter/constants.py +17 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/adapter/metrics.py +31 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/adapter/spans.py +198 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/attributes.py +50 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/core/__init__.py +21 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/core/_agents_telemetry.py +106 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/core/base_span_wrapper.py +79 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/core/resource.py +18 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/core/simple_span_wrapper.py +44 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/core/type_defs.py +7 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/turn_context/__init__.py +0 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/turn_context/constants.py +4 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/turn_context/spans.py +27 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/telemetry/utils.py +28 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents_hosting_core.egg-info/PKG-INFO +4 -2
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents_hosting_core.egg-info/SOURCES.txt +37 -0
- microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents_hosting_core.egg-info/requires.txt +7 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/setup.py +2 -0
- microsoft_agents_hosting_core-0.9.0.dev5/VERSION.txt +0 -1
- microsoft_agents_hosting_core-0.9.0.dev5/microsoft_agents/hosting/core/connector/client/user_token_client.py +0 -325
- microsoft_agents_hosting_core-0.9.0.dev5/microsoft_agents_hosting_core.egg-info/requires.txt +0 -5
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/LICENSE +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/MANIFEST.in +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/_oauth/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/_oauth/_flow_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/_oauth/_flow_storage_client.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/_oauth/_oauth_flow.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/activity_handler.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/agent.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/_routes/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/_routes/_route.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/_routes/_route_list.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/_routes/route_rank.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/_type_defs.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/app_error.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/app_options.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/input_file.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/oauth/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/oauth/_handlers/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/oauth/_handlers/_authorization_handler.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/oauth/_handlers/connector_user_authorization.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/oauth/_sign_in_response.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/oauth/_sign_in_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/oauth/auth_handler.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/oauth/authorization.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/query.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/state/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/state/conversation_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/state/state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/state/temp_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/state/turn_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/streaming/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/streaming/citation.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/streaming/citation_util.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/streaming/streaming_response.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/app/typing_indicator.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/authorization/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/authorization/access_token_provider_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/authorization/anonymous_token_provider.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/authorization/auth_types.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/authorization/authentication_constants.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/authorization/claims_identity.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/authorization/connections.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/authorization/jwt_token_validator.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/card_factory.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/channel_adapter.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/channel_api_handler_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/channel_service_client_factory_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/agent_conversation_reference.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/channel_factory_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/channel_host_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/channel_info_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/channel_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/channels_configuration.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/configuration_channel_host.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/conversation_constants.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/conversation_id_factory.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/conversation_id_factory_options.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/conversation_id_factory_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/http_agent_channel.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/client/http_agent_channel_factory.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/agent_sign_in_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/attachments_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/client/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/connector_client_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/conversations_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/get_product_info.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/mcs/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/mcs/mcs_connector_client.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/teams/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/teams/teams_connector_client.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/user_token_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/connector/user_token_client_base.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/errors/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/errors/error_resources.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/http/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/http/_channel_service_routes.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/http/_http_request_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/http/_http_response.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/message_factory.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/middleware_set.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/state/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/state/agent_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/state/state_property_accessor.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/state/user_state.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/storage/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/storage/_type_aliases.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/storage/error_handling.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/storage/memory_storage.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/storage/store_item.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/storage/transcript_file_store.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/storage/transcript_info.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/storage/transcript_logger.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/storage/transcript_memory_store.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/storage/transcript_store.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents/hosting/core/turn_context.py +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents_hosting_core.egg-info/dependency_links.txt +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/microsoft_agents_hosting_core.egg-info/top_level.txt +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/pyproject.toml +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/readme.md +0 -0
- {microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/setup.cfg +0 -0
{microsoft_agents_hosting_core-0.9.0.dev5 → microsoft_agents_hosting_core-0.9.0.dev7}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-hosting-core
|
|
3
|
-
Version: 0.9.0.
|
|
3
|
+
Version: 0.9.0.dev7
|
|
4
4
|
Summary: Core library for Microsoft Agents
|
|
5
5
|
Author: Microsoft Corporation
|
|
6
6
|
License-Expression: MIT
|
|
@@ -15,11 +15,13 @@ Classifier: Operating System :: OS Independent
|
|
|
15
15
|
Requires-Python: >=3.10
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: microsoft-agents-activity==0.9.0.
|
|
18
|
+
Requires-Dist: microsoft-agents-activity==0.9.0.dev7
|
|
19
19
|
Requires-Dist: pyjwt>=2.10.1
|
|
20
20
|
Requires-Dist: isodate>=0.6.1
|
|
21
21
|
Requires-Dist: azure-core>=1.30.0
|
|
22
22
|
Requires-Dist: python-dotenv>=1.1.1
|
|
23
|
+
Requires-Dist: opentelemetry-api>=1.27.0
|
|
24
|
+
Requires-Dist: opentelemetry-sdk>=1.27.0
|
|
23
25
|
Dynamic: license-file
|
|
24
26
|
Dynamic: requires-dist
|
|
25
27
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.9.0.dev7
|
|
@@ -30,7 +30,8 @@ from microsoft_agents.activity import (
|
|
|
30
30
|
InvokeResponse,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
from
|
|
33
|
+
from microsoft_agents.hosting.core.turn_context import TurnContext
|
|
34
|
+
|
|
34
35
|
from ..agent import Agent
|
|
35
36
|
from ..authorization import Connections
|
|
36
37
|
from .app_error import ApplicationError
|
|
@@ -40,6 +41,7 @@ from .state import TurnState
|
|
|
40
41
|
from ..channel_service_adapter import ChannelServiceAdapter
|
|
41
42
|
from .oauth import Authorization
|
|
42
43
|
from .typing_indicator import TypingIndicator
|
|
44
|
+
from .telemetry import spans
|
|
43
45
|
|
|
44
46
|
from ._type_defs import RouteHandler, RouteSelector
|
|
45
47
|
from ._routes import _RouteList, _Route, RouteRank, _agentic_selector
|
|
@@ -669,50 +671,51 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
669
671
|
async def _on_turn(self, context: TurnContext):
|
|
670
672
|
typing = None
|
|
671
673
|
try:
|
|
672
|
-
|
|
673
|
-
if
|
|
674
|
-
|
|
675
|
-
|
|
674
|
+
with spans.AppOnTurn(context) as on_turn_span:
|
|
675
|
+
if context.activity.type != ActivityTypes.typing:
|
|
676
|
+
if self._options.start_typing_timer:
|
|
677
|
+
typing = TypingIndicator(context)
|
|
678
|
+
typing.start()
|
|
676
679
|
|
|
677
|
-
|
|
680
|
+
self._remove_mentions(context)
|
|
678
681
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
682
|
+
logger.debug("Initializing turn state")
|
|
683
|
+
turn_state = await self._initialize_state(context)
|
|
684
|
+
if (
|
|
685
|
+
context.activity.type == ActivityTypes.message
|
|
686
|
+
or context.activity.type == ActivityTypes.invoke
|
|
687
|
+
):
|
|
685
688
|
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
689
|
+
(
|
|
690
|
+
auth_intercepts,
|
|
691
|
+
continuation_activity,
|
|
692
|
+
) = await self._auth._on_turn_auth_intercept(context, turn_state)
|
|
693
|
+
if auth_intercepts:
|
|
694
|
+
if continuation_activity:
|
|
695
|
+
new_context = copy(context)
|
|
696
|
+
new_context.activity = continuation_activity
|
|
697
|
+
logger.info(
|
|
698
|
+
"Resending continuation activity %s",
|
|
699
|
+
continuation_activity.text,
|
|
700
|
+
)
|
|
701
|
+
await self.on_turn(new_context)
|
|
702
|
+
await turn_state.save(context)
|
|
703
|
+
return
|
|
701
704
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
+
logger.debug("Running before turn middleware")
|
|
706
|
+
if not await self._run_before_turn_middleware(context, turn_state):
|
|
707
|
+
return
|
|
705
708
|
|
|
706
|
-
|
|
707
|
-
|
|
709
|
+
logger.debug("Running file downloads")
|
|
710
|
+
await self._handle_file_downloads(context, turn_state)
|
|
708
711
|
|
|
709
|
-
|
|
710
|
-
|
|
712
|
+
logger.debug("Running activity handlers")
|
|
713
|
+
await self._on_activity(context, turn_state, on_turn_span)
|
|
711
714
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
715
|
+
logger.debug("Running after turn middleware")
|
|
716
|
+
if await self._run_after_turn_middleware(context, turn_state):
|
|
717
|
+
await turn_state.save(context)
|
|
718
|
+
return
|
|
716
719
|
except ApplicationError as err:
|
|
717
720
|
logger.error(
|
|
718
721
|
f"An application error occurred in the AgentApplication: {err}",
|
|
@@ -777,23 +780,28 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
777
780
|
return turn_state
|
|
778
781
|
|
|
779
782
|
async def _run_before_turn_middleware(self, context: TurnContext, state: StateT):
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
783
|
+
with spans.AppBeforeTurn():
|
|
784
|
+
for before_turn in self._internal_before_turn:
|
|
785
|
+
is_ok = await before_turn(context, state)
|
|
786
|
+
if not is_ok:
|
|
787
|
+
await state.save(context)
|
|
788
|
+
return False
|
|
789
|
+
return True
|
|
786
790
|
|
|
787
791
|
async def _handle_file_downloads(self, context: TurnContext, state: StateT):
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
792
|
+
with spans.AppDownloadFiles(context):
|
|
793
|
+
if (
|
|
794
|
+
self._options.file_downloaders
|
|
795
|
+
and len(self._options.file_downloaders) > 0
|
|
796
|
+
):
|
|
797
|
+
input_files = state.temp.input_files if state.temp.input_files else []
|
|
798
|
+
for file_downloader in self._options.file_downloaders:
|
|
799
|
+
logger.info(
|
|
800
|
+
f"Using file downloader: {file_downloader.__class__.__name__}"
|
|
801
|
+
)
|
|
802
|
+
files = await file_downloader.download_files(context)
|
|
803
|
+
input_files.extend(files)
|
|
804
|
+
state.temp.input_files = input_files
|
|
797
805
|
|
|
798
806
|
def _contains_non_text_attachments(self, context: TurnContext):
|
|
799
807
|
non_text_attachments = filter(
|
|
@@ -803,18 +811,31 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
803
811
|
return len(list(non_text_attachments)) > 0
|
|
804
812
|
|
|
805
813
|
async def _run_after_turn_middleware(self, context: TurnContext, state: StateT):
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
814
|
+
with spans.AppAfterTurn():
|
|
815
|
+
for after_turn in self._internal_after_turn:
|
|
816
|
+
is_ok = await after_turn(context, state)
|
|
817
|
+
if not is_ok:
|
|
818
|
+
await state.save(context)
|
|
819
|
+
return False
|
|
820
|
+
return True
|
|
821
|
+
|
|
822
|
+
async def _on_activity(
|
|
823
|
+
self,
|
|
824
|
+
context: TurnContext,
|
|
825
|
+
state: StateT,
|
|
826
|
+
on_turn_span: spans.AppOnTurn | None = None,
|
|
827
|
+
):
|
|
828
|
+
|
|
829
|
+
route_matched: bool = False
|
|
830
|
+
route_authorized: bool = False
|
|
812
831
|
|
|
813
|
-
async def _on_activity(self, context: TurnContext, state: StateT):
|
|
814
832
|
for route in self._route_list:
|
|
815
833
|
if route.selector(context):
|
|
834
|
+
route_matched = True
|
|
816
835
|
if not route.auth_handlers:
|
|
817
|
-
|
|
836
|
+
route_authorized = True
|
|
837
|
+
with spans.AppRouteHandler(route.is_invoke, route.is_agentic):
|
|
838
|
+
await route.handler(context, state)
|
|
818
839
|
else:
|
|
819
840
|
sign_in_complete = True
|
|
820
841
|
for auth_handler_id in route.auth_handlers:
|
|
@@ -827,11 +848,19 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
827
848
|
break
|
|
828
849
|
|
|
829
850
|
if sign_in_complete:
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
851
|
+
route_authorized = True
|
|
852
|
+
with spans.AppRouteHandler(route.is_invoke, route.is_agentic):
|
|
853
|
+
await route.handler(context, state)
|
|
854
|
+
break
|
|
855
|
+
|
|
856
|
+
if not route_matched:
|
|
857
|
+
logger.warning(
|
|
858
|
+
f"No route found for activity type: {context.activity.type} with text: {context.activity.text}"
|
|
859
|
+
)
|
|
860
|
+
if on_turn_span is not None:
|
|
861
|
+
on_turn_span.share(
|
|
862
|
+
route_authorized=route_authorized, route_matched=route_matched
|
|
863
|
+
)
|
|
835
864
|
|
|
836
865
|
async def _start_long_running_call(
|
|
837
866
|
self, context: TurnContext, func: Callable[[TurnContext], Awaitable]
|
|
@@ -29,6 +29,7 @@ from microsoft_agents.hosting.core._oauth import (
|
|
|
29
29
|
)
|
|
30
30
|
from .._sign_in_response import _SignInResponse
|
|
31
31
|
from ._authorization_handler import _AuthorizationHandler
|
|
32
|
+
from ..telemetry import spans
|
|
32
33
|
|
|
33
34
|
logger = logging.getLogger(__name__)
|
|
34
35
|
|
|
@@ -119,21 +120,26 @@ class _UserAuthorization(_AuthorizationHandler):
|
|
|
119
120
|
connection_name = exchange_connection or self._handler.obo_connection_name
|
|
120
121
|
exchange_scopes = exchange_scopes or self._handler.scopes
|
|
121
122
|
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
with spans.AzureBotToken(
|
|
124
|
+
auth_handler_id=self._id,
|
|
125
|
+
connection_name=connection_name,
|
|
126
|
+
scopes=exchange_scopes,
|
|
127
|
+
):
|
|
128
|
+
if not connection_name or not exchange_scopes:
|
|
129
|
+
return input_token_response
|
|
124
130
|
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
if not input_token_response.is_exchangeable():
|
|
132
|
+
return input_token_response
|
|
127
133
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
token_provider = self._connection_manager.get_connection(connection_name)
|
|
135
|
+
if not token_provider:
|
|
136
|
+
raise ValueError(f"Connection '{connection_name}' not found")
|
|
131
137
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
138
|
+
token = await token_provider.acquire_token_on_behalf_of(
|
|
139
|
+
scopes=exchange_scopes,
|
|
140
|
+
user_assertion=input_token_response.token,
|
|
141
|
+
)
|
|
142
|
+
return TokenResponse(token=token) if token else TokenResponse()
|
|
137
143
|
|
|
138
144
|
async def _sign_out(
|
|
139
145
|
self,
|
|
@@ -147,10 +153,11 @@ class _UserAuthorization(_AuthorizationHandler):
|
|
|
147
153
|
:param auth_handler_id: Optional ID of the auth handler to use for sign out. If None,
|
|
148
154
|
signs out from all the handlers.
|
|
149
155
|
"""
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
156
|
+
with spans.AzureBotSignOut(auth_handler_id=self._id):
|
|
157
|
+
flow, flow_storage_client = await self._load_flow(context)
|
|
158
|
+
logger.info("Signing out from handler: %s", self._id)
|
|
159
|
+
await flow.sign_out()
|
|
160
|
+
await flow_storage_client.delete(self._id)
|
|
154
161
|
|
|
155
162
|
async def _handle_flow_response(
|
|
156
163
|
self, context: TurnContext, flow_response: _FlowResponse
|
|
@@ -212,31 +219,40 @@ class _UserAuthorization(_AuthorizationHandler):
|
|
|
212
219
|
:return: The _SignInResponse containing the token response and flow state tag.
|
|
213
220
|
:rtype: _SignInResponse
|
|
214
221
|
"""
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
if flow_response.token_response:
|
|
225
|
-
# attempt exchange if needed
|
|
226
|
-
# if not needed, returns the same token
|
|
227
|
-
token_response = await self._handle_obo(
|
|
228
|
-
context,
|
|
229
|
-
flow_response.token_response,
|
|
230
|
-
exchange_connection,
|
|
231
|
-
exchange_scopes,
|
|
222
|
+
with spans.AzureBotSignIn(
|
|
223
|
+
auth_handler_id=self._id,
|
|
224
|
+
connection_name=exchange_connection,
|
|
225
|
+
scopes=exchange_scopes,
|
|
226
|
+
):
|
|
227
|
+
flow, flow_storage_client = await self._load_flow(context)
|
|
228
|
+
flow_response: _FlowResponse = await flow.begin_or_continue_flow(
|
|
229
|
+
context.activity
|
|
232
230
|
)
|
|
233
231
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
232
|
+
logger.info("Saving OAuth flow state to storage")
|
|
233
|
+
await flow_storage_client.write(flow_response.flow_state)
|
|
234
|
+
await self._handle_flow_response(context, flow_response)
|
|
235
|
+
|
|
236
|
+
if flow_response.token_response:
|
|
237
|
+
# attempt exchange if needed
|
|
238
|
+
# if not needed, returns the same token
|
|
239
|
+
token_response = await self._handle_obo(
|
|
240
|
+
context,
|
|
241
|
+
flow_response.token_response,
|
|
242
|
+
exchange_connection,
|
|
243
|
+
exchange_scopes,
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
return _SignInResponse(
|
|
247
|
+
token_response=token_response,
|
|
248
|
+
tag=(
|
|
249
|
+
_FlowStateTag.COMPLETE
|
|
250
|
+
if token_response
|
|
251
|
+
else _FlowStateTag.FAILURE
|
|
252
|
+
),
|
|
253
|
+
)
|
|
238
254
|
|
|
239
|
-
|
|
255
|
+
return _SignInResponse(tag=flow_response.flow_state.tag)
|
|
240
256
|
|
|
241
257
|
async def get_refreshed_token(
|
|
242
258
|
self,
|
|
@@ -16,6 +16,7 @@ from ._authorization_handler import _AuthorizationHandler
|
|
|
16
16
|
from ....storage import Storage
|
|
17
17
|
from ....authorization import Connections
|
|
18
18
|
from ..auth_handler import AuthHandler
|
|
19
|
+
from ..telemetry import spans
|
|
19
20
|
|
|
20
21
|
logger = logging.getLogger(__name__)
|
|
21
22
|
|
|
@@ -179,9 +180,14 @@ class AgenticUserAuthorization(_AuthorizationHandler):
|
|
|
179
180
|
:param exchange_scopes: Optional list of scopes to request during token exchange. If None, default scopes will be used.
|
|
180
181
|
:type exchange_scopes: Optional[list[str]], Optional
|
|
181
182
|
"""
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
with spans.AgenticToken(
|
|
184
|
+
auth_handler_id=self._id,
|
|
185
|
+
connection_name=exchange_connection,
|
|
186
|
+
scopes=exchange_scopes,
|
|
187
|
+
):
|
|
188
|
+
if not exchange_scopes:
|
|
189
|
+
exchange_scopes = self._handler.scopes or []
|
|
190
|
+
return await self.get_agentic_user_token(context, exchange_scopes)
|
|
185
191
|
|
|
186
192
|
async def sign_out(
|
|
187
193
|
self, context: TurnContext, auth_handler_id: Optional[str] = None
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
AGENTIC_TOKEN = "agents.authorization.agentic_token"
|
|
5
|
+
AZURE_BOT_TOKEN = "agents.authorization.azure_bot_token"
|
|
6
|
+
AZURE_BOT_SIGN_OUT = "agents.authorization.azure_bot_sign_out"
|
|
7
|
+
AZURE_BOT_SIGN_IN = "agents.authorization.azure_bot_sign_in"
|
microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/app/oauth/telemetry/spans.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from opentelemetry.trace import Span
|
|
7
|
+
|
|
8
|
+
from microsoft_agents.hosting.core.telemetry import (
|
|
9
|
+
attributes,
|
|
10
|
+
AttributeMap,
|
|
11
|
+
SimpleSpanWrapper,
|
|
12
|
+
format_scopes,
|
|
13
|
+
)
|
|
14
|
+
from . import constants
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class _AuthorizationSpanWrapper(SimpleSpanWrapper):
|
|
18
|
+
"""Base SpanWrapper for spans related to authorization operations.
|
|
19
|
+
|
|
20
|
+
This is meant to be a base class for spans related to authorization operations,
|
|
21
|
+
and can be used to share common functionality and attributes
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(
|
|
25
|
+
self,
|
|
26
|
+
span_name: str,
|
|
27
|
+
auth_handler_id: str,
|
|
28
|
+
connection_name: str | None = None,
|
|
29
|
+
scopes: list[str] | None = None,
|
|
30
|
+
):
|
|
31
|
+
"""Initializes the _StorageSpanWrapper span."""
|
|
32
|
+
super().__init__(span_name)
|
|
33
|
+
self._auth_handler_id = auth_handler_id
|
|
34
|
+
self._connection_name = connection_name
|
|
35
|
+
self._scopes = scopes
|
|
36
|
+
|
|
37
|
+
def _callback(self, span: Span, duration: float, error: Exception | None) -> None:
|
|
38
|
+
"""Callback function that is called when the span ends."""
|
|
39
|
+
|
|
40
|
+
def _get_attributes(self) -> dict[str, str]:
|
|
41
|
+
"""Gets the attributes to be added to the span."""
|
|
42
|
+
attr_dict = {
|
|
43
|
+
attributes.AUTH_HANDLER_ID: self._auth_handler_id,
|
|
44
|
+
attributes.CONNECTION_NAME: self._connection_name or attributes.UNKNOWN,
|
|
45
|
+
}
|
|
46
|
+
if self._scopes is not None:
|
|
47
|
+
attr_dict[attributes.AUTH_SCOPES] = format_scopes(self._scopes)
|
|
48
|
+
return attr_dict
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class AgenticToken(_AuthorizationSpanWrapper):
|
|
52
|
+
"""Span wrapper for agentic token operations."""
|
|
53
|
+
|
|
54
|
+
def __init__(
|
|
55
|
+
self,
|
|
56
|
+
auth_handler_id: str,
|
|
57
|
+
connection_name: str | None,
|
|
58
|
+
scopes: list[str] | None,
|
|
59
|
+
):
|
|
60
|
+
"""Initializes the AgenticToken span."""
|
|
61
|
+
super().__init__(
|
|
62
|
+
constants.AGENTIC_TOKEN,
|
|
63
|
+
auth_handler_id,
|
|
64
|
+
connection_name,
|
|
65
|
+
scopes,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class AzureBotToken(_AuthorizationSpanWrapper):
|
|
70
|
+
"""Span wrapper for azure bot token operations."""
|
|
71
|
+
|
|
72
|
+
def __init__(
|
|
73
|
+
self,
|
|
74
|
+
auth_handler_id: str,
|
|
75
|
+
connection_name: str | None,
|
|
76
|
+
scopes: list[str] | None,
|
|
77
|
+
):
|
|
78
|
+
"""Initializes the AzureBotToken span."""
|
|
79
|
+
super().__init__(
|
|
80
|
+
constants.AZURE_BOT_TOKEN,
|
|
81
|
+
auth_handler_id,
|
|
82
|
+
connection_name,
|
|
83
|
+
scopes,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class AzureBotSignIn(_AuthorizationSpanWrapper):
|
|
88
|
+
"""Span wrapper for azure bot sign in operations."""
|
|
89
|
+
|
|
90
|
+
def __init__(
|
|
91
|
+
self,
|
|
92
|
+
auth_handler_id: str,
|
|
93
|
+
connection_name: str | None,
|
|
94
|
+
scopes: list[str] | None,
|
|
95
|
+
):
|
|
96
|
+
"""Initializes the AzureBotSignIn span."""
|
|
97
|
+
super().__init__(
|
|
98
|
+
constants.AZURE_BOT_SIGN_IN,
|
|
99
|
+
auth_handler_id,
|
|
100
|
+
connection_name,
|
|
101
|
+
scopes,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class AzureBotSignOut(_AuthorizationSpanWrapper):
|
|
106
|
+
"""Span wrapper for azure bot sign out operations."""
|
|
107
|
+
|
|
108
|
+
def __init__(self, auth_handler_id: str):
|
|
109
|
+
"""Initializes the AzureBotSignOut span."""
|
|
110
|
+
super().__init__(
|
|
111
|
+
constants.AZURE_BOT_SIGN_OUT,
|
|
112
|
+
auth_handler_id,
|
|
113
|
+
)
|
microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/app/telemetry/__init__.py
ADDED
|
File without changes
|
microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/app/telemetry/constants.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
SPAN_ON_TURN = "agents.app.run"
|
|
5
|
+
SPAN_ROUTE_HANDLER = "agents.app.route_handler"
|
|
6
|
+
SPAN_BEFORE_TURN = "agents.app.before_turn"
|
|
7
|
+
SPAN_AFTER_TURN = "agents.app.after_turn"
|
|
8
|
+
SPAN_DOWNLOAD_FILES = "agents.app.download_files"
|
|
9
|
+
|
|
10
|
+
METRIC_TURN_COUNT = "agents.turn.count"
|
|
11
|
+
METRIC_TURN_ERROR_COUNT = "agents.turn.error.count"
|
|
12
|
+
METRIC_TURN_DURATION = "agents.turn.duration"
|
microsoft_agents_hosting_core-0.9.0.dev7/microsoft_agents/hosting/core/app/telemetry/metrics.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
from microsoft_agents.hosting.core.telemetry import agents_telemetry
|
|
5
|
+
from . import constants
|
|
6
|
+
|
|
7
|
+
turn_count = agents_telemetry.meter.create_counter(
|
|
8
|
+
constants.METRIC_TURN_COUNT,
|
|
9
|
+
"turn",
|
|
10
|
+
description="Total number of turns processed by the agent",
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
turn_error_count = agents_telemetry.meter.create_counter(
|
|
14
|
+
constants.METRIC_TURN_ERROR_COUNT,
|
|
15
|
+
"turn",
|
|
16
|
+
description="Number of turns that resulted in an error",
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
turn_duration = agents_telemetry.meter.create_histogram(
|
|
20
|
+
constants.METRIC_TURN_DURATION,
|
|
21
|
+
"ms",
|
|
22
|
+
description="Duration of agent turns in milliseconds",
|
|
23
|
+
)
|