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,45 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from aip_agents.tools.base import BaseTool as BaseTool
|
|
3
|
-
from aip_agents.types import AgentProtocol as AgentProtocol
|
|
4
|
-
from gllm_core.event import EventEmitter as EventEmitter
|
|
5
|
-
from pydantic import BaseModel
|
|
6
|
-
from typing import Any
|
|
7
|
-
|
|
8
|
-
class NestedAgentTool(BaseTool):
|
|
9
|
-
"""Tool for wrapping an agent as a tool for use by another agent.
|
|
10
|
-
|
|
11
|
-
This allows agents to delegate tasks to other specialized agents.
|
|
12
|
-
The wrapped agent must conform to the AgentProtocol interface.
|
|
13
|
-
|
|
14
|
-
Attributes:
|
|
15
|
-
name: The name of the tool (derived from the agent's name).
|
|
16
|
-
description: The description of the tool (derived from the agent's description).
|
|
17
|
-
nested_agent: The agent to wrap as a tool.
|
|
18
|
-
return_direct: Whether to return the result directly to the parent agent without
|
|
19
|
-
additional processing. When True, the parent agent will receive the nested
|
|
20
|
-
agent's response directly rather than incorporating it into its reasoning.
|
|
21
|
-
logger: Logger for tracking tool execution.
|
|
22
|
-
"""
|
|
23
|
-
name: str
|
|
24
|
-
description: str
|
|
25
|
-
nested_agent: AgentProtocol
|
|
26
|
-
return_direct: bool
|
|
27
|
-
logger: logging.Logger | None
|
|
28
|
-
class ArgsSchema(BaseModel):
|
|
29
|
-
"""ArgsSchema is a Pydantic model that defines the schema for the arguments required by the nested agent.
|
|
30
|
-
|
|
31
|
-
Attributes:
|
|
32
|
-
query (str): User query to delegate to the nested agent. This field is required.
|
|
33
|
-
"""
|
|
34
|
-
query: str
|
|
35
|
-
args_schema: type[BaseModel]
|
|
36
|
-
def __init__(self, nested_agent: AgentProtocol, **kwargs: Any) -> None:
|
|
37
|
-
"""Initialize the Tool class with an agent and additional data.
|
|
38
|
-
|
|
39
|
-
Args:
|
|
40
|
-
nested_agent (AgentProtocol): The agent instance to be wrapped.
|
|
41
|
-
**kwargs (Any): Additional keyword arguments to pass to the parent constructor.
|
|
42
|
-
|
|
43
|
-
Raises:
|
|
44
|
-
ValueError: If the provided agent doesn't conform to AgentProtocol.
|
|
45
|
-
"""
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from langchain_core.tools import BaseTool
|
|
2
|
-
from pydantic import BaseModel
|
|
3
|
-
from typing import TypeVar
|
|
4
|
-
|
|
5
|
-
__all__ = ['inject_config_methods_into_tool', 'CONFIG_SCHEMA_ATTR', 'CONFIG_ATTR', 'TOOL_CONFIG_SCHEMA_ATTR', 'TOOL_CONFIGS_KEY']
|
|
6
|
-
|
|
7
|
-
ConfigSchema = TypeVar('ConfigSchema', bound=BaseModel)
|
|
8
|
-
CONFIG_SCHEMA_ATTR: str
|
|
9
|
-
CONFIG_ATTR: str
|
|
10
|
-
TOOL_CONFIG_SCHEMA_ATTR: str
|
|
11
|
-
TOOL_CONFIGS_KEY: str
|
|
12
|
-
|
|
13
|
-
def inject_config_methods_into_tool(tool: BaseTool, config_schema: type[ConfigSchema]) -> None:
|
|
14
|
-
"""Inject configuration methods into a tool.
|
|
15
|
-
|
|
16
|
-
This function is used by the SDK to automatically inject configuration capabilities
|
|
17
|
-
into tools that have a tool_config_schema attribute. It can also be used directly
|
|
18
|
-
by developers who want to add configuration support to their tools.
|
|
19
|
-
|
|
20
|
-
Args:
|
|
21
|
-
tool: The tool to inject configuration capabilities into.
|
|
22
|
-
config_schema: Pydantic model class for configuration validation.
|
|
23
|
-
|
|
24
|
-
Raises:
|
|
25
|
-
ValueError: If tool is not a BaseTool instance or config_schema is not a Pydantic BaseModel subclass.
|
|
26
|
-
"""
|
aip_agents/types/__init__.pyi
DELETED
aip_agents/types/a2a_events.pyi
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
from typing import Any
|
|
3
|
-
from typing_extensions import TypedDict
|
|
4
|
-
|
|
5
|
-
class A2AStreamEventType(Enum):
|
|
6
|
-
"""Semantic event types for A2A agent-executor communication.
|
|
7
|
-
|
|
8
|
-
These event types preserve the semantic meaning of LangChain message types
|
|
9
|
-
and eliminate the need for string-based content classification downstream.
|
|
10
|
-
"""
|
|
11
|
-
STATUS_UPDATE = 'status_update'
|
|
12
|
-
CONTENT_CHUNK = 'content_chunk'
|
|
13
|
-
FINAL_RESPONSE = 'final_response'
|
|
14
|
-
TOOL_CALL = 'tool_call'
|
|
15
|
-
TOOL_RESULT = 'tool_result'
|
|
16
|
-
ERROR = 'error'
|
|
17
|
-
|
|
18
|
-
class A2AEvent(TypedDict):
|
|
19
|
-
"""Structured event data for A2A agent-executor communication.
|
|
20
|
-
|
|
21
|
-
This TypedDict replaces the generic dictionary format previously used,
|
|
22
|
-
providing type safety and semantic clarity for agent streaming events.
|
|
23
|
-
|
|
24
|
-
Attributes:
|
|
25
|
-
event_type: The semantic type of this event (tool call, content, etc.).
|
|
26
|
-
content: The main text content of the event.
|
|
27
|
-
metadata: Additional metadata associated with the event.
|
|
28
|
-
tool_info: Tool-specific information (only present for tool-related events).
|
|
29
|
-
is_final: Whether this event represents the final output.
|
|
30
|
-
artifacts: List of artifacts generated by tools or agents.
|
|
31
|
-
references: Reference data from tools that support reference collection.
|
|
32
|
-
step_usage: Usage metadata associated with the event.
|
|
33
|
-
total_usage: Accumulated usage metadata associated with the event.
|
|
34
|
-
"""
|
|
35
|
-
event_type: A2AStreamEventType
|
|
36
|
-
content: str
|
|
37
|
-
metadata: dict[str, Any]
|
|
38
|
-
tool_info: dict[str, Any] | None
|
|
39
|
-
is_final: bool
|
|
40
|
-
artifacts: list[dict[str, Any]] | None
|
|
41
|
-
references: list[Any] | None
|
|
42
|
-
step_usage: dict[str, Any] | None
|
|
43
|
-
total_usage: dict[str, Any] | None
|
|
44
|
-
thinking_and_activity_info: dict[str, Any] | None
|
|
45
|
-
|
|
46
|
-
class ToolCallInfo(TypedDict):
|
|
47
|
-
'''Structured information for tool invocation events.
|
|
48
|
-
|
|
49
|
-
This provides a standardized format for tool call information,
|
|
50
|
-
eliminating the need for JSON encoding/decoding.
|
|
51
|
-
|
|
52
|
-
Attributes:
|
|
53
|
-
tool_calls: List of tool calls with names and arguments.
|
|
54
|
-
status: Current status of the tool invocation ("running", "finished").
|
|
55
|
-
'''
|
|
56
|
-
tool_calls: list[dict[str, Any]]
|
|
57
|
-
status: str
|
|
58
|
-
|
|
59
|
-
class ToolResultInfo(TypedDict):
|
|
60
|
-
"""Structured information for tool completion events.
|
|
61
|
-
|
|
62
|
-
This provides a standardized format for tool execution results,
|
|
63
|
-
eliminating the need for JSON encoding/decoding.
|
|
64
|
-
|
|
65
|
-
Attributes:
|
|
66
|
-
name: Name of the executed tool.
|
|
67
|
-
args: Arguments passed to the tool.
|
|
68
|
-
output: Output returned by the tool.
|
|
69
|
-
execution_time: Time taken for tool execution in seconds.
|
|
70
|
-
"""
|
|
71
|
-
name: str
|
|
72
|
-
args: dict[str, Any]
|
|
73
|
-
output: str
|
|
74
|
-
execution_time: float | None
|
aip_agents/utils/__init__.pyi
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
from aip_agents.utils.artifact_helpers import create_artifact_command as create_artifact_command, create_artifact_response as create_artifact_response, create_error_response as create_error_response, create_multiple_artifacts_command as create_multiple_artifacts_command, create_text_artifact_response as create_text_artifact_response
|
|
2
|
-
from aip_agents.utils.logger_manager import LoggerManager as LoggerManager
|
|
3
|
-
from aip_agents.utils.reference_helper import add_references_chunks as add_references_chunks, serialize_references_for_metadata as serialize_references_for_metadata, validate_references as validate_references
|
|
4
|
-
|
|
5
|
-
__all__ = ['LoggerManager', 'create_artifact_response', 'create_error_response', 'create_artifact_command', 'create_multiple_artifacts_command', 'create_text_artifact_response', 'validate_references', 'serialize_references_for_metadata', 'add_references_chunks']
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from a2a.types import AgentCard as AgentCard
|
|
3
|
-
from aip_agents.utils.logger_manager import LoggerManager as LoggerManager
|
|
4
|
-
from aip_agents.utils.metadata_helper import Kind as Kind, MetadataTimeTracker as MetadataTimeTracker, Status as Status, create_metadata as create_metadata, create_status_update_metadata as create_status_update_metadata, create_tool_processing_metadata as create_tool_processing_metadata
|
|
5
|
-
from pydantic import BaseModel
|
|
6
|
-
from typing import Any, AsyncGenerator
|
|
7
|
-
|
|
8
|
-
logger: Incomplete
|
|
9
|
-
|
|
10
|
-
class ArtifactInfo(BaseModel):
|
|
11
|
-
"""Structured artifact information for A2A communication.
|
|
12
|
-
|
|
13
|
-
This Pydantic model provides type safety and validation for artifact data
|
|
14
|
-
exchanged between agents through the A2A protocol.
|
|
15
|
-
"""
|
|
16
|
-
artifact_id: str | None
|
|
17
|
-
name: str | None
|
|
18
|
-
content_type: str | None
|
|
19
|
-
mime_type: str | None
|
|
20
|
-
file_name: str | None
|
|
21
|
-
has_file_data: bool
|
|
22
|
-
has_file_uri: bool
|
|
23
|
-
file_data: str | None
|
|
24
|
-
file_uri: str | None
|
|
25
|
-
description: str | None
|
|
26
|
-
parts: int | None
|
|
27
|
-
|
|
28
|
-
class A2AConnector:
|
|
29
|
-
"""Handles A2A protocol communication between agents.
|
|
30
|
-
|
|
31
|
-
This class provides methods for sending messages to other agents using the A2A protocol,
|
|
32
|
-
supporting both synchronous and asynchronous communication patterns, as well as streaming
|
|
33
|
-
responses with immediate artifact event handling.
|
|
34
|
-
"""
|
|
35
|
-
@staticmethod
|
|
36
|
-
def send_to_agent(agent_card: AgentCard, message: str | dict[str, Any], **kwargs: Any) -> dict[str, Any]:
|
|
37
|
-
"""Synchronously sends a message to another agent using the A2A protocol.
|
|
38
|
-
|
|
39
|
-
This method is a synchronous wrapper around asend_to_agent. It handles the creation
|
|
40
|
-
of an event loop if one doesn't exist, and manages the asynchronous call internally.
|
|
41
|
-
|
|
42
|
-
Args:
|
|
43
|
-
agent_card: The AgentCard instance containing the target agent's details including
|
|
44
|
-
URL, authentication requirements, and capabilities.
|
|
45
|
-
message: The message to send to the agent. Can be either a string for simple text
|
|
46
|
-
messages or a dictionary for structured data.
|
|
47
|
-
**kwargs: Additional keyword arguments passed to asend_to_agent.
|
|
48
|
-
|
|
49
|
-
Returns:
|
|
50
|
-
A dictionary containing the response details:
|
|
51
|
-
- status (str): 'success' or 'error'
|
|
52
|
-
- content (str): Extracted text content from the response
|
|
53
|
-
- task_id (str, optional): ID of the created/updated task
|
|
54
|
-
- task_state (str, optional): Current state of the task
|
|
55
|
-
- raw_response (str): Complete JSON response from the A2A client
|
|
56
|
-
- error_type (str, optional): Type of error if status is 'error'
|
|
57
|
-
- message (str, optional): Error message if status is 'error'
|
|
58
|
-
|
|
59
|
-
Raises:
|
|
60
|
-
RuntimeError: If asend_to_agent encounters an unhandled exception.
|
|
61
|
-
"""
|
|
62
|
-
@staticmethod
|
|
63
|
-
async def asend_to_agent(agent_card: AgentCard, message: str | dict[str, Any], **kwargs: Any) -> dict[str, Any]:
|
|
64
|
-
'''Asynchronously sends a message to another agent using the A2A protocol.
|
|
65
|
-
|
|
66
|
-
This method uses the streaming approach internally but only returns the final response,
|
|
67
|
-
avoiding direct httpx usage that can cause issues with Nuitka compilation.
|
|
68
|
-
|
|
69
|
-
Args:
|
|
70
|
-
agent_card: The AgentCard instance containing the target agent\'s details including
|
|
71
|
-
URL, authentication requirements, and capabilities.
|
|
72
|
-
message: The message to send to the agent. Can be either a string for simple text
|
|
73
|
-
messages or a dictionary for structured data.
|
|
74
|
-
**kwargs: Additional keyword arguments.
|
|
75
|
-
|
|
76
|
-
Returns:
|
|
77
|
-
A dictionary containing the final response with the simplified structure:
|
|
78
|
-
- status (str): "success" or "error"
|
|
79
|
-
- task_state (str): Final A2A TaskState value
|
|
80
|
-
- content (str): Final text content from the agent
|
|
81
|
-
- task_id (str): ID of the associated task
|
|
82
|
-
- context_id (str): Context ID of the task
|
|
83
|
-
- final (bool): Always True for final responses
|
|
84
|
-
- artifacts (list): List of all artifacts created during execution
|
|
85
|
-
|
|
86
|
-
Raises:
|
|
87
|
-
Exception: If there\'s an error during message sending or processing.
|
|
88
|
-
'''
|
|
89
|
-
@staticmethod
|
|
90
|
-
async def astream_to_agent(agent_card: AgentCard, message: str | dict[str, Any], **kwargs: Any) -> AsyncGenerator[dict[str, Any], None]:
|
|
91
|
-
'''Asynchronously sends a streaming message to another agent using the A2A protocol.
|
|
92
|
-
|
|
93
|
-
This method supports streaming responses from the target agent, yielding chunks of
|
|
94
|
-
the response as they become available. It handles the official A2A streaming event
|
|
95
|
-
types as defined in the specification.
|
|
96
|
-
|
|
97
|
-
Args:
|
|
98
|
-
agent_card: The AgentCard instance containing the target agent\'s details including
|
|
99
|
-
URL, authentication requirements, and capabilities.
|
|
100
|
-
message: The message to send to the agent. Can be either a string for simple text
|
|
101
|
-
messages or a dictionary for structured data.
|
|
102
|
-
**kwargs: Additional keyword arguments.
|
|
103
|
-
|
|
104
|
-
Yields:
|
|
105
|
-
Dictionaries containing streaming response chunks with a simplified structure:
|
|
106
|
-
|
|
107
|
-
For successful responses:
|
|
108
|
-
- status (str): "success" or "error"
|
|
109
|
-
- task_state (str): A2A TaskState value
|
|
110
|
-
- content (str): Text content from the agent
|
|
111
|
-
- task_id (str): ID of the associated task
|
|
112
|
-
- context_id (str): Context ID of the task
|
|
113
|
-
- final (bool): Whether this is the final update
|
|
114
|
-
- artifacts (list, optional): List of artifacts created in this step
|
|
115
|
-
|
|
116
|
-
Each artifact in the artifacts list contains:
|
|
117
|
-
- artifact_id (str): ID of the artifact
|
|
118
|
-
- name (str): Name of the artifact
|
|
119
|
-
- content_type (str): "text" or "file"
|
|
120
|
-
- mime_type (str): MIME type of the artifact
|
|
121
|
-
- file_name (str, optional): Name of the file for file artifacts
|
|
122
|
-
- has_file_data (bool): Whether file data is included
|
|
123
|
-
- has_file_uri (bool): Whether file URI is included
|
|
124
|
-
- file_data (str, optional): Base64 encoded file content
|
|
125
|
-
- file_uri (str, optional): URI reference to the file
|
|
126
|
-
|
|
127
|
-
For errors:
|
|
128
|
-
- status (str): "error"
|
|
129
|
-
- error_type (str): Type of error encountered
|
|
130
|
-
- message (str): Error description
|
|
131
|
-
|
|
132
|
-
Raises:
|
|
133
|
-
httpx.HTTPError: If there\'s an HTTP-related error during the streaming request.
|
|
134
|
-
Exception: For any other unexpected errors during message streaming or processing.
|
|
135
|
-
'''
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
from aip_agents.a2a.types import Artifact as Artifact, ArtifactType as ArtifactType, MimeType as MimeType, get_mime_type_from_filename as get_mime_type_from_filename
|
|
2
|
-
from langgraph.types import Command
|
|
3
|
-
from typing import Any
|
|
4
|
-
|
|
5
|
-
class ArtifactHandler:
|
|
6
|
-
"""Handler class for creating and managing artifacts in agent tools.
|
|
7
|
-
|
|
8
|
-
This class provides a clean, object-oriented interface for artifact creation
|
|
9
|
-
with built-in validation, deduplication, and standardized formatting.
|
|
10
|
-
"""
|
|
11
|
-
def __init__(self) -> None:
|
|
12
|
-
"""Initialize the ArtifactHandler."""
|
|
13
|
-
def create_file_artifact(self, result: str, artifact_data: bytes | str, artifact_name: str, artifact_description: str = '', mime_type: str | None = None, enable_deduplication: bool = True) -> dict[str, Any]:
|
|
14
|
-
"""Deprecated. Use create_artifact instead."""
|
|
15
|
-
def create_text_artifact(self, result: str, artifact_text: str, artifact_name: str, artifact_description: str = '', mime_type: str | None = None, enable_deduplication: bool = True) -> dict[str, Any]:
|
|
16
|
-
"""Deprecated. Use create_artifact instead."""
|
|
17
|
-
def create_artifact(self, result: str, data: bytes | str, artifact_name: str, artifact_description: str = '', mime_type: str | None = None, enable_deduplication: bool = True) -> dict[str, Any]:
|
|
18
|
-
"""Create an artifact with automatic text/binary handling.
|
|
19
|
-
|
|
20
|
-
Args:
|
|
21
|
-
result: The message/result to show to the agent.
|
|
22
|
-
data: The data for the artifact. Bytes for binary; str for text or base64.
|
|
23
|
-
artifact_name: The filename to present to users.
|
|
24
|
-
artifact_description: Description of the artifact.
|
|
25
|
-
mime_type: Optional MIME type. If None, inferred from filename.
|
|
26
|
-
enable_deduplication: Whether to deduplicate by content hash.
|
|
27
|
-
|
|
28
|
-
Returns:
|
|
29
|
-
Dictionary with 'result' and 'artifact' keys.
|
|
30
|
-
"""
|
|
31
|
-
def create_error_response(self, error_message: str) -> str:
|
|
32
|
-
"""Create a standardized error response for tools.
|
|
33
|
-
|
|
34
|
-
Args:
|
|
35
|
-
error_message: The error message to return.
|
|
36
|
-
|
|
37
|
-
Returns:
|
|
38
|
-
String with error information.
|
|
39
|
-
"""
|
|
40
|
-
def clear_cache(self) -> None:
|
|
41
|
-
"""Clear the artifact cache."""
|
|
42
|
-
def get_cache_size(self) -> int:
|
|
43
|
-
"""Get the number of cached artifacts.
|
|
44
|
-
|
|
45
|
-
Returns:
|
|
46
|
-
Number of artifacts in cache.
|
|
47
|
-
"""
|
|
48
|
-
@staticmethod
|
|
49
|
-
def generate_artifact_hash(artifact_data: str, name: str, mime_type: str) -> str:
|
|
50
|
-
"""Generate a hash for artifact deduplication.
|
|
51
|
-
|
|
52
|
-
Args:
|
|
53
|
-
artifact_data: Base64 encoded artifact data.
|
|
54
|
-
name: Artifact name.
|
|
55
|
-
mime_type: MIME type.
|
|
56
|
-
|
|
57
|
-
Returns:
|
|
58
|
-
Hash string for deduplication.
|
|
59
|
-
"""
|
|
60
|
-
|
|
61
|
-
def create_artifact_response(result: str, artifact_data: bytes | str, artifact_name: str, artifact_description: str = '', mime_type: str | None = None) -> dict[str, Any]:
|
|
62
|
-
'''Create a standardized artifact response for tools.
|
|
63
|
-
|
|
64
|
-
This function creates a response that separates the agent-facing result
|
|
65
|
-
from the user-facing artifact, following the established pattern for
|
|
66
|
-
artifact generation in the agent system.
|
|
67
|
-
|
|
68
|
-
Args:
|
|
69
|
-
result: The message/result to show to the agent (clean, no file data).
|
|
70
|
-
artifact_data: The binary data or base64 string for the artifact.
|
|
71
|
-
artifact_name: The name for the artifact file.
|
|
72
|
-
artifact_description: Description of the artifact. Defaults to "".
|
|
73
|
-
mime_type: MIME type of the artifact. If None, will be auto-detected from filename.
|
|
74
|
-
|
|
75
|
-
Returns:
|
|
76
|
-
Dictionary with \'result\' and \'artifacts\' keys (artifacts is always a list).
|
|
77
|
-
|
|
78
|
-
Example:
|
|
79
|
-
>>> import io
|
|
80
|
-
>>> csv_data = "Name,Age\\\\nAlice,30\\\\nBob,25"
|
|
81
|
-
>>> response = create_artifact_response(
|
|
82
|
-
... result="Generated a 2-row CSV table",
|
|
83
|
-
... artifact_data=csv_data.encode(\'utf-8\'),
|
|
84
|
-
... artifact_name="data.csv",
|
|
85
|
-
... artifact_description="Sample data table",
|
|
86
|
-
... mime_type="text/csv"
|
|
87
|
-
... )
|
|
88
|
-
>>> assert "result" in response
|
|
89
|
-
>>> assert "artifacts" in response
|
|
90
|
-
>>> assert isinstance(response["artifacts"], list)
|
|
91
|
-
'''
|
|
92
|
-
def create_text_artifact_response(result: str, artifact_text: str, artifact_name: str, artifact_description: str = '', mime_type: str | None = None) -> dict[str, Any]:
|
|
93
|
-
"""Create a standardized artifact response for tools.
|
|
94
|
-
|
|
95
|
-
Args:
|
|
96
|
-
result: The message/result to show to the agent.
|
|
97
|
-
artifact_text: The text content for the artifact.
|
|
98
|
-
artifact_name: The name for the artifact file.
|
|
99
|
-
artifact_description: Description of the artifact.
|
|
100
|
-
mime_type: MIME type of the artifact. If None, will be auto-detected from filename.
|
|
101
|
-
|
|
102
|
-
Returns:
|
|
103
|
-
Dictionary with 'result' and 'artifacts' keys (artifacts is always a list).
|
|
104
|
-
"""
|
|
105
|
-
def create_multiple_artifacts_response(result: str, artifacts: list[dict[str, Any]]) -> dict[str, Any]:
|
|
106
|
-
"""Create a standardized response for multiple artifacts.
|
|
107
|
-
|
|
108
|
-
Args:
|
|
109
|
-
result: The message/result to show to the agent.
|
|
110
|
-
artifacts: List of artifact dictionaries.
|
|
111
|
-
|
|
112
|
-
Returns:
|
|
113
|
-
Dictionary with 'result' and 'artifacts' keys.
|
|
114
|
-
"""
|
|
115
|
-
def create_artifact_command(result: str, artifact_data: bytes | str, artifact_name: str, artifact_description: str = '', mime_type: str | None = None, metadata_update: dict[str, Any] | None = None) -> Command:
|
|
116
|
-
"""Create a Command that updates artifacts (and optional metadata).
|
|
117
|
-
|
|
118
|
-
Args:
|
|
119
|
-
result: Message/result to show to the agent (for ToolMessage content).
|
|
120
|
-
artifact_data: The binary data or base64 string for the artifact.
|
|
121
|
-
artifact_name: The name for the artifact file.
|
|
122
|
-
artifact_description: Description of the artifact.
|
|
123
|
-
mime_type: MIME type of the artifact. If None, auto-detected from filename.
|
|
124
|
-
metadata_update: Optional metadata delta to merge into state metadata.
|
|
125
|
-
|
|
126
|
-
Returns:
|
|
127
|
-
Command: A LangGraph Command with update containing 'result', 'artifacts', and optional 'metadata'.
|
|
128
|
-
"""
|
|
129
|
-
def create_multiple_artifacts_command(result: str, artifacts: list[Artifact | dict[str, Any]] | None = None, metadata_update: dict[str, Any] | None = None) -> Command:
|
|
130
|
-
"""Create a Command that updates multiple artifacts (and optional metadata).
|
|
131
|
-
|
|
132
|
-
The 'artifacts' list accepts mixed item types:
|
|
133
|
-
- Artifact: a typed artifact model (preferred). Will be converted via model_dump().
|
|
134
|
-
- dict: a prebuilt artifact dict ready for A2A.
|
|
135
|
-
- DataSpec dict: raw spec to build an artifact with keys:
|
|
136
|
-
{'data': bytes|str, 'artifact_name': str, 'artifact_description'?: str, 'mime_type'?: str}
|
|
137
|
-
|
|
138
|
-
Args:
|
|
139
|
-
result: Message/result to show to the agent.
|
|
140
|
-
artifacts: List of items (Artifact | dict) to attach or build.
|
|
141
|
-
metadata_update: Optional metadata delta to merge into state metadata.
|
|
142
|
-
|
|
143
|
-
Returns:
|
|
144
|
-
Command: A LangGraph Command with update containing 'result', 'artifacts', and optional 'metadata'.
|
|
145
|
-
"""
|
|
146
|
-
def create_error_response(error_message: str) -> str:
|
|
147
|
-
"""Create a standardized error response for tools.
|
|
148
|
-
|
|
149
|
-
For error cases, we return a simple string that will be passed directly
|
|
150
|
-
to the agent without any artifact processing.
|
|
151
|
-
|
|
152
|
-
Args:
|
|
153
|
-
error_message: The error message to return.
|
|
154
|
-
|
|
155
|
-
Returns:
|
|
156
|
-
String with error information.
|
|
157
|
-
"""
|
|
158
|
-
def extract_artifacts_from_agent_response(result: Any) -> tuple[str, list[dict[str, Any]]]:
|
|
159
|
-
"""Extract artifacts from agent response for delegation tools.
|
|
160
|
-
|
|
161
|
-
Args:
|
|
162
|
-
result: The result returned by the delegated agent.
|
|
163
|
-
|
|
164
|
-
Returns:
|
|
165
|
-
Tuple of (text_response, artifacts_list) where:
|
|
166
|
-
- text_response: The text content for the agent
|
|
167
|
-
- artifacts_list: List of artifacts to be passed through
|
|
168
|
-
"""
|
|
169
|
-
def create_delegation_response_with_artifacts(result: str, artifacts: list[dict[str, Any]], agent_name: str = '') -> Command:
|
|
170
|
-
"""Create a delegation response that includes artifacts only when needed.
|
|
171
|
-
|
|
172
|
-
Args:
|
|
173
|
-
result: The text result from the delegated agent.
|
|
174
|
-
artifacts: List of artifacts from the delegated agent (always a list).
|
|
175
|
-
agent_name: Name of the agent for prefixing the result.
|
|
176
|
-
|
|
177
|
-
Returns:
|
|
178
|
-
Command containing 'result' and optional 'artifacts'.
|
|
179
|
-
"""
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
from aip_agents.utils.langgraph.converter import convert_gllm_tool_call_to_langchain_tool_call as convert_gllm_tool_call_to_langchain_tool_call, convert_langchain_messages_to_gllm_messages as convert_langchain_messages_to_gllm_messages, convert_langchain_tool_call_to_gllm_tool_call as convert_langchain_tool_call_to_gllm_tool_call, convert_lm_output_to_langchain_message as convert_lm_output_to_langchain_message
|
|
2
|
-
|
|
3
|
-
__all__ = ['convert_gllm_tool_call_to_langchain_tool_call', 'convert_langchain_tool_call_to_gllm_tool_call', 'convert_lm_output_to_langchain_message', 'convert_langchain_messages_to_gllm_messages']
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
from gllm_inference.schema import LMOutput, Message, ToolCall as GllmToolCall
|
|
2
|
-
from langchain_core.messages import AIMessage, BaseMessage as BaseMessage
|
|
3
|
-
from langchain_core.messages.tool import ToolCall as LangChainToolCall
|
|
4
|
-
from typing import Sequence
|
|
5
|
-
|
|
6
|
-
def convert_langchain_messages_to_gllm_messages(messages: Sequence[BaseMessage], instruction: str) -> list[Message]:
|
|
7
|
-
"""Convert LangChain messages to gllm-inference Message format.
|
|
8
|
-
|
|
9
|
-
This function transforms a sequence of LangChain messages into the Message
|
|
10
|
-
format expected by LM Invoker. It handles system messages, human messages, AI messages
|
|
11
|
-
with tool calls, and tool result messages.
|
|
12
|
-
|
|
13
|
-
Args:
|
|
14
|
-
messages: Sequence of LangChain BaseMessage objects to convert.
|
|
15
|
-
instruction: System instruction to prepend if not already present in messages.
|
|
16
|
-
|
|
17
|
-
Returns:
|
|
18
|
-
List of Message objects containing the converted message sequence.
|
|
19
|
-
"""
|
|
20
|
-
def convert_lm_output_to_langchain_message(response: LMOutput | str) -> AIMessage:
|
|
21
|
-
"""Convert LM Invoker output to LangChain AIMessage.
|
|
22
|
-
|
|
23
|
-
This function transforms the output from LM Invoker back into LangChain's
|
|
24
|
-
AIMessage format, handling both text responses and tool calls.
|
|
25
|
-
|
|
26
|
-
Args:
|
|
27
|
-
response: The response from LM Invoker (MultimodalOutput).
|
|
28
|
-
|
|
29
|
-
Returns:
|
|
30
|
-
AIMessage containing the converted response.
|
|
31
|
-
"""
|
|
32
|
-
def convert_langchain_tool_call_to_gllm_tool_call(lc_tool_call: LangChainToolCall) -> GllmToolCall:
|
|
33
|
-
"""Convert LangChain tool call to gllm ToolCall.
|
|
34
|
-
|
|
35
|
-
Args:
|
|
36
|
-
lc_tool_call: LangChain ToolCall (TypedDict).
|
|
37
|
-
|
|
38
|
-
Returns:
|
|
39
|
-
GllmToolCall object for gllm-inference.
|
|
40
|
-
"""
|
|
41
|
-
def convert_gllm_tool_call_to_langchain_tool_call(gllm_tool_call: GllmToolCall) -> LangChainToolCall:
|
|
42
|
-
"""Convert gllm ToolCall to LangChain ToolCall format.
|
|
43
|
-
|
|
44
|
-
Args:
|
|
45
|
-
gllm_tool_call: GllmToolCall object from gllm-inference.
|
|
46
|
-
|
|
47
|
-
Returns:
|
|
48
|
-
LangChain ToolCall (TypedDict) with proper type annotation.
|
|
49
|
-
"""
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
from aip_agents.utils.langgraph.tool_managers.a2a_tool_manager import A2AToolManager as A2AToolManager
|
|
2
|
-
from aip_agents.utils.langgraph.tool_managers.base_tool_manager import BaseLangGraphToolManager as BaseLangGraphToolManager
|
|
3
|
-
from aip_agents.utils.langgraph.tool_managers.delegation_tool_manager import DelegationToolManager as DelegationToolManager
|
|
4
|
-
|
|
5
|
-
__all__ = ['BaseLangGraphToolManager', 'A2AToolManager', 'DelegationToolManager']
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from a2a.types import AgentCard as AgentCard
|
|
3
|
-
from aip_agents.utils.a2a_connector import A2AConnector as A2AConnector
|
|
4
|
-
from aip_agents.utils.langgraph.tool_managers.base_tool_manager import BaseLangGraphToolManager as BaseLangGraphToolManager
|
|
5
|
-
from aip_agents.utils.logger_manager import LoggerManager as LoggerManager
|
|
6
|
-
from langchain_core.tools import BaseTool as BaseTool
|
|
7
|
-
|
|
8
|
-
logger: Incomplete
|
|
9
|
-
|
|
10
|
-
class A2AToolManager(BaseLangGraphToolManager):
|
|
11
|
-
"""Manages A2A communication tools for LangGraph agents.
|
|
12
|
-
|
|
13
|
-
This tool manager converts A2A agent cards into LangChain tools that can
|
|
14
|
-
be used in a unified ToolNode within LangGraph agents. Each A2A agent
|
|
15
|
-
becomes a tool that the LLM can call for external communication.
|
|
16
|
-
"""
|
|
17
|
-
registered_agents: list
|
|
18
|
-
def __init__(self) -> None:
|
|
19
|
-
"""Initialize the A2A tool manager."""
|
|
20
|
-
created_tools: Incomplete
|
|
21
|
-
def register_resources(self, agent_cards: list[AgentCard]) -> list[BaseTool]:
|
|
22
|
-
"""Register A2A agents and convert them to LangChain tools.
|
|
23
|
-
|
|
24
|
-
Args:
|
|
25
|
-
agent_cards: List of AgentCard instances for external communication.
|
|
26
|
-
|
|
27
|
-
Returns:
|
|
28
|
-
List of created A2A communication tools.
|
|
29
|
-
"""
|
|
30
|
-
def get_resource_names(self) -> list[str]:
|
|
31
|
-
"""Get names of all registered A2A agents.
|
|
32
|
-
|
|
33
|
-
Returns:
|
|
34
|
-
list[str]: A list of names of all registered A2A agents.
|
|
35
|
-
"""
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from aip_agents.agent.base_agent import BaseAgent as BaseAgent
|
|
3
|
-
from aip_agents.types.a2a_events import A2AEvent as A2AEvent, A2AStreamEventType as A2AStreamEventType
|
|
4
|
-
from aip_agents.utils.artifact_helpers import extract_artifacts_from_agent_response as extract_artifacts_from_agent_response
|
|
5
|
-
from aip_agents.utils.langgraph.tool_managers.base_tool_manager import BaseLangGraphToolManager as BaseLangGraphToolManager
|
|
6
|
-
from aip_agents.utils.logger_manager import LoggerManager as LoggerManager
|
|
7
|
-
from aip_agents.utils.reference_helper import extract_references_from_agent_response as extract_references_from_agent_response
|
|
8
|
-
from aip_agents.utils.token_usage_helper import TOTAL_USAGE_KEY as TOTAL_USAGE_KEY, USAGE_METADATA_KEY as USAGE_METADATA_KEY, extract_token_usage_from_agent_response as extract_token_usage_from_agent_response
|
|
9
|
-
from langchain_core.runnables import RunnableConfig as RunnableConfig
|
|
10
|
-
from langchain_core.tools import BaseTool as BaseTool
|
|
11
|
-
from langgraph.types import StreamWriter as StreamWriter
|
|
12
|
-
|
|
13
|
-
RESULT_KEY: str
|
|
14
|
-
ARTIFACTS_KEY: str
|
|
15
|
-
METADATA_KEY: str
|
|
16
|
-
REFERENCES_KEY: str
|
|
17
|
-
OUTPUT_KEY: str
|
|
18
|
-
logger: Incomplete
|
|
19
|
-
METADATA_INTERNAL_PREFIXES: Incomplete
|
|
20
|
-
METADATA_INTERNAL_KEYS: Incomplete
|
|
21
|
-
AGENT_RUN_A2A_STREAMING_METHOD: str
|
|
22
|
-
|
|
23
|
-
class DelegationToolManager(BaseLangGraphToolManager):
|
|
24
|
-
"""Manages internal agent delegation tools for LangGraph agents.
|
|
25
|
-
|
|
26
|
-
This tool manager converts internal agent instances into LangChain tools
|
|
27
|
-
that can be used for task delegation within a unified ToolNode. Each
|
|
28
|
-
delegated agent becomes a tool that the coordinator can call.
|
|
29
|
-
|
|
30
|
-
Simplified version following legacy BaseLangChainAgent patterns.
|
|
31
|
-
"""
|
|
32
|
-
registered_agents: list[BaseAgent]
|
|
33
|
-
def __init__(self) -> None:
|
|
34
|
-
"""Initialize the delegation tool manager."""
|
|
35
|
-
created_tools: Incomplete
|
|
36
|
-
def register_resources(self, agents: list[BaseAgent]) -> list[BaseTool]:
|
|
37
|
-
"""Register internal agents for delegation and convert them to tools.
|
|
38
|
-
|
|
39
|
-
Args:
|
|
40
|
-
agents: List of BaseAgent instances for internal task delegation.
|
|
41
|
-
|
|
42
|
-
Returns:
|
|
43
|
-
List of created delegation tools.
|
|
44
|
-
"""
|
|
45
|
-
def get_resource_names(self) -> list[str]:
|
|
46
|
-
"""Get names of all registered delegation agents.
|
|
47
|
-
|
|
48
|
-
Returns:
|
|
49
|
-
list[str]: A list of names of all registered delegation agents.
|
|
50
|
-
"""
|