aip-agents-binary 0.0.0b2__py3-none-any.whl → 0.5.12__py3-none-any.whl
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.
- aip_agents/__init__.py +65 -0
- aip_agents/a2a/__init__.py +19 -0
- aip_agents/a2a/server/__init__.py +10 -0
- aip_agents/a2a/server/base_executor.py +1086 -0
- aip_agents/a2a/server/google_adk_executor.py +198 -0
- aip_agents/a2a/server/langflow_executor.py +180 -0
- aip_agents/a2a/server/langgraph_executor.py +270 -0
- aip_agents/a2a/types.py +232 -0
- aip_agents/agent/__init__.py +27 -0
- aip_agents/agent/base_agent.py +970 -0
- aip_agents/agent/base_langgraph_agent.py +2942 -0
- aip_agents/agent/google_adk_agent.py +926 -0
- aip_agents/agent/google_adk_constants.py +6 -0
- aip_agents/agent/hitl/__init__.py +24 -0
- aip_agents/agent/hitl/config.py +28 -0
- aip_agents/agent/hitl/langgraph_hitl_mixin.py +515 -0
- aip_agents/agent/hitl/manager.py +532 -0
- aip_agents/agent/hitl/models.py +18 -0
- aip_agents/agent/hitl/prompt/__init__.py +9 -0
- aip_agents/agent/hitl/prompt/base.py +42 -0
- aip_agents/agent/hitl/prompt/deferred.py +73 -0
- aip_agents/agent/hitl/registry.py +149 -0
- aip_agents/agent/{interface.pyi → interface.py} +70 -13
- aip_agents/agent/interfaces.py +65 -0
- aip_agents/agent/langflow_agent.py +464 -0
- aip_agents/agent/langgraph_memory_enhancer_agent.py +433 -0
- aip_agents/agent/langgraph_react_agent.py +2514 -0
- aip_agents/agent/system_instruction_context.py +34 -0
- aip_agents/clients/__init__.py +10 -0
- aip_agents/clients/langflow/__init__.py +10 -0
- aip_agents/clients/langflow/client.py +477 -0
- aip_agents/clients/langflow/types.py +18 -0
- aip_agents/constants.py +23 -0
- aip_agents/credentials/manager.py +132 -0
- aip_agents/examples/__init__.py +5 -0
- aip_agents/examples/compare_streaming_client.py +783 -0
- aip_agents/examples/compare_streaming_server.py +142 -0
- aip_agents/examples/demo_memory_recall.py +401 -0
- aip_agents/examples/hello_world_a2a_google_adk_client.py +49 -0
- aip_agents/examples/hello_world_a2a_google_adk_client_agent.py +48 -0
- aip_agents/examples/hello_world_a2a_google_adk_client_streaming.py +60 -0
- aip_agents/examples/hello_world_a2a_google_adk_server.py +79 -0
- aip_agents/examples/hello_world_a2a_langchain_client.py +39 -0
- aip_agents/examples/hello_world_a2a_langchain_client_agent.py +39 -0
- aip_agents/examples/hello_world_a2a_langchain_client_lm_invoker.py +37 -0
- aip_agents/examples/hello_world_a2a_langchain_client_streaming.py +41 -0
- aip_agents/examples/hello_world_a2a_langchain_reference_client_streaming.py +60 -0
- aip_agents/examples/hello_world_a2a_langchain_reference_server.py +105 -0
- aip_agents/examples/hello_world_a2a_langchain_server.py +79 -0
- aip_agents/examples/hello_world_a2a_langchain_server_lm_invoker.py +78 -0
- aip_agents/examples/hello_world_a2a_langflow_client.py +83 -0
- aip_agents/examples/hello_world_a2a_langflow_server.py +82 -0
- aip_agents/examples/hello_world_a2a_langgraph_artifact_client.py +73 -0
- aip_agents/examples/hello_world_a2a_langgraph_artifact_client_streaming.py +76 -0
- aip_agents/examples/hello_world_a2a_langgraph_artifact_server.py +92 -0
- aip_agents/examples/hello_world_a2a_langgraph_client.py +54 -0
- aip_agents/examples/hello_world_a2a_langgraph_client_agent.py +54 -0
- aip_agents/examples/hello_world_a2a_langgraph_client_agent_lm_invoker.py +32 -0
- aip_agents/examples/hello_world_a2a_langgraph_client_streaming.py +50 -0
- aip_agents/examples/hello_world_a2a_langgraph_client_streaming_lm_invoker.py +44 -0
- aip_agents/examples/hello_world_a2a_langgraph_client_streaming_tool_streaming.py +92 -0
- aip_agents/examples/hello_world_a2a_langgraph_server.py +84 -0
- aip_agents/examples/hello_world_a2a_langgraph_server_lm_invoker.py +79 -0
- aip_agents/examples/hello_world_a2a_langgraph_server_tool_streaming.py +132 -0
- aip_agents/examples/hello_world_a2a_mcp_langgraph.py +196 -0
- aip_agents/examples/hello_world_a2a_three_level_agent_hierarchy_client.py +244 -0
- aip_agents/examples/hello_world_a2a_three_level_agent_hierarchy_server.py +251 -0
- aip_agents/examples/hello_world_a2a_with_metadata_langchain_client.py +57 -0
- aip_agents/examples/hello_world_a2a_with_metadata_langchain_server_lm_invoker.py +80 -0
- aip_agents/examples/hello_world_google_adk.py +41 -0
- aip_agents/examples/hello_world_google_adk_mcp_http.py +34 -0
- aip_agents/examples/hello_world_google_adk_mcp_http_stream.py +40 -0
- aip_agents/examples/hello_world_google_adk_mcp_sse.py +44 -0
- aip_agents/examples/hello_world_google_adk_mcp_sse_stream.py +48 -0
- aip_agents/examples/hello_world_google_adk_mcp_stdio.py +44 -0
- aip_agents/examples/hello_world_google_adk_mcp_stdio_stream.py +48 -0
- aip_agents/examples/hello_world_google_adk_stream.py +44 -0
- aip_agents/examples/hello_world_langchain.py +28 -0
- aip_agents/examples/hello_world_langchain_lm_invoker.py +15 -0
- aip_agents/examples/hello_world_langchain_mcp_http.py +34 -0
- aip_agents/examples/hello_world_langchain_mcp_http_interactive.py +130 -0
- aip_agents/examples/hello_world_langchain_mcp_http_stream.py +42 -0
- aip_agents/examples/hello_world_langchain_mcp_multi_server.py +155 -0
- aip_agents/examples/hello_world_langchain_mcp_sse.py +34 -0
- aip_agents/examples/hello_world_langchain_mcp_sse_stream.py +40 -0
- aip_agents/examples/hello_world_langchain_mcp_stdio.py +30 -0
- aip_agents/examples/hello_world_langchain_mcp_stdio_stream.py +41 -0
- aip_agents/examples/hello_world_langchain_stream.py +36 -0
- aip_agents/examples/hello_world_langchain_stream_lm_invoker.py +39 -0
- aip_agents/examples/hello_world_langflow_agent.py +163 -0
- aip_agents/examples/hello_world_langgraph.py +39 -0
- aip_agents/examples/hello_world_langgraph_bosa_twitter.py +41 -0
- aip_agents/examples/hello_world_langgraph_mcp_http.py +31 -0
- aip_agents/examples/hello_world_langgraph_mcp_http_stream.py +34 -0
- aip_agents/examples/hello_world_langgraph_mcp_sse.py +35 -0
- aip_agents/examples/hello_world_langgraph_mcp_sse_stream.py +50 -0
- aip_agents/examples/hello_world_langgraph_mcp_stdio.py +35 -0
- aip_agents/examples/hello_world_langgraph_mcp_stdio_stream.py +50 -0
- aip_agents/examples/hello_world_langgraph_stream.py +43 -0
- aip_agents/examples/hello_world_langgraph_stream_lm_invoker.py +37 -0
- aip_agents/examples/hello_world_model_switch_cli.py +210 -0
- aip_agents/examples/hello_world_multi_agent_adk.py +75 -0
- aip_agents/examples/hello_world_multi_agent_langchain.py +54 -0
- aip_agents/examples/hello_world_multi_agent_langgraph.py +66 -0
- aip_agents/examples/hello_world_multi_agent_langgraph_lm_invoker.py +69 -0
- aip_agents/examples/hello_world_pii_logger.py +21 -0
- aip_agents/examples/hello_world_sentry.py +133 -0
- aip_agents/examples/hello_world_step_limits.py +273 -0
- aip_agents/examples/hello_world_stock_a2a_server.py +103 -0
- aip_agents/examples/hello_world_tool_output_client.py +46 -0
- aip_agents/examples/hello_world_tool_output_server.py +114 -0
- aip_agents/examples/hitl_demo.py +724 -0
- aip_agents/examples/mcp_configs/configs.py +63 -0
- aip_agents/examples/mcp_servers/common.py +76 -0
- aip_agents/examples/mcp_servers/mcp_name.py +29 -0
- aip_agents/examples/mcp_servers/mcp_server_http.py +19 -0
- aip_agents/examples/mcp_servers/mcp_server_sse.py +19 -0
- aip_agents/examples/mcp_servers/mcp_server_stdio.py +19 -0
- aip_agents/examples/mcp_servers/mcp_time.py +10 -0
- aip_agents/examples/pii_demo_langgraph_client.py +69 -0
- aip_agents/examples/pii_demo_langgraph_server.py +126 -0
- aip_agents/examples/pii_demo_multi_agent_client.py +80 -0
- aip_agents/examples/pii_demo_multi_agent_server.py +247 -0
- aip_agents/examples/todolist_planning_a2a_langchain_client.py +70 -0
- aip_agents/examples/todolist_planning_a2a_langgraph_server.py +88 -0
- aip_agents/examples/tools/__init__.py +27 -0
- aip_agents/examples/tools/{adk_arithmetic_tools.pyi → adk_arithmetic_tools.py} +12 -0
- aip_agents/examples/tools/adk_weather_tool.py +60 -0
- aip_agents/examples/tools/data_generator_tool.py +103 -0
- aip_agents/examples/tools/data_visualization_tool.py +312 -0
- aip_agents/examples/tools/image_artifact_tool.py +136 -0
- aip_agents/examples/tools/langchain_arithmetic_tools.py +26 -0
- aip_agents/examples/tools/langchain_currency_exchange_tool.py +88 -0
- aip_agents/examples/tools/langchain_graph_artifact_tool.py +172 -0
- aip_agents/examples/tools/langchain_weather_tool.py +48 -0
- aip_agents/examples/tools/langgraph_streaming_tool.py +130 -0
- aip_agents/examples/tools/mock_retrieval_tool.py +56 -0
- aip_agents/examples/tools/pii_demo_tools.py +189 -0
- aip_agents/examples/tools/random_chart_tool.py +142 -0
- aip_agents/examples/tools/serper_tool.py +202 -0
- aip_agents/examples/tools/stock_tools.py +82 -0
- aip_agents/examples/tools/table_generator_tool.py +167 -0
- aip_agents/examples/tools/time_tool.py +82 -0
- aip_agents/examples/tools/weather_forecast_tool.py +38 -0
- aip_agents/executor/agent_executor.py +473 -0
- aip_agents/executor/base.py +48 -0
- aip_agents/mcp/__init__.py +1 -0
- aip_agents/mcp/client/__init__.py +14 -0
- aip_agents/mcp/client/base_mcp_client.py +369 -0
- aip_agents/mcp/client/connection_manager.py +193 -0
- aip_agents/mcp/client/google_adk/__init__.py +11 -0
- aip_agents/mcp/client/google_adk/client.py +381 -0
- aip_agents/mcp/client/langchain/__init__.py +11 -0
- aip_agents/mcp/client/langchain/client.py +265 -0
- aip_agents/mcp/client/persistent_session.py +359 -0
- aip_agents/mcp/client/session_pool.py +351 -0
- aip_agents/mcp/client/transports.py +215 -0
- aip_agents/mcp/utils/__init__.py +7 -0
- aip_agents/mcp/utils/config_validator.py +139 -0
- aip_agents/memory/__init__.py +14 -0
- aip_agents/memory/adapters/__init__.py +10 -0
- aip_agents/memory/adapters/base_adapter.py +717 -0
- aip_agents/memory/adapters/mem0.py +84 -0
- aip_agents/memory/{base.pyi → base.py} +40 -5
- aip_agents/memory/constants.py +49 -0
- aip_agents/memory/factory.py +86 -0
- aip_agents/memory/guidance.py +20 -0
- aip_agents/memory/simple_memory.py +47 -0
- aip_agents/middleware/__init__.py +17 -0
- aip_agents/middleware/base.py +88 -0
- aip_agents/middleware/manager.py +128 -0
- aip_agents/middleware/todolist.py +274 -0
- aip_agents/schema/__init__.py +69 -0
- aip_agents/schema/a2a.py +56 -0
- aip_agents/schema/agent.py +111 -0
- aip_agents/schema/hitl.py +157 -0
- aip_agents/schema/langgraph.py +37 -0
- aip_agents/schema/model_id.py +97 -0
- aip_agents/schema/step_limit.py +108 -0
- aip_agents/schema/storage.py +40 -0
- aip_agents/sentry/__init__.py +11 -0
- aip_agents/sentry/sentry.py +151 -0
- aip_agents/storage/__init__.py +41 -0
- aip_agents/storage/{base.pyi → base.py} +30 -4
- aip_agents/storage/clients/__init__.py +12 -0
- aip_agents/storage/clients/minio_client.py +318 -0
- aip_agents/storage/config.py +62 -0
- aip_agents/storage/providers/__init__.py +15 -0
- aip_agents/storage/providers/{base.pyi → base.py} +23 -6
- aip_agents/storage/providers/{memory.pyi → memory.py} +38 -3
- aip_agents/storage/providers/object_storage.py +214 -0
- aip_agents/tools/__init__.py +6 -0
- aip_agents/tools/bosa_tools.py +105 -0
- aip_agents/tools/browser_use/__init__.py +82 -0
- aip_agents/tools/browser_use/action_parser.py +103 -0
- aip_agents/tools/browser_use/browser_use_tool.py +1112 -0
- aip_agents/tools/browser_use/llm_config.py +120 -0
- aip_agents/tools/browser_use/minio_storage.py +198 -0
- aip_agents/tools/browser_use/schemas.py +119 -0
- aip_agents/tools/browser_use/session.py +76 -0
- aip_agents/tools/browser_use/session_errors.py +132 -0
- aip_agents/tools/browser_use/steel_session_recording.py +317 -0
- aip_agents/tools/browser_use/streaming.py +813 -0
- aip_agents/tools/browser_use/structured_data_parser.py +257 -0
- aip_agents/tools/browser_use/structured_data_recovery.py +204 -0
- aip_agents/tools/browser_use/types.py +78 -0
- aip_agents/tools/code_sandbox/__init__.py +26 -0
- aip_agents/tools/code_sandbox/constant.py +13 -0
- aip_agents/tools/code_sandbox/e2b_cloud_sandbox_extended.py +257 -0
- aip_agents/tools/code_sandbox/e2b_sandbox_tool.py +411 -0
- aip_agents/tools/constants.py +165 -0
- aip_agents/tools/document_loader/__init__.py +37 -0
- aip_agents/tools/document_loader/base_reader.py +262 -0
- aip_agents/tools/document_loader/docx_reader_tool.py +53 -0
- aip_agents/tools/document_loader/excel_reader_tool.py +160 -0
- aip_agents/tools/document_loader/pdf_reader_tool.py +67 -0
- aip_agents/tools/document_loader/pdf_splitter.py +169 -0
- aip_agents/tools/gl_connector/__init__.py +5 -0
- aip_agents/tools/gl_connector/tool.py +351 -0
- aip_agents/tools/memory_search/__init__.py +22 -0
- aip_agents/tools/memory_search/base.py +200 -0
- aip_agents/tools/memory_search/mem0.py +258 -0
- aip_agents/tools/memory_search/schema.py +48 -0
- aip_agents/tools/memory_search_tool.py +26 -0
- aip_agents/tools/tool_config_injector.py +300 -0
- aip_agents/tools/web_search/__init__.py +15 -0
- aip_agents/tools/web_search/serper_tool.py +187 -0
- aip_agents/types/__init__.py +70 -0
- aip_agents/types/a2a_events.py +13 -0
- aip_agents/utils/__init__.py +79 -0
- aip_agents/utils/a2a_connector.py +1757 -0
- aip_agents/utils/artifact_helpers.py +502 -0
- aip_agents/utils/constants.py +22 -0
- aip_agents/utils/datetime/__init__.py +34 -0
- aip_agents/utils/datetime/normalization.py +231 -0
- aip_agents/utils/datetime/timezone.py +206 -0
- aip_agents/utils/env_loader.py +27 -0
- aip_agents/utils/event_handler_registry.py +58 -0
- aip_agents/utils/file_prompt_utils.py +176 -0
- aip_agents/utils/final_response_builder.py +211 -0
- aip_agents/utils/formatter_llm_client.py +231 -0
- aip_agents/utils/langgraph/__init__.py +19 -0
- aip_agents/utils/langgraph/converter.py +128 -0
- aip_agents/utils/langgraph/tool_managers/__init__.py +15 -0
- aip_agents/utils/langgraph/tool_managers/a2a_tool_manager.py +99 -0
- aip_agents/utils/langgraph/tool_managers/{base_tool_manager.pyi → base_tool_manager.py} +25 -8
- aip_agents/utils/langgraph/tool_managers/delegation_tool_manager.py +1071 -0
- aip_agents/utils/langgraph/tool_output_management.py +967 -0
- aip_agents/utils/logger.py +195 -0
- aip_agents/utils/metadata/__init__.py +27 -0
- aip_agents/utils/metadata/activity_metadata_helper.py +407 -0
- aip_agents/utils/metadata/activity_narrative/__init__.py +35 -0
- aip_agents/utils/metadata/activity_narrative/builder.py +817 -0
- aip_agents/utils/metadata/activity_narrative/constants.py +51 -0
- aip_agents/utils/metadata/activity_narrative/context.py +49 -0
- aip_agents/utils/metadata/activity_narrative/formatters.py +230 -0
- aip_agents/utils/metadata/activity_narrative/utils.py +35 -0
- aip_agents/utils/metadata/schemas/__init__.py +16 -0
- aip_agents/utils/metadata/schemas/activity_schema.py +29 -0
- aip_agents/utils/metadata/schemas/thinking_schema.py +31 -0
- aip_agents/utils/metadata/thinking_metadata_helper.py +38 -0
- aip_agents/utils/metadata_helper.py +358 -0
- aip_agents/utils/name_preprocessor/__init__.py +17 -0
- aip_agents/utils/name_preprocessor/{base_name_preprocessor.pyi → base_name_preprocessor.py} +22 -2
- aip_agents/utils/name_preprocessor/google_name_preprocessor.py +100 -0
- aip_agents/utils/name_preprocessor/name_preprocessor.py +87 -0
- aip_agents/utils/name_preprocessor/{openai_name_preprocessor.pyi → openai_name_preprocessor.py} +19 -5
- aip_agents/utils/pii/__init__.py +25 -0
- aip_agents/utils/pii/pii_handler.py +397 -0
- aip_agents/utils/pii/pii_helper.py +207 -0
- aip_agents/utils/pii/uuid_deanonymizer_mapping.py +195 -0
- aip_agents/utils/reference_helper.py +273 -0
- aip_agents/utils/sse_chunk_transformer.py +831 -0
- aip_agents/utils/step_limit_manager.py +265 -0
- aip_agents/utils/token_usage_helper.py +156 -0
- aip_agents_binary-0.5.12.dist-info/METADATA +689 -0
- aip_agents_binary-0.5.12.dist-info/RECORD +279 -0
- {aip_agents_binary-0.0.0b2.dist-info → aip_agents_binary-0.5.12.dist-info}/WHEEL +2 -1
- aip_agents_binary-0.5.12.dist-info/top_level.txt +1 -0
- aip_agents/__init__.pyi +0 -0
- aip_agents/a2a/__init__.pyi +0 -3
- aip_agents/a2a/server/__init__.pyi +0 -4
- aip_agents/a2a/server/base_executor.pyi +0 -63
- aip_agents/a2a/server/google_adk_executor.pyi +0 -51
- aip_agents/a2a/server/langgraph_executor.pyi +0 -48
- aip_agents/a2a/types.pyi +0 -125
- aip_agents/agent/__init__.pyi +0 -7
- aip_agents/agent/base_agent.pyi +0 -205
- aip_agents/agent/base_langgraph_agent.pyi +0 -164
- aip_agents/agent/google_adk_agent.pyi +0 -128
- aip_agents/agent/langgraph_react_agent.pyi +0 -131
- aip_agents/agent/types.pyi +0 -106
- aip_agents/constants.pyi +0 -6
- aip_agents/examples/__init__.pyi +0 -0
- aip_agents/examples/hello_world_a2a_google_adk_client.pyi +0 -9
- aip_agents/examples/hello_world_a2a_google_adk_client_agent.pyi +0 -9
- aip_agents/examples/hello_world_a2a_google_adk_client_streaming.pyi +0 -9
- aip_agents/examples/hello_world_a2a_google_adk_server.pyi +0 -10
- aip_agents/examples/hello_world_a2a_langchain_client.pyi +0 -5
- aip_agents/examples/hello_world_a2a_langchain_client_agent.pyi +0 -5
- aip_agents/examples/hello_world_a2a_langchain_client_lm_invoker.pyi +0 -5
- aip_agents/examples/hello_world_a2a_langchain_client_streaming.pyi +0 -5
- aip_agents/examples/hello_world_a2a_langchain_reference_client_streaming.pyi +0 -5
- aip_agents/examples/hello_world_a2a_langchain_reference_server.pyi +0 -10
- aip_agents/examples/hello_world_a2a_langchain_server.pyi +0 -10
- aip_agents/examples/hello_world_a2a_langchain_server_lm_invoker.pyi +0 -10
- aip_agents/examples/hello_world_a2a_langgraph_artifact_client.pyi +0 -5
- aip_agents/examples/hello_world_a2a_langgraph_artifact_client_streaming.pyi +0 -5
- aip_agents/examples/hello_world_a2a_langgraph_artifact_server.pyi +0 -11
- aip_agents/examples/hello_world_a2a_langgraph_client.pyi +0 -9
- aip_agents/examples/hello_world_a2a_langgraph_client_agent.pyi +0 -9
- aip_agents/examples/hello_world_a2a_langgraph_client_agent_lm_invoker.pyi +0 -2
- aip_agents/examples/hello_world_a2a_langgraph_client_streaming.pyi +0 -9
- aip_agents/examples/hello_world_a2a_langgraph_client_streaming_lm_invoker.pyi +0 -5
- aip_agents/examples/hello_world_a2a_langgraph_client_streaming_tool_streaming.pyi +0 -5
- aip_agents/examples/hello_world_a2a_langgraph_server.pyi +0 -9
- aip_agents/examples/hello_world_a2a_langgraph_server_lm_invoker.pyi +0 -10
- aip_agents/examples/hello_world_a2a_langgraph_server_tool_streaming.pyi +0 -10
- aip_agents/examples/hello_world_a2a_mcp_langgraph.pyi +0 -48
- aip_agents/examples/hello_world_a2a_multi_agent_coordinator_client.pyi +0 -15
- aip_agents/examples/hello_world_a2a_multi_agent_coordinator_client_streaming.pyi +0 -5
- aip_agents/examples/hello_world_a2a_multi_agent_coordinator_server.pyi +0 -11
- aip_agents/examples/hello_world_a2a_three_level_agent_hierarchy_client.pyi +0 -23
- aip_agents/examples/hello_world_a2a_three_level_agent_hierarchy_server.pyi +0 -17
- aip_agents/examples/hello_world_a2a_with_metadata_langchain_client.pyi +0 -5
- aip_agents/examples/hello_world_a2a_with_metadata_langchain_server_lm_invoker.pyi +0 -10
- aip_agents/examples/hello_world_google_adk.pyi +0 -5
- aip_agents/examples/hello_world_google_adk_mcp_http.pyi +0 -5
- aip_agents/examples/hello_world_google_adk_mcp_http_stream.pyi +0 -5
- aip_agents/examples/hello_world_google_adk_mcp_sse.pyi +0 -5
- aip_agents/examples/hello_world_google_adk_mcp_sse_stream.pyi +0 -5
- aip_agents/examples/hello_world_google_adk_mcp_stdio.pyi +0 -5
- aip_agents/examples/hello_world_google_adk_mcp_stdio_stream.pyi +0 -5
- aip_agents/examples/hello_world_google_adk_stream.pyi +0 -5
- aip_agents/examples/hello_world_langchain.pyi +0 -5
- aip_agents/examples/hello_world_langchain_lm_invoker.pyi +0 -2
- aip_agents/examples/hello_world_langchain_mcp_http.pyi +0 -5
- aip_agents/examples/hello_world_langchain_mcp_http_stream.pyi +0 -5
- aip_agents/examples/hello_world_langchain_mcp_sse.pyi +0 -5
- aip_agents/examples/hello_world_langchain_mcp_sse_stream.pyi +0 -5
- aip_agents/examples/hello_world_langchain_mcp_stdio.pyi +0 -5
- aip_agents/examples/hello_world_langchain_mcp_stdio_stream.pyi +0 -5
- aip_agents/examples/hello_world_langchain_stream.pyi +0 -5
- aip_agents/examples/hello_world_langchain_stream_lm_invoker.pyi +0 -5
- aip_agents/examples/hello_world_langgraph.pyi +0 -5
- aip_agents/examples/hello_world_langgraph_bosa.pyi +0 -5
- aip_agents/examples/hello_world_langgraph_bosa_twitter.pyi +0 -5
- aip_agents/examples/hello_world_langgraph_mcp_http.pyi +0 -5
- aip_agents/examples/hello_world_langgraph_mcp_http_stream.pyi +0 -5
- aip_agents/examples/hello_world_langgraph_mcp_sse.pyi +0 -5
- aip_agents/examples/hello_world_langgraph_mcp_sse_stream.pyi +0 -5
- aip_agents/examples/hello_world_langgraph_mcp_stdio.pyi +0 -5
- aip_agents/examples/hello_world_langgraph_mcp_stdio_stream.pyi +0 -5
- aip_agents/examples/hello_world_langgraph_stream.pyi +0 -5
- aip_agents/examples/hello_world_langgraph_stream_lm_invoker.pyi +0 -5
- aip_agents/examples/hello_world_model_switch_cli.pyi +0 -15
- aip_agents/examples/hello_world_multi_agent_adk.pyi +0 -6
- aip_agents/examples/hello_world_multi_agent_langchain.pyi +0 -5
- aip_agents/examples/hello_world_multi_agent_langgraph.pyi +0 -5
- aip_agents/examples/hello_world_multi_agent_langgraph_lm_invoker.pyi +0 -5
- aip_agents/examples/hello_world_pii_logger.pyi +0 -5
- aip_agents/examples/hello_world_sentry.pyi +0 -21
- aip_agents/examples/hello_world_stock_a2a_server.pyi +0 -12
- aip_agents/examples/hello_world_tool_output_client.pyi +0 -5
- aip_agents/examples/hello_world_tool_output_server.pyi +0 -14
- aip_agents/examples/tools/__init__.pyi +0 -7
- aip_agents/examples/tools/adk_weather_tool.pyi +0 -18
- aip_agents/examples/tools/data_generator_tool.pyi +0 -15
- aip_agents/examples/tools/data_visualization_tool.pyi +0 -17
- aip_agents/examples/tools/image_artifact_tool.pyi +0 -24
- aip_agents/examples/tools/langchain_arithmetic_tools.pyi +0 -10
- aip_agents/examples/tools/langchain_currency_exchange_tool.pyi +0 -21
- aip_agents/examples/tools/langchain_graph_artifact_tool.pyi +0 -23
- aip_agents/examples/tools/langchain_weather_tool.pyi +0 -19
- aip_agents/examples/tools/langgraph_streaming_tool.pyi +0 -43
- aip_agents/examples/tools/pr_details_bosa_tool.pyi +0 -26
- aip_agents/examples/tools/serper_tool.pyi +0 -16
- aip_agents/examples/tools/stock_tools.pyi +0 -21
- aip_agents/examples/tools/table_generator_tool.pyi +0 -22
- aip_agents/examples/tools/time_tool.pyi +0 -15
- aip_agents/examples/tools/weather_forecast_tool.pyi +0 -14
- aip_agents/mcp/__init__.pyi +0 -0
- aip_agents/mcp/client/__init__.pyi +0 -4
- aip_agents/mcp/client/google_adk/__init__.pyi +0 -3
- aip_agents/mcp/client/google_adk/client.pyi +0 -38
- aip_agents/mcp/client/langchain/__init__.pyi +0 -3
- aip_agents/mcp/client/langchain/client.pyi +0 -3
- aip_agents/memory/__init__.pyi +0 -0
- aip_agents/memory/simple_memory.pyi +0 -22
- aip_agents/sentry/__init__.pyi +0 -3
- aip_agents/sentry/sentry.pyi +0 -48
- aip_agents/storage/__init__.pyi +0 -8
- aip_agents/storage/clients/__init__.pyi +0 -3
- aip_agents/storage/clients/minio_client.pyi +0 -137
- aip_agents/storage/config.pyi +0 -66
- aip_agents/storage/providers/__init__.pyi +0 -5
- aip_agents/storage/providers/object_storage.pyi +0 -98
- aip_agents/tools/__init__.pyi +0 -3
- aip_agents/tools/base.pyi +0 -44
- aip_agents/tools/base_bosa_tools.pyi +0 -12
- aip_agents/tools/bosa_connector.pyi +0 -30
- aip_agents/tools/bosa_tools.pyi +0 -37
- aip_agents/tools/bosa_tools_interface.pyi +0 -26
- aip_agents/tools/constants.pyi +0 -130
- aip_agents/tools/nested_agent_tool.pyi +0 -45
- aip_agents/tools/tool_config_injector.pyi +0 -26
- aip_agents/types/__init__.pyi +0 -3
- aip_agents/types/a2a_events.pyi +0 -74
- aip_agents/utils/__init__.pyi +0 -5
- aip_agents/utils/a2a_connector.pyi +0 -135
- aip_agents/utils/artifact_helpers.pyi +0 -179
- aip_agents/utils/langgraph/__init__.pyi +0 -3
- aip_agents/utils/langgraph/converter.pyi +0 -49
- aip_agents/utils/langgraph/tool_managers/__init__.pyi +0 -5
- aip_agents/utils/langgraph/tool_managers/a2a_tool_manager.pyi +0 -35
- aip_agents/utils/langgraph/tool_managers/delegation_tool_manager.pyi +0 -50
- aip_agents/utils/langgraph/tool_output_management.pyi +0 -310
- aip_agents/utils/logger_manager.pyi +0 -151
- aip_agents/utils/metadata_helper.pyi +0 -110
- aip_agents/utils/name_preprocessor/__init__.pyi +0 -6
- aip_agents/utils/name_preprocessor/google_name_preprocessor.pyi +0 -38
- aip_agents/utils/name_preprocessor/name_preprocessor.pyi +0 -41
- aip_agents/utils/reference_helper.pyi +0 -49
- aip_agents/utils/token_usage_helper.pyi +0 -60
- aip_agents_binary-0.0.0b2.dist-info/METADATA +0 -277
- aip_agents_binary-0.0.0b2.dist-info/RECORD +0 -157
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from aip_agents.storage.providers.base import BaseStorageProvider as BaseStorageProvider, StorageError as StorageError
|
|
3
|
-
from aip_agents.storage.providers.memory import InMemoryStorageProvider as InMemoryStorageProvider
|
|
4
|
-
from aip_agents.utils.logger_manager import LoggerManager as LoggerManager
|
|
5
|
-
from dataclasses import dataclass
|
|
6
|
-
from datetime import datetime, timedelta
|
|
7
|
-
from typing import Any
|
|
8
|
-
|
|
9
|
-
logger: Incomplete
|
|
10
|
-
STRING_TRUNCATION_LENGTH: int
|
|
11
|
-
MAX_TOOL_ARGS_DISPLAY: int
|
|
12
|
-
DATA_PREVIEW_TRUNCATION_LENGTH: int
|
|
13
|
-
TOOL_OUTPUT_REFERENCE_PREFIX: str
|
|
14
|
-
|
|
15
|
-
class ToolReferenceError(Exception):
|
|
16
|
-
"""Specialized exception for tool output reference resolution errors.
|
|
17
|
-
|
|
18
|
-
This exception is raised when there are issues with resolving tool output references,
|
|
19
|
-
such as invalid reference syntax, missing outputs, or security violations.
|
|
20
|
-
|
|
21
|
-
Attributes:
|
|
22
|
-
reference: The original reference string that caused the error.
|
|
23
|
-
call_id: The call ID that was attempted to be resolved, if applicable.
|
|
24
|
-
details: Additional error details for debugging.
|
|
25
|
-
"""
|
|
26
|
-
reference: Incomplete
|
|
27
|
-
call_id: Incomplete
|
|
28
|
-
details: Incomplete
|
|
29
|
-
def __init__(self, message: str, reference: str | None = None, call_id: str | None = None, details: dict[str, Any] | None = None) -> None:
|
|
30
|
-
"""Initialize a ToolReferenceError.
|
|
31
|
-
|
|
32
|
-
Args:
|
|
33
|
-
message: Human-readable error message describing what went wrong.
|
|
34
|
-
reference: The original reference string that caused the error, if applicable.
|
|
35
|
-
call_id: The call ID that was attempted to be resolved, if applicable.
|
|
36
|
-
details: Additional error details for debugging, if applicable.
|
|
37
|
-
"""
|
|
38
|
-
|
|
39
|
-
@dataclass
|
|
40
|
-
class ToolOutputConfig:
|
|
41
|
-
"""Configuration for tool output management system.
|
|
42
|
-
|
|
43
|
-
This class defines the operational parameters for the tool output management
|
|
44
|
-
system, including storage limits, cleanup intervals, and lifecycle policies.
|
|
45
|
-
|
|
46
|
-
Attributes:
|
|
47
|
-
max_stored_outputs: Maximum number of tool outputs to store simultaneously.
|
|
48
|
-
When this limit is reached, oldest outputs are evicted. Defaults to 100.
|
|
49
|
-
max_age_minutes: Maximum age in minutes for stored outputs before they
|
|
50
|
-
become eligible for cleanup. Defaults to 60 minutes.
|
|
51
|
-
cleanup_interval: Number of tool calls between automatic cleanup operations.
|
|
52
|
-
Set to 0 to disable automatic cleanup. Defaults to 20.
|
|
53
|
-
storage_provider: Optional storage provider for persistent storage.
|
|
54
|
-
If None, uses in-memory storage (backward compatible). Defaults to None.
|
|
55
|
-
"""
|
|
56
|
-
max_stored_outputs: int = ...
|
|
57
|
-
max_age_minutes: int = ...
|
|
58
|
-
cleanup_interval: int = ...
|
|
59
|
-
storage_provider: BaseStorageProvider | None = ...
|
|
60
|
-
|
|
61
|
-
@dataclass
|
|
62
|
-
class ToolOutput:
|
|
63
|
-
"""Container for tool outputs with optional data payload.
|
|
64
|
-
|
|
65
|
-
This class represents tool output metadata and optionally the actual data.
|
|
66
|
-
When used as metadata only, the data field is None and must be retrieved
|
|
67
|
-
from storage. When loaded with data, it contains the complete output.
|
|
68
|
-
|
|
69
|
-
Attributes:
|
|
70
|
-
call_id: Unique identifier for this tool call, used for reference resolution.
|
|
71
|
-
tool_name: Name of the tool that produced this output.
|
|
72
|
-
timestamp: When this output was created and stored.
|
|
73
|
-
size_bytes: Approximate size of the stored data in bytes for memory management.
|
|
74
|
-
tool_args: Input arguments that were passed to the tool for this call.
|
|
75
|
-
data: Optional actual output data. None when used as metadata only.
|
|
76
|
-
data_description: Optional human-readable description of the data content,
|
|
77
|
-
typically provided by the tool itself.
|
|
78
|
-
tags: Optional list of tags for categorization and filtering.
|
|
79
|
-
agent_name: Name of the agent that created this output, for multi-agent context.
|
|
80
|
-
"""
|
|
81
|
-
call_id: str
|
|
82
|
-
tool_name: str
|
|
83
|
-
timestamp: datetime
|
|
84
|
-
size_bytes: int
|
|
85
|
-
tool_args: dict[str, Any]
|
|
86
|
-
data: Any | None = ...
|
|
87
|
-
data_description: str | None = ...
|
|
88
|
-
tags: list[str] | None = ...
|
|
89
|
-
agent_name: str | None = ...
|
|
90
|
-
@property
|
|
91
|
-
def is_metadata_only(self) -> bool:
|
|
92
|
-
"""Check if this instance contains only metadata without data."""
|
|
93
|
-
def is_expired(self, max_age: timedelta) -> bool:
|
|
94
|
-
"""Check if this output has expired based on the given maximum age."""
|
|
95
|
-
def get_data_preview(self, max_length: int = 200, storage_provider: BaseStorageProvider | None = None, thread_id: str | None = None) -> str | None:
|
|
96
|
-
"""Get a truncated string representation of the stored data.
|
|
97
|
-
|
|
98
|
-
Args:
|
|
99
|
-
max_length: Maximum length of the preview string.
|
|
100
|
-
storage_provider: Required only if data is not loaded.
|
|
101
|
-
thread_id: Thread ID required for proper storage key generation.
|
|
102
|
-
|
|
103
|
-
Returns:
|
|
104
|
-
A string representation of the data, truncated if necessary. None if data is not found.
|
|
105
|
-
"""
|
|
106
|
-
def with_data(self, data: Any) -> ToolOutput:
|
|
107
|
-
"""Create a new instance with data populated.
|
|
108
|
-
|
|
109
|
-
Returns a new ToolOutput instance with the same metadata but with
|
|
110
|
-
data field populated. Useful for converting metadata-only instances
|
|
111
|
-
to complete instances.
|
|
112
|
-
"""
|
|
113
|
-
|
|
114
|
-
@dataclass
|
|
115
|
-
class StoreOutputParams:
|
|
116
|
-
"""Parameters for storing tool outputs.
|
|
117
|
-
|
|
118
|
-
Reduces the number of arguments passed to store_output method.
|
|
119
|
-
|
|
120
|
-
Attributes:
|
|
121
|
-
call_id: Unique identifier for this tool call.
|
|
122
|
-
tool_name: Name of the tool that produced the output.
|
|
123
|
-
data: The actual output data to store.
|
|
124
|
-
tool_args: Input arguments used for the tool call.
|
|
125
|
-
thread_id: Thread/conversation ID to organize outputs by conversation.
|
|
126
|
-
description: Optional human-readable description of the output.
|
|
127
|
-
tags: Optional list of tags for categorization.
|
|
128
|
-
agent_name: Name of the agent that created this output.
|
|
129
|
-
"""
|
|
130
|
-
call_id: str
|
|
131
|
-
tool_name: str
|
|
132
|
-
data: Any
|
|
133
|
-
tool_args: dict[str, Any]
|
|
134
|
-
thread_id: str
|
|
135
|
-
description: str | None = ...
|
|
136
|
-
tags: list[str] | None = ...
|
|
137
|
-
agent_name: str | None = ...
|
|
138
|
-
|
|
139
|
-
class ToolOutputManager:
|
|
140
|
-
"""Production-ready tool output manager with comprehensive lifecycle management.
|
|
141
|
-
|
|
142
|
-
This class provides centralized management of tool outputs including storage,
|
|
143
|
-
retrieval, lifecycle management, and LLM-friendly summarization. It handles
|
|
144
|
-
memory management through configurable cleanup policies and provides secure
|
|
145
|
-
access to stored outputs.
|
|
146
|
-
|
|
147
|
-
Key Features:
|
|
148
|
-
- Automatic and manual storage of tool outputs with metadata
|
|
149
|
-
- Configurable lifecycle management with age and size-based eviction
|
|
150
|
-
- LLM-friendly summary generation with data previews and context
|
|
151
|
-
- Memory management with size tracking and cleanup
|
|
152
|
-
- Thread-safe operations with proper error handling and locking
|
|
153
|
-
- Concurrent access support for multi-agent and parallel processing scenarios
|
|
154
|
-
|
|
155
|
-
Attributes:
|
|
156
|
-
config: Configuration object defining operational parameters.
|
|
157
|
-
"""
|
|
158
|
-
config: Incomplete
|
|
159
|
-
def __init__(self, config: ToolOutputConfig) -> None:
|
|
160
|
-
"""Initialize the ToolOutputManager with the given configuration.
|
|
161
|
-
|
|
162
|
-
Args:
|
|
163
|
-
config: Configuration object defining storage limits and cleanup policies.
|
|
164
|
-
"""
|
|
165
|
-
def store_output(self, params: StoreOutputParams) -> None:
|
|
166
|
-
"""Store a tool output with automatic cleanup and size management.
|
|
167
|
-
|
|
168
|
-
This method stores a tool output along with its metadata, automatically
|
|
169
|
-
handling size limits, cleanup, and memory management. If the same call_id
|
|
170
|
-
is used multiple times within the same thread, the previous output will be overwritten.
|
|
171
|
-
|
|
172
|
-
Thread-safe: This method uses internal locking to ensure safe concurrent access.
|
|
173
|
-
|
|
174
|
-
Args:
|
|
175
|
-
params: StoreOutputParams containing all necessary parameters including thread_id.
|
|
176
|
-
|
|
177
|
-
Raises:
|
|
178
|
-
Exception: If storage operation fails for any reason.
|
|
179
|
-
"""
|
|
180
|
-
def get_output(self, call_id: str, thread_id: str) -> ToolOutput | None:
|
|
181
|
-
"""Retrieve a stored tool output by its call ID and thread ID.
|
|
182
|
-
|
|
183
|
-
Thread-safe: This method uses internal locking to ensure safe concurrent access.
|
|
184
|
-
|
|
185
|
-
Args:
|
|
186
|
-
call_id: The unique identifier for the tool call.
|
|
187
|
-
thread_id: The thread/conversation ID to search in.
|
|
188
|
-
|
|
189
|
-
Returns:
|
|
190
|
-
The ToolOutput object with data if found, None otherwise.
|
|
191
|
-
"""
|
|
192
|
-
def has_outputs(self, thread_id: str | None = None) -> bool:
|
|
193
|
-
"""Check if any outputs are currently stored.
|
|
194
|
-
|
|
195
|
-
Thread-safe: This method uses internal locking to ensure safe concurrent access.
|
|
196
|
-
|
|
197
|
-
Args:
|
|
198
|
-
thread_id: Optional thread ID to check for outputs in a specific thread.
|
|
199
|
-
If None, checks across all threads.
|
|
200
|
-
|
|
201
|
-
Returns:
|
|
202
|
-
True if there are stored outputs, False otherwise.
|
|
203
|
-
"""
|
|
204
|
-
def generate_summary(self, thread_id: str, max_entries: int = 10) -> str:
|
|
205
|
-
"""Generate an LLM-friendly structured summary as JSON.
|
|
206
|
-
|
|
207
|
-
This method creates a comprehensive, structured summary of stored outputs that
|
|
208
|
-
can be easily parsed by LLMs and other systems. The JSON format provides rich
|
|
209
|
-
metadata and context about each tool output.
|
|
210
|
-
|
|
211
|
-
Thread-safe: This method uses internal locking to ensure safe concurrent access.
|
|
212
|
-
|
|
213
|
-
Args:
|
|
214
|
-
thread_id: Thread ID to generate summary for.
|
|
215
|
-
max_entries: Maximum number of entries to include in the summary.
|
|
216
|
-
Defaults to 10.
|
|
217
|
-
|
|
218
|
-
Returns:
|
|
219
|
-
A JSON string containing structured data about tool outputs. Always returns
|
|
220
|
-
valid JSON, even when no outputs are stored (empty entries list).
|
|
221
|
-
"""
|
|
222
|
-
def get_stats(self) -> dict[str, Any]:
|
|
223
|
-
"""Get thread-safe statistics about the current state of the manager.
|
|
224
|
-
|
|
225
|
-
Args:
|
|
226
|
-
thread_id: Thread ID to generate summary for.
|
|
227
|
-
max_entries: Maximum number of entries to include in the summary.
|
|
228
|
-
Defaults to 10.
|
|
229
|
-
|
|
230
|
-
Returns:
|
|
231
|
-
Dictionary containing current statistics including output count,
|
|
232
|
-
total size, call count, and thread information.
|
|
233
|
-
"""
|
|
234
|
-
def clear_all_outputs(self) -> int:
|
|
235
|
-
"""Clear all stored outputs and reset counters.
|
|
236
|
-
|
|
237
|
-
Thread-safe: This method uses internal locking to ensure safe concurrent access.
|
|
238
|
-
|
|
239
|
-
Returns:
|
|
240
|
-
Number of outputs that were cleared.
|
|
241
|
-
"""
|
|
242
|
-
def clear_thread_outputs(self, thread_id: str) -> int:
|
|
243
|
-
"""Clear all stored outputs for a specific thread.
|
|
244
|
-
|
|
245
|
-
Thread-safe: This method uses internal locking to ensure safe concurrent access.
|
|
246
|
-
|
|
247
|
-
Args:
|
|
248
|
-
thread_id: The thread ID to clear outputs for.
|
|
249
|
-
|
|
250
|
-
Returns:
|
|
251
|
-
Number of outputs that were cleared for the thread.
|
|
252
|
-
"""
|
|
253
|
-
def clear_all(self) -> None:
|
|
254
|
-
"""Clear all stored outputs from both metadata and storage.
|
|
255
|
-
|
|
256
|
-
Warning:
|
|
257
|
-
This operation is irreversible and will remove all stored tool outputs.
|
|
258
|
-
"""
|
|
259
|
-
def get_storage_stats(self) -> dict[str, Any]:
|
|
260
|
-
"""Get storage statistics for monitoring and debugging.
|
|
261
|
-
|
|
262
|
-
Returns:
|
|
263
|
-
Dictionary containing storage statistics.
|
|
264
|
-
"""
|
|
265
|
-
|
|
266
|
-
class ToolReferenceResolver:
|
|
267
|
-
"""Secure and efficient tool output reference resolution system.
|
|
268
|
-
|
|
269
|
-
This class handles the resolution of tool output references in a secure manner,
|
|
270
|
-
preventing injection attacks while providing simple and reliable access to
|
|
271
|
-
stored tool outputs. It uses a whitelist approach with regex validation to
|
|
272
|
-
ensure only safe references are processed.
|
|
273
|
-
|
|
274
|
-
Security Features:
|
|
275
|
-
- Strict regex pattern matching for reference syntax
|
|
276
|
-
- Whitelist-based validation to prevent injection attacks
|
|
277
|
-
- Fail-fast error handling with detailed error messages
|
|
278
|
-
- Input sanitization and validation at multiple levels
|
|
279
|
-
|
|
280
|
-
Supported Reference Syntax:
|
|
281
|
-
- $tool_output.<call_id> - Direct reference to a tool output by call ID
|
|
282
|
-
|
|
283
|
-
Attributes:
|
|
284
|
-
config: Configuration object for operational parameters.
|
|
285
|
-
"""
|
|
286
|
-
config: Incomplete
|
|
287
|
-
def __init__(self, config: ToolOutputConfig) -> None:
|
|
288
|
-
"""Initialize the ToolReferenceResolver with security configuration.
|
|
289
|
-
|
|
290
|
-
Args:
|
|
291
|
-
config: Configuration object defining operational parameters.
|
|
292
|
-
"""
|
|
293
|
-
def resolve_references(self, args: dict[str, Any], manager: ToolOutputManager, thread_id: str | None = None) -> dict[str, Any]:
|
|
294
|
-
"""Resolve all tool output references in the given arguments dictionary.
|
|
295
|
-
|
|
296
|
-
This method recursively processes a dictionary of tool arguments, finding
|
|
297
|
-
and resolving any tool output references. It supports nested dictionaries
|
|
298
|
-
and lists, providing comprehensive reference resolution.
|
|
299
|
-
|
|
300
|
-
Args:
|
|
301
|
-
args: Dictionary of tool arguments that may contain references.
|
|
302
|
-
manager: ToolOutputManager instance to resolve references against.
|
|
303
|
-
thread_id: Optional thread ID for context-aware resolution.
|
|
304
|
-
|
|
305
|
-
Returns:
|
|
306
|
-
New dictionary with all references resolved to their actual values.
|
|
307
|
-
|
|
308
|
-
Raises:
|
|
309
|
-
ToolReferenceError: If any reference is invalid or cannot be resolved.
|
|
310
|
-
"""
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from _typeshed import Incomplete
|
|
3
|
-
|
|
4
|
-
BOSA_CORE_AVAILABLE: bool
|
|
5
|
-
DEFAULT_LOG_FORMAT: Incomplete
|
|
6
|
-
DEFAULT_DATE_FORMAT: str
|
|
7
|
-
LOG_COLORS: Incomplete
|
|
8
|
-
MAX_LOG_COLORS_LENGTH: Incomplete
|
|
9
|
-
TRUNCATED_MESSAGE: str
|
|
10
|
-
MAX_MESSAGE_LENGTH: Incomplete
|
|
11
|
-
|
|
12
|
-
class StandardizedFormatter(logging.Formatter):
|
|
13
|
-
"""Custom formatter that outputs logs in standardized JSON format with colors.
|
|
14
|
-
|
|
15
|
-
Follows the standardized log format:
|
|
16
|
-
- level: string (e.g., INFO, ERROR)
|
|
17
|
-
- timestamp: ISO 8601 with timezone (e.g., 2025-07-23T00:29:05.091Z)
|
|
18
|
-
- message: string (the content of the log) (max 500000 context length)
|
|
19
|
-
- error: object (for error logs only)
|
|
20
|
-
- message: string (the error message)
|
|
21
|
-
- code: string (specific error code)
|
|
22
|
-
- stacktrace: string (the stack trace for debugging)
|
|
23
|
-
"""
|
|
24
|
-
def format(self, record: logging.LogRecord) -> str:
|
|
25
|
-
"""Format the log record in standardized JSON format with colors.
|
|
26
|
-
|
|
27
|
-
Args:
|
|
28
|
-
record (logging.LogRecord): The log record to be formatted.
|
|
29
|
-
|
|
30
|
-
Returns:
|
|
31
|
-
str: The formatted log message in JSON format.
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
class ColoredFormatter(logging.Formatter):
|
|
35
|
-
"""Custom formatter to add colors based on log level."""
|
|
36
|
-
def format(self, record: logging.LogRecord) -> str:
|
|
37
|
-
"""Format the log record with colors based on log level.
|
|
38
|
-
|
|
39
|
-
Args:
|
|
40
|
-
record (logging.LogRecord): The log record to be formatted.
|
|
41
|
-
|
|
42
|
-
Returns:
|
|
43
|
-
str: The formatted log message with color codes.
|
|
44
|
-
"""
|
|
45
|
-
|
|
46
|
-
class LoggerManager:
|
|
47
|
-
'''A singleton class to manage logging configuration.
|
|
48
|
-
|
|
49
|
-
This class ensures that the root logger is initialized only once and is used across the application.
|
|
50
|
-
Supports both traditional colored output and standardized format with colors.
|
|
51
|
-
|
|
52
|
-
Example to get and use the logger:
|
|
53
|
-
```python
|
|
54
|
-
manager = LoggerManager()
|
|
55
|
-
|
|
56
|
-
logger = manager.get_logger()
|
|
57
|
-
|
|
58
|
-
logger.info("This is an info message")
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Example to set logging configuration:
|
|
62
|
-
```python
|
|
63
|
-
manager = LoggerManager()
|
|
64
|
-
|
|
65
|
-
manager.set_level(logging.DEBUG)
|
|
66
|
-
manager.set_output_format("traditional") # or "standardized"
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Example to add a custom handler:
|
|
70
|
-
```python
|
|
71
|
-
manager = LoggerManager()
|
|
72
|
-
|
|
73
|
-
handler = logging.FileHandler("app.log")
|
|
74
|
-
manager.add_handler(handler)
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Output format examples:
|
|
78
|
-
|
|
79
|
-
Traditional format:
|
|
80
|
-
```python
|
|
81
|
-
[16/04/2025 15:08:18.323 GDPLabsGenAILogger INFO] Loading prompt_builder catalog for chatbot `general-purpose`
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Standardized format:
|
|
85
|
-
```json
|
|
86
|
-
{
|
|
87
|
-
"level": "INFO",
|
|
88
|
-
"timestamp": "2025-07-23T00:29:05.091Z",
|
|
89
|
-
"message": "Loading prompt_builder catalog for chatbot `general-purpose`"
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Error standardized format:
|
|
94
|
-
```json
|
|
95
|
-
{
|
|
96
|
-
"level": "ERROR",
|
|
97
|
-
"timestamp": "2025-07-23T00:29:05.091Z",
|
|
98
|
-
"message": "Failed to load configuration",
|
|
99
|
-
"error": {
|
|
100
|
-
"message": "Configuration file not found",
|
|
101
|
-
"code": "CONFIG_NOT_FOUND",
|
|
102
|
-
"stacktrace": "Traceback (most recent call last):..."
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
'''
|
|
107
|
-
def __new__(cls):
|
|
108
|
-
"""Initialize the singleton instance."""
|
|
109
|
-
def get_logger(self, name: str | None = None) -> logging.Logger:
|
|
110
|
-
"""Get a logger instance.
|
|
111
|
-
|
|
112
|
-
This method returns a logger instance that is a child of the root logger. If name is not provided,
|
|
113
|
-
the root logger will be returned instead.
|
|
114
|
-
|
|
115
|
-
Args:
|
|
116
|
-
name (str | None, optional): The name of the child logger.
|
|
117
|
-
If None, the root logger will be returned. Defaults to None.
|
|
118
|
-
|
|
119
|
-
Returns:
|
|
120
|
-
logging.Logger: Configured logger instance.
|
|
121
|
-
"""
|
|
122
|
-
def set_level(self, level: int) -> None:
|
|
123
|
-
"""Set logging level for all loggers in the hierarchy.
|
|
124
|
-
|
|
125
|
-
Args:
|
|
126
|
-
level (int): The logging level to set (e.g., logging.INFO, logging.DEBUG).
|
|
127
|
-
"""
|
|
128
|
-
def set_output_format(self, output_format: str) -> None:
|
|
129
|
-
'''Set the output format for all loggers in the hierarchy.
|
|
130
|
-
|
|
131
|
-
Args:
|
|
132
|
-
output_format (str): The output format to set. Must be either "standardized" or "traditional".
|
|
133
|
-
'''
|
|
134
|
-
def set_log_format(self, log_format: str) -> None:
|
|
135
|
-
"""Set logging format for all loggers in the hierarchy (traditional mode only).
|
|
136
|
-
|
|
137
|
-
Args:
|
|
138
|
-
log_format (str): The log format to set.
|
|
139
|
-
"""
|
|
140
|
-
def set_date_format(self, date_format: str) -> None:
|
|
141
|
-
"""Set date format for all loggers in the hierarchy (traditional mode only).
|
|
142
|
-
|
|
143
|
-
Args:
|
|
144
|
-
date_format (str): The date format to set.
|
|
145
|
-
"""
|
|
146
|
-
def add_handler(self, handler: logging.Handler) -> None:
|
|
147
|
-
"""Add a custom handler to the root logger.
|
|
148
|
-
|
|
149
|
-
Args:
|
|
150
|
-
handler (logging.Handler): The handler to add to the root logger.
|
|
151
|
-
"""
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from aip_agents.utils.logger_manager import LoggerManager as LoggerManager
|
|
3
|
-
from aip_agents.utils.token_usage_helper import STEP_USAGE_KEY as STEP_USAGE_KEY, TOTAL_USAGE_KEY as TOTAL_USAGE_KEY
|
|
4
|
-
from enum import StrEnum
|
|
5
|
-
from typing import Any
|
|
6
|
-
|
|
7
|
-
logger: Incomplete
|
|
8
|
-
THINKING_DATA_TYPE: str
|
|
9
|
-
DEFAULT_STEP_INDICATOR_MESSAGE: str
|
|
10
|
-
FINAL_AGENT_THINKING_FINISHED_CONTENT: str
|
|
11
|
-
FINAL_THINKING_AND_ACTIVITY_INFO: Incomplete
|
|
12
|
-
DEFAULT_THINKING_AND_ACTIVITY_INFO: Incomplete
|
|
13
|
-
TOOL_EXECUTION_RUNNING_TEMPLATE: str
|
|
14
|
-
TOOL_EXECUTION_COMPLETE_TEMPLATE: str
|
|
15
|
-
SUBAGENT_DELEGATION_TEMPLATE: str
|
|
16
|
-
SUBAGENT_COMPLETE_TEMPLATE: str
|
|
17
|
-
MIXED_EXECUTION_TEMPLATE: str
|
|
18
|
-
DELEGATE_PREFIX: str
|
|
19
|
-
|
|
20
|
-
class Kind(StrEnum):
|
|
21
|
-
"""Constants for metadata kind values."""
|
|
22
|
-
AGENT_STEP = 'agent_step'
|
|
23
|
-
AGENT_THINKING_STEP = 'agent_thinking_step'
|
|
24
|
-
FINAL_RESPONSE = 'final_response'
|
|
25
|
-
FINAL_THINKING_STEP = 'final_agent_thinking_step'
|
|
26
|
-
AGENT_DEFAULT = 'agent_default'
|
|
27
|
-
|
|
28
|
-
class Status(StrEnum):
|
|
29
|
-
"""Constants for metadata status values."""
|
|
30
|
-
RUNNING = 'running'
|
|
31
|
-
FINISHED = 'finished'
|
|
32
|
-
STOPPED = 'stopped'
|
|
33
|
-
|
|
34
|
-
class MetadataFieldKeys(StrEnum):
|
|
35
|
-
"""Enumeration of standard metadata field keys used in A2A events."""
|
|
36
|
-
KIND = 'kind'
|
|
37
|
-
STATUS = 'status'
|
|
38
|
-
TIME = 'time'
|
|
39
|
-
MESSAGE = 'message'
|
|
40
|
-
TOOL_INFO = 'tool_info'
|
|
41
|
-
REFERENCES = 'references'
|
|
42
|
-
THINKING_AND_ACTIVITY_INFO = 'thinking_and_activity_info'
|
|
43
|
-
STEP_USAGE = STEP_USAGE_KEY
|
|
44
|
-
TOTAL_USAGE = TOTAL_USAGE_KEY
|
|
45
|
-
|
|
46
|
-
class MetadataTimeTracker:
|
|
47
|
-
"""Tracks cumulative execution time across agent steps for final response metadata.
|
|
48
|
-
|
|
49
|
-
This class provides a clean way to accumulate execution times from individual
|
|
50
|
-
agent steps and apply the total time to final response metadata.
|
|
51
|
-
"""
|
|
52
|
-
def __init__(self) -> None:
|
|
53
|
-
"""Initialize the time tracker with zero accumulated time."""
|
|
54
|
-
def update_response_metadata(self, response: dict[str, Any]) -> dict[str, Any]:
|
|
55
|
-
"""Update response metadata with accumulated time tracking.
|
|
56
|
-
|
|
57
|
-
Args:
|
|
58
|
-
response: Response dictionary containing metadata
|
|
59
|
-
|
|
60
|
-
Returns:
|
|
61
|
-
Response with updated metadata for final responses. If any error occurs,
|
|
62
|
-
returns the original response unchanged.
|
|
63
|
-
"""
|
|
64
|
-
|
|
65
|
-
def detect_agent_step_content(content: str, default_kind: str, tool_calls: Any | None = None) -> str:
|
|
66
|
-
"""Detect if content corresponds to agent step patterns from LangGraph.
|
|
67
|
-
|
|
68
|
-
Args:
|
|
69
|
-
content: The content to detect.
|
|
70
|
-
default_kind: The default kind to return if the content does not match any of the patterns.
|
|
71
|
-
tool_calls: The tool calls to detect.
|
|
72
|
-
|
|
73
|
-
Returns:
|
|
74
|
-
The kind of the content.
|
|
75
|
-
"""
|
|
76
|
-
def create_metadata(content: str = '', kind: Kind = ..., status: Status = ..., tool_calls: Any | None = None, is_final: bool = False, time: float | None = None, existing_metadata: dict[str, Any] | None = None) -> dict[str, Any]:
|
|
77
|
-
"""Create metadata for A2A responses with content-based message.
|
|
78
|
-
|
|
79
|
-
Args:
|
|
80
|
-
content: The content to create metadata for.
|
|
81
|
-
kind: The kind of the content.
|
|
82
|
-
status: The status of the content.
|
|
83
|
-
tool_calls: The tool calls to create metadata for.
|
|
84
|
-
is_final: Whether the content is final.
|
|
85
|
-
time: The time of the content.
|
|
86
|
-
existing_metadata: Optional existing metadata to merge with. Existing metadata
|
|
87
|
-
takes precedence over generated metadata for conflicting keys.
|
|
88
|
-
|
|
89
|
-
Returns:
|
|
90
|
-
The metadata for the content, merged with existing metadata if provided.
|
|
91
|
-
"""
|
|
92
|
-
def create_tool_processing_metadata(original_metadata: dict[str, Any] | None = None) -> dict[str, Any]:
|
|
93
|
-
"""Create metadata for tool processing events (tool_call and tool_result).
|
|
94
|
-
|
|
95
|
-
Args:
|
|
96
|
-
original_metadata: Optional original metadata to merge with.
|
|
97
|
-
|
|
98
|
-
Returns:
|
|
99
|
-
Metadata dictionary with agent_thinking_step kind and no message/time/status.
|
|
100
|
-
"""
|
|
101
|
-
def create_status_update_metadata(content: str, custom_metadata: dict[str, Any] | None = None) -> dict[str, Any]:
|
|
102
|
-
"""Create metadata for status update events with content-based rules.
|
|
103
|
-
|
|
104
|
-
Args:
|
|
105
|
-
content: The content of the status update.
|
|
106
|
-
custom_metadata: Optional custom metadata to merge with.
|
|
107
|
-
|
|
108
|
-
Returns:
|
|
109
|
-
Metadata dictionary following the specific rules for different content types.
|
|
110
|
-
"""
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
from aip_agents.utils.name_preprocessor.base_name_preprocessor import BaseNamePreprocessor as BaseNamePreprocessor
|
|
2
|
-
from aip_agents.utils.name_preprocessor.google_name_preprocessor import GoogleNamePreprocessor as GoogleNamePreprocessor
|
|
3
|
-
from aip_agents.utils.name_preprocessor.name_preprocessor import NamePreprocessor as NamePreprocessor
|
|
4
|
-
from aip_agents.utils.name_preprocessor.openai_name_preprocessor import OpenAINamePreprocessor as OpenAINamePreprocessor
|
|
5
|
-
|
|
6
|
-
__all__ = ['GoogleNamePreprocessor', 'OpenAINamePreprocessor', 'BaseNamePreprocessor', 'NamePreprocessor']
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from aip_agents.utils.logger_manager import LoggerManager as LoggerManager
|
|
3
|
-
from aip_agents.utils.name_preprocessor import BaseNamePreprocessor as BaseNamePreprocessor
|
|
4
|
-
|
|
5
|
-
logger: Incomplete
|
|
6
|
-
|
|
7
|
-
class GoogleNamePreprocessor(BaseNamePreprocessor):
|
|
8
|
-
"""Concrete implementation of NamePreprocessor according to Google's name requirements."""
|
|
9
|
-
NAME_SETTINGS: Incomplete
|
|
10
|
-
CUT_OFF_INDEX: int
|
|
11
|
-
def sanitize_agent_name(self, name: str) -> str:
|
|
12
|
-
"""Preprocess an input name according to Google's name requirements for agents.
|
|
13
|
-
|
|
14
|
-
Args:
|
|
15
|
-
name: The input name to preprocess.
|
|
16
|
-
|
|
17
|
-
Returns:
|
|
18
|
-
A name that is valid for Google.
|
|
19
|
-
|
|
20
|
-
Notes:
|
|
21
|
-
Name should start with a letter (a-z, A-Z) or an underscore (_),
|
|
22
|
-
and can only contain letters, digits (0-9), and underscores.
|
|
23
|
-
It has no length limit. ( based on experiment )
|
|
24
|
-
"""
|
|
25
|
-
def sanitize_tool_name(self, name: str) -> str:
|
|
26
|
-
"""Preprocess an input name according to Google's name requirements for tools.
|
|
27
|
-
|
|
28
|
-
Args:
|
|
29
|
-
name: The input name to preprocess.
|
|
30
|
-
|
|
31
|
-
Returns:
|
|
32
|
-
A name that is valid for Google.
|
|
33
|
-
|
|
34
|
-
Notes:
|
|
35
|
-
Name should start with a letter (a-z, A-Z) or an underscore (_),
|
|
36
|
-
and can only contain letters, digits (0-9), underscores, and dashes.
|
|
37
|
-
It has a length limit of 64 characters, but google throws error if the length is exactly 64, so cut to 63.
|
|
38
|
-
"""
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
from .base_name_preprocessor import BaseNamePreprocessor as BaseNamePreprocessor
|
|
2
|
-
from .google_name_preprocessor import GoogleNamePreprocessor as GoogleNamePreprocessor
|
|
3
|
-
from .openai_name_preprocessor import OpenAINamePreprocessor as OpenAINamePreprocessor
|
|
4
|
-
from _typeshed import Incomplete
|
|
5
|
-
from aip_agents.utils.logger_manager import LoggerManager as LoggerManager
|
|
6
|
-
|
|
7
|
-
logger: Incomplete
|
|
8
|
-
|
|
9
|
-
class NamePreprocessor:
|
|
10
|
-
"""Name Preprocessor for Google ADK and OpenAI compatible models.
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
provider: The provider of the model.
|
|
14
|
-
"""
|
|
15
|
-
PROVIDER_TO_NAME_PREPROCESSOR_MAP: Incomplete
|
|
16
|
-
provider: Incomplete
|
|
17
|
-
preprocessor: Incomplete
|
|
18
|
-
def __init__(self, provider: str) -> None:
|
|
19
|
-
"""Initialize the name preprocessor.
|
|
20
|
-
|
|
21
|
-
Args:
|
|
22
|
-
provider: The provider of the model.
|
|
23
|
-
"""
|
|
24
|
-
def sanitize_agent_name(self, name: str) -> str:
|
|
25
|
-
"""Preprocess an input name according to the rules of the name processor.
|
|
26
|
-
|
|
27
|
-
Args:
|
|
28
|
-
name: The input name to preprocess.
|
|
29
|
-
|
|
30
|
-
Returns:
|
|
31
|
-
A name that is valid for the name processor.
|
|
32
|
-
"""
|
|
33
|
-
def sanitize_tool_name(self, name: str) -> str:
|
|
34
|
-
"""Preprocess an input name according to the rules of the name processor.
|
|
35
|
-
|
|
36
|
-
Args:
|
|
37
|
-
name: The input name to preprocess.
|
|
38
|
-
|
|
39
|
-
Returns:
|
|
40
|
-
A name that is valid for the name processor.
|
|
41
|
-
"""
|