aip-agents-binary 0.6.4__py3-none-any.whl → 0.6.5__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.
Potentially problematic release.
This version of aip-agents-binary might be problematic. Click here for more details.
- aip_agents/agent/__init__.py +44 -4
- aip_agents/mcp/client/__init__.py +38 -2
- aip_agents/sentry/sentry.py +29 -8
- {aip_agents_binary-0.6.4.dist-info → aip_agents_binary-0.6.5.dist-info}/METADATA +1 -1
- {aip_agents_binary-0.6.4.dist-info → aip_agents_binary-0.6.5.dist-info}/RECORD +7 -305
- aip_agents/__init__.pyi +0 -19
- aip_agents/a2a/__init__.pyi +0 -3
- aip_agents/a2a/server/__init__.pyi +0 -4
- aip_agents/a2a/server/base_executor.pyi +0 -73
- aip_agents/a2a/server/google_adk_executor.pyi +0 -51
- aip_agents/a2a/server/langflow_executor.pyi +0 -43
- aip_agents/a2a/server/langgraph_executor.pyi +0 -47
- aip_agents/a2a/types.pyi +0 -132
- aip_agents/agent/__init__.pyi +0 -9
- aip_agents/agent/base_agent.pyi +0 -221
- aip_agents/agent/base_langgraph_agent.pyi +0 -233
- aip_agents/agent/google_adk_agent.pyi +0 -141
- aip_agents/agent/google_adk_constants.pyi +0 -3
- aip_agents/agent/hitl/__init__.pyi +0 -6
- aip_agents/agent/hitl/config.pyi +0 -15
- aip_agents/agent/hitl/langgraph_hitl_mixin.pyi +0 -42
- aip_agents/agent/hitl/manager.pyi +0 -200
- aip_agents/agent/hitl/models.pyi +0 -3
- aip_agents/agent/hitl/prompt/__init__.pyi +0 -4
- aip_agents/agent/hitl/prompt/base.pyi +0 -24
- aip_agents/agent/hitl/prompt/deferred.pyi +0 -30
- aip_agents/agent/hitl/registry.pyi +0 -101
- aip_agents/agent/interface.pyi +0 -81
- aip_agents/agent/interfaces.pyi +0 -44
- aip_agents/agent/langflow_agent.pyi +0 -133
- aip_agents/agent/langgraph_memory_enhancer_agent.pyi +0 -50
- aip_agents/agent/langgraph_react_agent.pyi +0 -170
- aip_agents/agent/system_instruction_context.pyi +0 -13
- aip_agents/clients/__init__.pyi +0 -4
- aip_agents/clients/langflow/__init__.pyi +0 -4
- aip_agents/clients/langflow/client.pyi +0 -140
- aip_agents/clients/langflow/types.pyi +0 -7
- aip_agents/constants.pyi +0 -7
- aip_agents/examples/__init__.pyi +0 -0
- aip_agents/examples/compare_streaming_client.pyi +0 -48
- aip_agents/examples/compare_streaming_server.pyi +0 -18
- 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 -15
- 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 -15
- aip_agents/examples/hello_world_a2a_langchain_server.pyi +0 -15
- aip_agents/examples/hello_world_a2a_langchain_server_lm_invoker.pyi +0 -15
- aip_agents/examples/hello_world_a2a_langflow_client.pyi +0 -9
- aip_agents/examples/hello_world_a2a_langflow_server.pyi +0 -14
- 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 -16
- 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 -14
- aip_agents/examples/hello_world_a2a_langgraph_server_lm_invoker.pyi +0 -15
- aip_agents/examples/hello_world_a2a_langgraph_server_tool_streaming.pyi +0 -15
- aip_agents/examples/hello_world_a2a_mcp_langgraph.pyi +0 -48
- aip_agents/examples/hello_world_a2a_three_level_agent_hierarchy_client.pyi +0 -48
- aip_agents/examples/hello_world_a2a_three_level_agent_hierarchy_server.pyi +0 -45
- 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 -15
- 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_interactive.pyi +0 -16
- aip_agents/examples/hello_world_langchain_mcp_http_stream.pyi +0 -5
- aip_agents/examples/hello_world_langchain_mcp_multi_server.pyi +0 -18
- 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_langflow_agent.pyi +0 -35
- aip_agents/examples/hello_world_langgraph.pyi +0 -5
- aip_agents/examples/hello_world_langgraph_gl_connector_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 -30
- 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_ptc.pyi +0 -5
- aip_agents/examples/hello_world_sentry.pyi +0 -21
- aip_agents/examples/hello_world_step_limits.pyi +0 -17
- aip_agents/examples/hello_world_stock_a2a_server.pyi +0 -17
- aip_agents/examples/hello_world_tool_output_client.pyi +0 -5
- aip_agents/examples/hello_world_tool_output_server.pyi +0 -19
- aip_agents/examples/hitl_demo.pyi +0 -67
- aip_agents/examples/pii_demo_langgraph_client.pyi +0 -5
- aip_agents/examples/pii_demo_langgraph_server.pyi +0 -20
- aip_agents/examples/pii_demo_multi_agent_client.pyi +0 -5
- aip_agents/examples/pii_demo_multi_agent_server.pyi +0 -40
- aip_agents/examples/todolist_planning_a2a_langchain_client.pyi +0 -5
- aip_agents/examples/todolist_planning_a2a_langgraph_server.pyi +0 -19
- aip_agents/examples/tools/__init__.pyi +0 -9
- aip_agents/examples/tools/adk_arithmetic_tools.pyi +0 -24
- 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 -19
- aip_agents/examples/tools/image_artifact_tool.pyi +0 -26
- aip_agents/examples/tools/langchain_arithmetic_tools.pyi +0 -17
- aip_agents/examples/tools/langchain_currency_exchange_tool.pyi +0 -20
- aip_agents/examples/tools/langchain_graph_artifact_tool.pyi +0 -25
- aip_agents/examples/tools/langchain_weather_tool.pyi +0 -19
- aip_agents/examples/tools/langgraph_streaming_tool.pyi +0 -43
- aip_agents/examples/tools/mock_retrieval_tool.pyi +0 -13
- aip_agents/examples/tools/pii_demo_tools.pyi +0 -54
- aip_agents/examples/tools/random_chart_tool.pyi +0 -20
- aip_agents/examples/tools/serper_tool.pyi +0 -16
- aip_agents/examples/tools/stock_tools.pyi +0 -36
- 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/guardrails/__init__.pyi +0 -6
- aip_agents/guardrails/engines/__init__.pyi +0 -4
- aip_agents/guardrails/engines/base.pyi +0 -61
- aip_agents/guardrails/engines/nemo.pyi +0 -46
- aip_agents/guardrails/engines/phrase_matcher.pyi +0 -48
- aip_agents/guardrails/exceptions.pyi +0 -23
- aip_agents/guardrails/manager.pyi +0 -42
- aip_agents/guardrails/middleware.pyi +0 -87
- aip_agents/guardrails/schemas.pyi +0 -43
- aip_agents/guardrails/utils.pyi +0 -19
- aip_agents/mcp/__init__.pyi +0 -0
- aip_agents/mcp/client/__init__.pyi +0 -5
- aip_agents/mcp/client/base_mcp_client.pyi +0 -148
- aip_agents/mcp/client/connection_manager.pyi +0 -51
- aip_agents/mcp/client/google_adk/__init__.pyi +0 -3
- aip_agents/mcp/client/google_adk/client.pyi +0 -75
- aip_agents/mcp/client/langchain/__init__.pyi +0 -3
- aip_agents/mcp/client/langchain/client.pyi +0 -48
- aip_agents/mcp/client/persistent_session.pyi +0 -122
- aip_agents/mcp/client/session_pool.pyi +0 -101
- aip_agents/mcp/client/transports.pyi +0 -132
- aip_agents/mcp/utils/__init__.pyi +0 -0
- aip_agents/mcp/utils/config_validator.pyi +0 -82
- aip_agents/memory/__init__.pyi +0 -5
- aip_agents/memory/adapters/__init__.pyi +0 -4
- aip_agents/memory/adapters/base_adapter.pyi +0 -176
- aip_agents/memory/adapters/mem0.pyi +0 -22
- aip_agents/memory/base.pyi +0 -60
- aip_agents/memory/constants.pyi +0 -25
- aip_agents/memory/factory.pyi +0 -24
- aip_agents/memory/guidance.pyi +0 -3
- aip_agents/memory/simple_memory.pyi +0 -23
- aip_agents/middleware/__init__.pyi +0 -5
- aip_agents/middleware/base.pyi +0 -75
- aip_agents/middleware/manager.pyi +0 -84
- aip_agents/middleware/todolist.pyi +0 -125
- aip_agents/ptc/__init__.pyi +0 -10
- aip_agents/ptc/doc_gen.pyi +0 -40
- aip_agents/ptc/exceptions.pyi +0 -22
- aip_agents/ptc/executor.pyi +0 -73
- aip_agents/ptc/mcp/__init__.pyi +0 -7
- aip_agents/ptc/mcp/sandbox_bridge.pyi +0 -47
- aip_agents/ptc/mcp/templates/__init__.pyi +0 -0
- aip_agents/ptc/naming.pyi +0 -76
- aip_agents/ptc/payload.pyi +0 -15
- aip_agents/ptc/prompt_builder.pyi +0 -55
- aip_agents/ptc/ptc_helper.pyi +0 -1
- aip_agents/ptc/sandbox_bridge.pyi +0 -25
- aip_agents/ptc/template_utils.pyi +0 -13
- aip_agents/ptc/templates/__init__.pyi +0 -0
- aip_agents/sandbox/__init__.pyi +0 -5
- aip_agents/sandbox/defaults.pyi +0 -2
- aip_agents/sandbox/e2b_runtime.pyi +0 -51
- aip_agents/sandbox/template_builder.pyi +0 -36
- aip_agents/sandbox/types.pyi +0 -14
- aip_agents/sandbox/validation.pyi +0 -20
- aip_agents/schema/__init__.pyi +0 -9
- aip_agents/schema/a2a.pyi +0 -40
- aip_agents/schema/agent.pyi +0 -65
- aip_agents/schema/hitl.pyi +0 -89
- aip_agents/schema/langgraph.pyi +0 -28
- aip_agents/schema/model_id.pyi +0 -54
- aip_agents/schema/step_limit.pyi +0 -63
- aip_agents/schema/storage.pyi +0 -21
- aip_agents/sentry/__init__.pyi +0 -3
- aip_agents/sentry/sentry.pyi +0 -48
- aip_agents/storage/__init__.pyi +0 -8
- aip_agents/storage/base.pyi +0 -58
- aip_agents/storage/clients/__init__.pyi +0 -3
- aip_agents/storage/clients/minio_client.pyi +0 -137
- aip_agents/storage/config.pyi +0 -29
- aip_agents/storage/providers/__init__.pyi +0 -5
- aip_agents/storage/providers/base.pyi +0 -88
- aip_agents/storage/providers/memory.pyi +0 -79
- aip_agents/storage/providers/object_storage.pyi +0 -98
- aip_agents/tools/__init__.pyi +0 -11
- aip_agents/tools/browser_use/__init__.pyi +0 -14
- aip_agents/tools/browser_use/action_parser.pyi +0 -18
- aip_agents/tools/browser_use/browser_use_tool.pyi +0 -50
- aip_agents/tools/browser_use/llm_config.pyi +0 -52
- aip_agents/tools/browser_use/minio_storage.pyi +0 -109
- aip_agents/tools/browser_use/schemas.pyi +0 -32
- aip_agents/tools/browser_use/session.pyi +0 -4
- aip_agents/tools/browser_use/session_errors.pyi +0 -53
- aip_agents/tools/browser_use/steel_session_recording.pyi +0 -63
- aip_agents/tools/browser_use/streaming.pyi +0 -81
- aip_agents/tools/browser_use/structured_data_parser.pyi +0 -86
- aip_agents/tools/browser_use/structured_data_recovery.pyi +0 -43
- aip_agents/tools/browser_use/types.pyi +0 -45
- aip_agents/tools/code_sandbox/__init__.pyi +0 -3
- aip_agents/tools/code_sandbox/constant.pyi +0 -4
- aip_agents/tools/code_sandbox/e2b_cloud_sandbox_extended.pyi +0 -102
- aip_agents/tools/code_sandbox/e2b_sandbox_tool.pyi +0 -29
- aip_agents/tools/constants.pyi +0 -138
- aip_agents/tools/date_range_tool.pyi +0 -21
- aip_agents/tools/document_loader/__init__.pyi +0 -7
- aip_agents/tools/document_loader/base_reader.pyi +0 -75
- aip_agents/tools/document_loader/docx_reader_tool.pyi +0 -10
- aip_agents/tools/document_loader/excel_reader_tool.pyi +0 -26
- aip_agents/tools/document_loader/pdf_reader_tool.pyi +0 -11
- aip_agents/tools/document_loader/pdf_splitter.pyi +0 -18
- aip_agents/tools/execute_ptc_code.pyi +0 -90
- aip_agents/tools/gl_connector/__init__.pyi +0 -3
- aip_agents/tools/gl_connector/tool.pyi +0 -74
- aip_agents/tools/gl_connector_tools.pyi +0 -39
- aip_agents/tools/memory_search/__init__.pyi +0 -5
- aip_agents/tools/memory_search/base.pyi +0 -69
- aip_agents/tools/memory_search/mem0.pyi +0 -29
- aip_agents/tools/memory_search/schema.pyi +0 -25
- aip_agents/tools/memory_search_tool.pyi +0 -3
- aip_agents/tools/time_tool.pyi +0 -16
- aip_agents/tools/tool_config_injector.pyi +0 -26
- aip_agents/tools/web_search/__init__.pyi +0 -3
- aip_agents/tools/web_search/serper_tool.pyi +0 -19
- aip_agents/types/__init__.pyi +0 -36
- aip_agents/types/a2a_events.pyi +0 -3
- aip_agents/utils/__init__.pyi +0 -11
- aip_agents/utils/a2a_connector.pyi +0 -146
- aip_agents/utils/artifact_helpers.pyi +0 -203
- aip_agents/utils/constants.pyi +0 -10
- aip_agents/utils/datetime/__init__.pyi +0 -4
- aip_agents/utils/datetime/normalization.pyi +0 -95
- aip_agents/utils/datetime/timezone.pyi +0 -48
- aip_agents/utils/env_loader.pyi +0 -10
- aip_agents/utils/event_handler_registry.pyi +0 -23
- aip_agents/utils/file_prompt_utils.pyi +0 -21
- aip_agents/utils/final_response_builder.pyi +0 -34
- aip_agents/utils/formatter_llm_client.pyi +0 -71
- 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/base_tool_manager.pyi +0 -48
- aip_agents/utils/langgraph/tool_managers/delegation_tool_manager.pyi +0 -56
- aip_agents/utils/langgraph/tool_output_management.pyi +0 -329
- aip_agents/utils/logger.pyi +0 -60
- aip_agents/utils/metadata/__init__.pyi +0 -5
- aip_agents/utils/metadata/activity_metadata_helper.pyi +0 -25
- aip_agents/utils/metadata/activity_narrative/__init__.pyi +0 -7
- aip_agents/utils/metadata/activity_narrative/builder.pyi +0 -35
- aip_agents/utils/metadata/activity_narrative/constants.pyi +0 -10
- aip_agents/utils/metadata/activity_narrative/context.pyi +0 -32
- aip_agents/utils/metadata/activity_narrative/formatters.pyi +0 -48
- aip_agents/utils/metadata/activity_narrative/utils.pyi +0 -12
- aip_agents/utils/metadata/schemas/__init__.pyi +0 -4
- aip_agents/utils/metadata/schemas/activity_schema.pyi +0 -18
- aip_agents/utils/metadata/schemas/thinking_schema.pyi +0 -20
- aip_agents/utils/metadata/thinking_metadata_helper.pyi +0 -4
- aip_agents/utils/metadata_helper.pyi +0 -117
- aip_agents/utils/name_preprocessor/__init__.pyi +0 -6
- aip_agents/utils/name_preprocessor/base_name_preprocessor.pyi +0 -52
- aip_agents/utils/name_preprocessor/google_name_preprocessor.pyi +0 -38
- aip_agents/utils/name_preprocessor/name_preprocessor.pyi +0 -41
- aip_agents/utils/name_preprocessor/openai_name_preprocessor.pyi +0 -34
- aip_agents/utils/pii/__init__.pyi +0 -5
- aip_agents/utils/pii/pii_handler.pyi +0 -96
- aip_agents/utils/pii/pii_helper.pyi +0 -78
- aip_agents/utils/pii/uuid_deanonymizer_mapping.pyi +0 -73
- aip_agents/utils/reference_helper.pyi +0 -81
- aip_agents/utils/sse_chunk_transformer.pyi +0 -166
- aip_agents/utils/step_limit_manager.pyi +0 -112
- aip_agents/utils/token_usage_helper.pyi +0 -60
- {aip_agents_binary-0.6.4.dist-info → aip_agents_binary-0.6.5.dist-info}/WHEEL +0 -0
- {aip_agents_binary-0.6.4.dist-info → aip_agents_binary-0.6.5.dist-info}/top_level.txt +0 -0
aip_agents/__init__.pyi
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
__all__ = ['a2a', 'agent', 'clients', 'constants', 'credentials', 'executor', 'memory', 'mcp', 'schema', 'sentry', 'storage', 'tools', 'types', 'utils', '__version__']
|
|
2
|
-
|
|
3
|
-
__version__: str
|
|
4
|
-
|
|
5
|
-
# Names in __all__ with no definition:
|
|
6
|
-
# a2a
|
|
7
|
-
# agent
|
|
8
|
-
# clients
|
|
9
|
-
# constants
|
|
10
|
-
# credentials
|
|
11
|
-
# executor
|
|
12
|
-
# mcp
|
|
13
|
-
# memory
|
|
14
|
-
# schema
|
|
15
|
-
# sentry
|
|
16
|
-
# storage
|
|
17
|
-
# tools
|
|
18
|
-
# types
|
|
19
|
-
# utils
|
aip_agents/a2a/__init__.pyi
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
from aip_agents.a2a.types import ArtifactType as ArtifactType, MimeType as MimeType, get_extension_from_mime_type as get_extension_from_mime_type, get_mime_type_from_filename as get_mime_type_from_filename
|
|
2
|
-
|
|
3
|
-
__all__ = ['ArtifactType', 'MimeType', 'get_mime_type_from_filename', 'get_extension_from_mime_type']
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from a2a.server.agent_execution import AgentExecutor as A2ASDKExecutor, RequestContext
|
|
3
|
-
from a2a.server.events.event_queue import EventQueue
|
|
4
|
-
from abc import ABC, abstractmethod
|
|
5
|
-
from aip_agents.types import A2AEvent as A2AEvent, A2AStreamEventType as A2AStreamEventType
|
|
6
|
-
from aip_agents.utils import serialize_references_for_metadata as serialize_references_for_metadata
|
|
7
|
-
from aip_agents.utils.artifact_helpers import ArtifactHandler as ArtifactHandler
|
|
8
|
-
from aip_agents.utils.logger import get_logger as get_logger
|
|
9
|
-
from aip_agents.utils.metadata_helper import MetadataFieldKeys as MetadataFieldKeys
|
|
10
|
-
from collections.abc import Callable as Callable
|
|
11
|
-
from dataclasses import dataclass
|
|
12
|
-
from typing import Any
|
|
13
|
-
|
|
14
|
-
logger: Incomplete
|
|
15
|
-
|
|
16
|
-
@dataclass
|
|
17
|
-
class StatusUpdateParams:
|
|
18
|
-
"""Parameters for status updates."""
|
|
19
|
-
metadata: dict[str, Any] | None = ...
|
|
20
|
-
final: bool = ...
|
|
21
|
-
task_id: str | None = ...
|
|
22
|
-
context_id: str | None = ...
|
|
23
|
-
|
|
24
|
-
class BaseA2AExecutor(A2ASDKExecutor, ABC):
|
|
25
|
-
"""Abstract base class for GLLM Agent framework's A2A server-side executors.
|
|
26
|
-
|
|
27
|
-
This class extends the A2A SDK's `AgentExecutor`. It serves as a common
|
|
28
|
-
foundation for specific executors tailored to different agent types within the
|
|
29
|
-
`aip-agents` framework, such as `LangGraphA2AExecutor` or
|
|
30
|
-
`GoogleADKA2AExecutor`.
|
|
31
|
-
|
|
32
|
-
Subclasses are required to implement the `execute` method to handle A2A
|
|
33
|
-
requests. The `cancel` method has a common implementation.
|
|
34
|
-
|
|
35
|
-
Attributes:
|
|
36
|
-
_active_tasks (dict[str, asyncio.Task]): A dictionary mapping task IDs to
|
|
37
|
-
their corresponding asyncio.Task instances for active agent executions.
|
|
38
|
-
"""
|
|
39
|
-
def __init__(self) -> None:
|
|
40
|
-
"""Initializes the BaseA2AExecutor."""
|
|
41
|
-
@abstractmethod
|
|
42
|
-
async def execute(self, context: RequestContext, event_queue: EventQueue) -> None:
|
|
43
|
-
"""Processes an incoming agent request and manages its execution.
|
|
44
|
-
|
|
45
|
-
Implementations should interact with the underlying agent (e.g., a LangGraph
|
|
46
|
-
or Google ADK agent) based on the provided `context`. All communications
|
|
47
|
-
regarding task status, artifacts, and completion must be sent through
|
|
48
|
-
the `event_queue`.
|
|
49
|
-
|
|
50
|
-
This method typically involves:
|
|
51
|
-
1. Calling `_handle_initial_execute_checks` for validation and setup.
|
|
52
|
-
2. Defining an agent-specific coroutine for processing (e.g., `_process_stream`).
|
|
53
|
-
3. Calling `_execute_agent_processing` to manage the lifecycle of this coroutine.
|
|
54
|
-
|
|
55
|
-
Args:
|
|
56
|
-
context (RequestContext): The request context containing information about the incoming
|
|
57
|
-
message, task, and other relevant data.
|
|
58
|
-
event_queue (EventQueue): The queue used to send events (e.g., task status updates,
|
|
59
|
-
artifacts) back to the A2A server infrastructure.
|
|
60
|
-
"""
|
|
61
|
-
async def cancel(self, context: RequestContext, event_queue: EventQueue) -> None:
|
|
62
|
-
"""Handles a request to cancel an ongoing agent task.
|
|
63
|
-
|
|
64
|
-
This method attempts to cancel an active asyncio.Task associated with the
|
|
65
|
-
given `context.task_id`. It waits for a short period for the task to handle
|
|
66
|
-
the cancellation gracefully. The `event_queue` is used to report the
|
|
67
|
-
outcome of the cancellation attempt (e.g., success, error during cleanup).
|
|
68
|
-
|
|
69
|
-
Args:
|
|
70
|
-
context (RequestContext): The request context for the task to be cancelled,
|
|
71
|
-
primarily used to get the `task_id` and `context_id`.
|
|
72
|
-
event_queue (EventQueue): The queue for sending cancellation status events.
|
|
73
|
-
"""
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from a2a.server.agent_execution import RequestContext
|
|
3
|
-
from a2a.server.events.event_queue import EventQueue
|
|
4
|
-
from aip_agents.a2a.server.base_executor import BaseA2AExecutor as BaseA2AExecutor, StatusUpdateParams as StatusUpdateParams
|
|
5
|
-
from aip_agents.agent.google_adk_constants import DEFAULT_AUTH_URL as DEFAULT_AUTH_URL
|
|
6
|
-
from aip_agents.agent.interfaces import GoogleADKAgentProtocol as GoogleADKAgentProtocol
|
|
7
|
-
from aip_agents.utils.logger import get_logger as get_logger
|
|
8
|
-
|
|
9
|
-
logger: Incomplete
|
|
10
|
-
|
|
11
|
-
class GoogleADKExecutor(BaseA2AExecutor):
|
|
12
|
-
'''A2A Executor for serving a `GoogleADKAgent`.
|
|
13
|
-
|
|
14
|
-
This executor bridges the A2A server protocol with a `aip_agents.agent.GoogleADKAgent`.
|
|
15
|
-
It handles incoming requests by invoking the agent\'s `arun_a2a_stream` method,
|
|
16
|
-
which is specifically designed to yield ADK events in an A2A-compatible dictionary
|
|
17
|
-
format. This executor\'s `_process_stream` method is tailored to handle this stream,
|
|
18
|
-
including ADK-specific statuses like "auth_required", before delegating common
|
|
19
|
-
status handling to `BaseA2AExecutor._handle_stream_event`.
|
|
20
|
-
|
|
21
|
-
It leverages common functionality from `BaseA2AExecutor` for task management,
|
|
22
|
-
initial request checks, and cancellation.
|
|
23
|
-
|
|
24
|
-
Attributes:
|
|
25
|
-
agent (GoogleADKAgentProtocol): The instance of `GoogleADKAgent`-compatible class to execute.
|
|
26
|
-
'''
|
|
27
|
-
agent: GoogleADKAgentProtocol
|
|
28
|
-
def __init__(self, agent: GoogleADKAgentProtocol) -> None:
|
|
29
|
-
"""Initializes the GoogleADKExecutor.
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
agent: Component implementing `GoogleADKAgentProtocol`.
|
|
33
|
-
|
|
34
|
-
Raises:
|
|
35
|
-
TypeError: If the provided agent does not satisfy `GoogleADKAgentProtocol`.
|
|
36
|
-
"""
|
|
37
|
-
async def execute(self, context: RequestContext, event_queue: EventQueue) -> None:
|
|
38
|
-
"""Processes an incoming agent request using the `GoogleADKAgent`.
|
|
39
|
-
|
|
40
|
-
This method first performs initial checks using `_handle_initial_execute_checks`
|
|
41
|
-
from the base class. If successful, it prepares the `_process_stream` coroutine
|
|
42
|
-
and passes it to `_execute_agent_processing` (also from the base class) to
|
|
43
|
-
manage its execution lifecycle. The `_process_stream` method is responsible for
|
|
44
|
-
calling the agent's `arun_a2a_stream` and handling its ADK-specific output.
|
|
45
|
-
|
|
46
|
-
Args:
|
|
47
|
-
context (RequestContext): The A2A request context containing message details,
|
|
48
|
-
task ID, and context ID.
|
|
49
|
-
event_queue (EventQueue): The queue for sending A2A events (task status,
|
|
50
|
-
artifacts) back to the server.
|
|
51
|
-
"""
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from a2a.server.agent_execution import RequestContext
|
|
3
|
-
from a2a.server.events.event_queue import EventQueue
|
|
4
|
-
from abc import ABC
|
|
5
|
-
from aip_agents.a2a.server.base_executor import BaseA2AExecutor as BaseA2AExecutor, StatusUpdateParams as StatusUpdateParams
|
|
6
|
-
from aip_agents.agent.interfaces import LangflowAgentProtocol as LangflowAgentProtocol
|
|
7
|
-
from aip_agents.utils.logger import get_logger as get_logger
|
|
8
|
-
|
|
9
|
-
logger: Incomplete
|
|
10
|
-
|
|
11
|
-
class LangflowA2AExecutor(BaseA2AExecutor, ABC):
|
|
12
|
-
"""A2A executor for Langflow agents.
|
|
13
|
-
|
|
14
|
-
This class extends BaseA2AExecutor to provide A2A execution capabilities
|
|
15
|
-
for Langflow agents. It follows the same patterns as LangGraphA2AExecutor
|
|
16
|
-
but handles Langflow-specific streaming and execution logic.
|
|
17
|
-
|
|
18
|
-
Attributes:
|
|
19
|
-
agent: The LangflowAgent-compatible instance to be executed.
|
|
20
|
-
"""
|
|
21
|
-
agent: LangflowAgentProtocol
|
|
22
|
-
def __init__(self, langflow_agent_instance: LangflowAgentProtocol) -> None:
|
|
23
|
-
"""Initialize the LangflowA2AExecutor.
|
|
24
|
-
|
|
25
|
-
Args:
|
|
26
|
-
langflow_agent_instance: Component implementing `LangflowAgentProtocol`.
|
|
27
|
-
|
|
28
|
-
Raises:
|
|
29
|
-
TypeError: If the agent does not satisfy `LangflowAgentProtocol`.
|
|
30
|
-
"""
|
|
31
|
-
async def execute(self, context: RequestContext, event_queue: EventQueue) -> None:
|
|
32
|
-
"""Process an incoming agent request using a Langflow agent.
|
|
33
|
-
|
|
34
|
-
This method handles the execution lifecycle for Langflow agents:
|
|
35
|
-
1. Performs initial validation and setup
|
|
36
|
-
2. Creates agent processing coroutine
|
|
37
|
-
3. Manages the execution lifecycle through BaseA2AExecutor
|
|
38
|
-
|
|
39
|
-
Args:
|
|
40
|
-
context: The A2A request context containing message details,
|
|
41
|
-
task ID, and context ID.
|
|
42
|
-
event_queue: The queue for sending A2A events back to the server.
|
|
43
|
-
"""
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from a2a.server.agent_execution import RequestContext
|
|
3
|
-
from a2a.server.events.event_queue import EventQueue
|
|
4
|
-
from abc import ABC
|
|
5
|
-
from aip_agents.a2a.server.base_executor import BaseA2AExecutor as BaseA2AExecutor, StatusUpdateParams as StatusUpdateParams
|
|
6
|
-
from aip_agents.agent.interfaces import LangGraphAgentProtocol as LangGraphAgentProtocol
|
|
7
|
-
from aip_agents.schema.step_limit import StepLimitConfig as StepLimitConfig
|
|
8
|
-
from aip_agents.utils.logger import get_logger as get_logger
|
|
9
|
-
|
|
10
|
-
logger: Incomplete
|
|
11
|
-
|
|
12
|
-
class LangGraphA2AExecutor(BaseA2AExecutor, ABC):
|
|
13
|
-
"""Base class for LangChain-based A2A executors.
|
|
14
|
-
|
|
15
|
-
This class extends BaseA2AExecutor to provide common functionality for executors
|
|
16
|
-
that work with LangChain-based agents (LangChainAgent and LangGraphAgent).
|
|
17
|
-
It implements shared methods for handling streaming responses and managing
|
|
18
|
-
agent execution, while leaving agent-specific initialization to subclasses.
|
|
19
|
-
|
|
20
|
-
Attributes:
|
|
21
|
-
agent (LangGraphAgentProtocol): The LangChain-based agent instance to be executed.
|
|
22
|
-
"""
|
|
23
|
-
agent: LangGraphAgentProtocol
|
|
24
|
-
def __init__(self, langgraph_agent_instance: LangGraphAgentProtocol) -> None:
|
|
25
|
-
"""Initializes the LangGraphA2AExecutor.
|
|
26
|
-
|
|
27
|
-
Args:
|
|
28
|
-
langgraph_agent_instance: Component implementing `LangGraphAgentProtocol`.
|
|
29
|
-
|
|
30
|
-
Raises:
|
|
31
|
-
TypeError: If the provided agent does not satisfy `LangGraphAgentProtocol`.
|
|
32
|
-
"""
|
|
33
|
-
async def execute(self, context: RequestContext, event_queue: EventQueue) -> None:
|
|
34
|
-
"""Processes an incoming agent request using a LangChain-based agent.
|
|
35
|
-
|
|
36
|
-
This method first performs initial checks using _handle_initial_execute_checks.
|
|
37
|
-
If successful, it prepares the _process_stream coroutine and passes it to
|
|
38
|
-
_execute_agent_processing from the base class to manage its lifecycle.
|
|
39
|
-
The _process_stream method is responsible for calling the agent's
|
|
40
|
-
arun_a2a_stream and handling its output.
|
|
41
|
-
|
|
42
|
-
Args:
|
|
43
|
-
context (RequestContext): The A2A request context containing message details,
|
|
44
|
-
task ID, and context ID.
|
|
45
|
-
event_queue (EventQueue): The queue for sending A2A events (task status,
|
|
46
|
-
artifacts) back to the server.
|
|
47
|
-
"""
|
aip_agents/a2a/types.pyi
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from enum import StrEnum
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
from typing import Any
|
|
5
|
-
|
|
6
|
-
class MimeType(StrEnum):
|
|
7
|
-
"""Common MIME types for A2A artifacts.
|
|
8
|
-
|
|
9
|
-
This class provides constants for commonly used MIME types in artifact generation,
|
|
10
|
-
ensuring consistency and reducing typos across the codebase.
|
|
11
|
-
"""
|
|
12
|
-
TEXT_PLAIN: str
|
|
13
|
-
TEXT_HTML: str
|
|
14
|
-
TEXT_CSS: str
|
|
15
|
-
TEXT_JAVASCRIPT: str
|
|
16
|
-
TEXT_CSV: str
|
|
17
|
-
TEXT_XML: str
|
|
18
|
-
TEXT_MARKDOWN: str
|
|
19
|
-
APPLICATION_JSON: str
|
|
20
|
-
APPLICATION_XML: str
|
|
21
|
-
APPLICATION_PDF: str
|
|
22
|
-
APPLICATION_ZIP: str
|
|
23
|
-
APPLICATION_GZIP: str
|
|
24
|
-
APPLICATION_TAR: str
|
|
25
|
-
APPLICATION_OCTET_STREAM: str
|
|
26
|
-
APPLICATION_MSWORD: str
|
|
27
|
-
APPLICATION_EXCEL: str
|
|
28
|
-
APPLICATION_POWERPOINT: str
|
|
29
|
-
APPLICATION_DOCX: str
|
|
30
|
-
APPLICATION_XLSX: str
|
|
31
|
-
APPLICATION_PPTX: str
|
|
32
|
-
IMAGE_JPEG: str
|
|
33
|
-
IMAGE_PNG: str
|
|
34
|
-
IMAGE_GIF: str
|
|
35
|
-
IMAGE_WEBP: str
|
|
36
|
-
IMAGE_SVG: str
|
|
37
|
-
IMAGE_BMP: str
|
|
38
|
-
IMAGE_TIFF: str
|
|
39
|
-
IMAGE_ICO: str
|
|
40
|
-
AUDIO_MP3: str
|
|
41
|
-
AUDIO_WAV: str
|
|
42
|
-
AUDIO_OGG: str
|
|
43
|
-
AUDIO_AAC: str
|
|
44
|
-
AUDIO_FLAC: str
|
|
45
|
-
VIDEO_MP4: str
|
|
46
|
-
VIDEO_AVI: str
|
|
47
|
-
VIDEO_MOV: str
|
|
48
|
-
VIDEO_WMV: str
|
|
49
|
-
VIDEO_WEBM: str
|
|
50
|
-
VIDEO_MKV: str
|
|
51
|
-
FONT_TTF: str
|
|
52
|
-
FONT_OTF: str
|
|
53
|
-
FONT_WOFF: str
|
|
54
|
-
FONT_WOFF2: str
|
|
55
|
-
|
|
56
|
-
class ArtifactType(StrEnum):
|
|
57
|
-
"""Common artifact types for A2A artifacts.
|
|
58
|
-
|
|
59
|
-
This class provides constants for artifact types used in the A2A protocol.
|
|
60
|
-
"""
|
|
61
|
-
FILE: str
|
|
62
|
-
DATA: str
|
|
63
|
-
TEXT: str
|
|
64
|
-
|
|
65
|
-
EXTENSION_TO_MIME_TYPE: Incomplete
|
|
66
|
-
MIME_TYPE_TO_EXTENSION: Incomplete
|
|
67
|
-
|
|
68
|
-
def get_mime_type_from_filename(filename: str) -> str:
|
|
69
|
-
'''Get MIME type from filename extension.
|
|
70
|
-
|
|
71
|
-
Args:
|
|
72
|
-
filename: The filename to get the MIME type for.
|
|
73
|
-
|
|
74
|
-
Returns:
|
|
75
|
-
The MIME type string, or application/octet-stream if unknown.
|
|
76
|
-
|
|
77
|
-
Example:
|
|
78
|
-
>>> get_mime_type_from_filename("data.csv")
|
|
79
|
-
\'text/csv\'
|
|
80
|
-
>>> get_mime_type_from_filename("image.png")
|
|
81
|
-
\'image/png\'
|
|
82
|
-
>>> get_mime_type_from_filename("unknown.xyz")
|
|
83
|
-
\'application/octet-stream\'
|
|
84
|
-
'''
|
|
85
|
-
def get_extension_from_mime_type(mime_type: str) -> str | None:
|
|
86
|
-
'''Get file extension from MIME type.
|
|
87
|
-
|
|
88
|
-
Args:
|
|
89
|
-
mime_type: The MIME type to get the extension for.
|
|
90
|
-
|
|
91
|
-
Returns:
|
|
92
|
-
The file extension (with dot) or None if not found.
|
|
93
|
-
|
|
94
|
-
Example:
|
|
95
|
-
>>> get_extension_from_mime_type("text/csv")
|
|
96
|
-
\'.csv\'
|
|
97
|
-
>>> get_extension_from_mime_type("image/png")
|
|
98
|
-
\'.png\'
|
|
99
|
-
>>> get_extension_from_mime_type("unknown/type")
|
|
100
|
-
None
|
|
101
|
-
'''
|
|
102
|
-
|
|
103
|
-
class Artifact(BaseModel):
|
|
104
|
-
"""Represents an artifact payload used by A2A helpers and executors.
|
|
105
|
-
|
|
106
|
-
This model standardizes the structure for artifacts generated by tools and
|
|
107
|
-
passed through the A2A pipeline.
|
|
108
|
-
|
|
109
|
-
Attributes:
|
|
110
|
-
artifact_type (ArtifactType): The type of artifact. Defaults to FILE.
|
|
111
|
-
data (str): Base64-encoded content of the artifact.
|
|
112
|
-
name (str): Display name or filename of the artifact.
|
|
113
|
-
description (str): Optional description for the artifact. Defaults to empty string.
|
|
114
|
-
mime_type (str): MIME type of the artifact content.
|
|
115
|
-
metadata (dict[str, Any] | None): Optional per-artifact metadata to pass through.
|
|
116
|
-
"""
|
|
117
|
-
artifact_type: ArtifactType
|
|
118
|
-
data: str
|
|
119
|
-
name: str
|
|
120
|
-
description: str
|
|
121
|
-
mime_type: str
|
|
122
|
-
metadata: dict[str, Any] | None
|
|
123
|
-
@classmethod
|
|
124
|
-
def validate_base64(cls, v: str) -> str:
|
|
125
|
-
"""Validate that 'data' is a valid base64 string.
|
|
126
|
-
|
|
127
|
-
Args:
|
|
128
|
-
v (str): The base64 string to validate.
|
|
129
|
-
|
|
130
|
-
Returns:
|
|
131
|
-
str: The validated base64 string if valid.
|
|
132
|
-
"""
|
aip_agents/agent/__init__.pyi
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
from aip_agents.agent.base_agent import BaseAgent as BaseAgent
|
|
2
|
-
from aip_agents.agent.base_langgraph_agent import BaseLangGraphAgent as BaseLangGraphAgent
|
|
3
|
-
from aip_agents.agent.google_adk_agent import GoogleADKAgent as GoogleADKAgent
|
|
4
|
-
from aip_agents.agent.interface import AgentInterface as AgentInterface
|
|
5
|
-
from aip_agents.agent.langflow_agent import LangflowAgent as LangflowAgent
|
|
6
|
-
from aip_agents.agent.langgraph_memory_enhancer_agent import LangGraphMemoryEnhancerAgent as LangGraphMemoryEnhancerAgent
|
|
7
|
-
from aip_agents.agent.langgraph_react_agent import LangChainAgent as LangChainAgent, LangGraphAgent as LangGraphAgent, LangGraphReactAgent as LangGraphReactAgent
|
|
8
|
-
|
|
9
|
-
__all__ = ['AgentInterface', 'BaseAgent', 'BaseLangGraphAgent', 'LangGraphReactAgent', 'GoogleADKAgent', 'LangGraphAgent', 'LangChainAgent', 'LangflowAgent', 'LangGraphMemoryEnhancerAgent']
|
aip_agents/agent/base_agent.pyi
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from a2a.types import AgentCard
|
|
3
|
-
from aip_agents.agent.interface import AgentInterface as AgentInterface
|
|
4
|
-
from aip_agents.credentials.manager import CredentialsManager as CredentialsManager
|
|
5
|
-
from aip_agents.mcp.client.base_mcp_client import BaseMCPClient as BaseMCPClient
|
|
6
|
-
from aip_agents.schema.agent import A2AClientConfig as A2AClientConfig, AgentConfig as AgentConfig, BaseAgentConfig as BaseAgentConfig, CredentialType as CredentialType
|
|
7
|
-
from aip_agents.schema.model_id import ModelId as ModelId, ModelProvider as ModelProvider
|
|
8
|
-
from aip_agents.utils.a2a_connector import A2AConnector as A2AConnector
|
|
9
|
-
from aip_agents.utils.logger import get_logger as get_logger
|
|
10
|
-
from aip_agents.utils.name_preprocessor.name_preprocessor import NamePreprocessor as NamePreprocessor
|
|
11
|
-
from collections.abc import AsyncGenerator
|
|
12
|
-
from starlette.applications import Starlette
|
|
13
|
-
from typing import Any
|
|
14
|
-
|
|
15
|
-
logger: Incomplete
|
|
16
|
-
AGENT_EXECUTOR_MAPPING: Incomplete
|
|
17
|
-
DEFAULT_RETRY_CONFIG: Incomplete
|
|
18
|
-
LM_EXCLUDE_FIELDS: Incomplete
|
|
19
|
-
CUSTOM_PROVIDERS: Incomplete
|
|
20
|
-
OUTPUT_ANALYTICS_KEY: str
|
|
21
|
-
|
|
22
|
-
class BaseAgent(AgentInterface):
|
|
23
|
-
"""Base class for agents, providing common A2A client method implementations.
|
|
24
|
-
|
|
25
|
-
Concrete agent implementations (e.g., LangGraphAgent, GoogleADKAgent)
|
|
26
|
-
should inherit from this class if they need to utilize the shared A2A
|
|
27
|
-
client functionalities.
|
|
28
|
-
|
|
29
|
-
This class now supports flexible model handling:
|
|
30
|
-
- model: Optional[Any] - can be an lm_invoker, string/ModelId, LangChain BaseChatModel, or other types
|
|
31
|
-
- Automatically sets self.lm_invoker if an lm_invoker is provided or can be built
|
|
32
|
-
- Stores the original model in self.model for subclass use
|
|
33
|
-
- Enhanced credential support with automatic type detection
|
|
34
|
-
"""
|
|
35
|
-
model: Incomplete
|
|
36
|
-
tools: Incomplete
|
|
37
|
-
tool_configs: Incomplete
|
|
38
|
-
mcp_client: BaseMCPClient | None
|
|
39
|
-
name_preprocessor: Incomplete
|
|
40
|
-
def __init__(self, name: str, instruction: str, description: str | None = None, model: Any | None = None, tools: list[Any] | None = None, config: BaseAgentConfig | dict[str, Any] | None = None, tool_configs: dict[str, Any] | None = None, **kwargs: Any) -> None:
|
|
41
|
-
"""Initializes the BaseAgent.
|
|
42
|
-
|
|
43
|
-
Args:
|
|
44
|
-
name: The name of the agent.
|
|
45
|
-
instruction: The core directive or system prompt for the agent.
|
|
46
|
-
description: Human-readable description. Defaults to instruction if not provided.
|
|
47
|
-
model: The model to use. Can be:
|
|
48
|
-
- BaseLMInvoker instance (will be set as self.lm_invoker)
|
|
49
|
-
- String or ModelId (will build an lm_invoker)
|
|
50
|
-
- LangChain BaseChatModel (will be stored in self.model)
|
|
51
|
-
- Any other type (will be stored in self.model)
|
|
52
|
-
tools: List of tools available to the agent.
|
|
53
|
-
config: Additional configuration for the agent. Can be a BaseAgentConfig instance or dict.
|
|
54
|
-
tool_configs: Default tool configurations applied to all tool calls from this agent.
|
|
55
|
-
**kwargs: Additional keyword arguments for AgentInterface.
|
|
56
|
-
"""
|
|
57
|
-
def get_name_preprocessor(self) -> NamePreprocessor:
|
|
58
|
-
"""Get the name preprocessor based on the provider.
|
|
59
|
-
|
|
60
|
-
This will be used to correct the agent name and tool name. (mostly tool name)
|
|
61
|
-
|
|
62
|
-
Returns:
|
|
63
|
-
NamePreprocessor: The name preprocessor for the model.
|
|
64
|
-
"""
|
|
65
|
-
@property
|
|
66
|
-
def model_provider(self) -> str:
|
|
67
|
-
"""Get the provider of the model with simplified logic.
|
|
68
|
-
|
|
69
|
-
Returns:
|
|
70
|
-
str: The provider of the model.
|
|
71
|
-
"""
|
|
72
|
-
@property
|
|
73
|
-
def mcp_config(self) -> dict[str, dict[str, Any]]:
|
|
74
|
-
"""Read-only view of MCP configuration.
|
|
75
|
-
|
|
76
|
-
Returns a copy to prevent direct mutation; use add_mcp_server() for changes.
|
|
77
|
-
"""
|
|
78
|
-
@mcp_config.setter
|
|
79
|
-
def mcp_config(self, value: dict[str, dict[str, Any]]) -> None:
|
|
80
|
-
"""Set MCP configuration and maintain synchronization.
|
|
81
|
-
|
|
82
|
-
Automatically resets initialization flag and recreates client to ensure consistency.
|
|
83
|
-
Prefer using add_mcp_server() for proper validation.
|
|
84
|
-
|
|
85
|
-
Args:
|
|
86
|
-
value (dict[str, dict[str, Any]]): The MCP configuration to set.
|
|
87
|
-
"""
|
|
88
|
-
def to_a2a(self, agent_card: AgentCard, **kwargs: Any) -> Starlette:
|
|
89
|
-
"""Converts the agent to an A2A-compatible ASGI application.
|
|
90
|
-
|
|
91
|
-
This implementation provides a base setup for A2A server components.
|
|
92
|
-
Subclasses can override this method if they need custom executor
|
|
93
|
-
or task store implementations.
|
|
94
|
-
|
|
95
|
-
Args:
|
|
96
|
-
agent_card: The agent card to use for the A2A application.
|
|
97
|
-
**kwargs: Additional keyword arguments for ASGI application configuration.
|
|
98
|
-
|
|
99
|
-
Returns:
|
|
100
|
-
A Starlette ASGI application that can be used with any ASGI server.
|
|
101
|
-
"""
|
|
102
|
-
@classmethod
|
|
103
|
-
def discover_agents(cls, a2a_config: A2AClientConfig, **kwargs: Any) -> list[AgentCard]:
|
|
104
|
-
"""Discover agents from the URLs specified in a2a_config.discovery_urls.
|
|
105
|
-
|
|
106
|
-
This concrete implementation fetches and parses .well-known/agent.json
|
|
107
|
-
from each discovery URL to build a list of available agents.
|
|
108
|
-
|
|
109
|
-
Args:
|
|
110
|
-
a2a_config: Configuration containing discovery URLs and other A2A settings.
|
|
111
|
-
**kwargs: Additional keyword arguments (unused in this implementation).
|
|
112
|
-
|
|
113
|
-
Returns:
|
|
114
|
-
A list of AgentCard objects representing discovered agents.
|
|
115
|
-
"""
|
|
116
|
-
def send_to_agent(self, agent_card: AgentCard, message: str | dict[str, Any], **kwargs: Any) -> dict[str, Any]:
|
|
117
|
-
"""Synchronously sends a message to another agent using the A2A protocol.
|
|
118
|
-
|
|
119
|
-
This method is a synchronous wrapper around asend_to_agent. It handles the creation
|
|
120
|
-
of an event loop if one doesn't exist, and manages the asynchronous call internally.
|
|
121
|
-
|
|
122
|
-
Args:
|
|
123
|
-
agent_card: The AgentCard instance containing the target agent's details including
|
|
124
|
-
URL, authentication requirements, and capabilities.
|
|
125
|
-
message: The message to send to the agent. Can be either a string for simple text
|
|
126
|
-
messages or a dictionary for structured data.
|
|
127
|
-
**kwargs: Additional keyword arguments passed to asend_to_agent.
|
|
128
|
-
|
|
129
|
-
Returns:
|
|
130
|
-
A dictionary containing the response details:
|
|
131
|
-
- status (str): 'success' or 'error'
|
|
132
|
-
- content (str): Extracted text content from the response
|
|
133
|
-
- task_id (str, optional): ID of the created/updated task
|
|
134
|
-
- task_state (str, optional): Current state of the task
|
|
135
|
-
- raw_response (str): Complete JSON response from the A2A client
|
|
136
|
-
- error_type (str, optional): Type of error if status is 'error'
|
|
137
|
-
- message (str, optional): Error message if status is 'error'
|
|
138
|
-
|
|
139
|
-
Raises:
|
|
140
|
-
RuntimeError: If called from within an existing event loop or if asend_to_agent
|
|
141
|
-
encounters an unhandled exception.
|
|
142
|
-
"""
|
|
143
|
-
async def asend_to_agent(self, agent_card: AgentCard, message: str | dict[str, Any], **kwargs: Any) -> dict[str, Any]:
|
|
144
|
-
"""Asynchronously sends a message to another agent using the A2A protocol.
|
|
145
|
-
|
|
146
|
-
This method handles the core A2A communication logic, creating and sending properly
|
|
147
|
-
formatted A2A messages and processing the responses.
|
|
148
|
-
|
|
149
|
-
Args:
|
|
150
|
-
agent_card: The AgentCard instance containing the target agent's details including
|
|
151
|
-
URL, authentication requirements, and capabilities.
|
|
152
|
-
message: The message to send to the agent. Can be either a string for simple text
|
|
153
|
-
messages or a dictionary for structured data.
|
|
154
|
-
**kwargs: Additional keyword arguments.
|
|
155
|
-
|
|
156
|
-
Returns:
|
|
157
|
-
A dictionary containing the response details:
|
|
158
|
-
- status (str): 'success' or 'error'
|
|
159
|
-
- content (str): Extracted text content from the response
|
|
160
|
-
- task_id (str, optional): ID of the created/updated task
|
|
161
|
-
- task_state (str, optional): Current state of the task
|
|
162
|
-
- raw_response (str): Complete JSON response from the A2A client
|
|
163
|
-
- error_type (str, optional): Type of error if status is 'error'
|
|
164
|
-
- message (str, optional): Error message if status is 'error'
|
|
165
|
-
|
|
166
|
-
Raises:
|
|
167
|
-
httpx.HTTPError: If there's an HTTP-related error during the request.
|
|
168
|
-
Exception: For any other unexpected errors during message sending or processing.
|
|
169
|
-
"""
|
|
170
|
-
async def astream_to_agent(self, agent_card: AgentCard, message: str | dict[str, Any], **kwargs: Any) -> AsyncGenerator[dict[str, Any], None]:
|
|
171
|
-
"""Asynchronously sends a streaming message to another agent using the A2A protocol.
|
|
172
|
-
|
|
173
|
-
This method supports streaming responses from the target agent, yielding chunks of
|
|
174
|
-
the response as they become available. It handles various types of streaming events
|
|
175
|
-
including task status updates, artifact updates, and message parts.
|
|
176
|
-
|
|
177
|
-
Args:
|
|
178
|
-
agent_card: The AgentCard instance containing the target agent's details including
|
|
179
|
-
URL, authentication requirements, and capabilities.
|
|
180
|
-
message: The message to send to the agent. Can be either a string for simple text
|
|
181
|
-
messages or a dictionary for structured data.
|
|
182
|
-
**kwargs: Additional keyword arguments.
|
|
183
|
-
|
|
184
|
-
Yields:
|
|
185
|
-
Dictionaries containing streaming response chunks:
|
|
186
|
-
For successful chunks:
|
|
187
|
-
- status (str): 'success'
|
|
188
|
-
- content (str): Extracted text content from the chunk
|
|
189
|
-
- task_id (str): ID of the associated task
|
|
190
|
-
- task_state (str): Current state of the task
|
|
191
|
-
- final (bool): Whether this is the final chunk
|
|
192
|
-
- artifact_name (str, optional): Name of the artifact if chunk is an artifact update
|
|
193
|
-
For error chunks:
|
|
194
|
-
- status (str): 'error'
|
|
195
|
-
- error_type (str): Type of error encountered
|
|
196
|
-
- message (str): Error description
|
|
197
|
-
|
|
198
|
-
Raises:
|
|
199
|
-
httpx.HTTPError: If there's an HTTP-related error during the streaming request.
|
|
200
|
-
Exception: For any other unexpected errors during message streaming or processing.
|
|
201
|
-
"""
|
|
202
|
-
@staticmethod
|
|
203
|
-
def format_agent_description(agent_card: AgentCard) -> str:
|
|
204
|
-
"""Format the description of an agent card including skills information.
|
|
205
|
-
|
|
206
|
-
Args:
|
|
207
|
-
agent_card (AgentCard): The agent card to format.
|
|
208
|
-
|
|
209
|
-
Returns:
|
|
210
|
-
str: The formatted description including skills.
|
|
211
|
-
"""
|
|
212
|
-
def add_mcp_server(self, mcp_config: dict[str, dict[str, Any]]) -> None:
|
|
213
|
-
"""Adds MCP servers to the agent.
|
|
214
|
-
|
|
215
|
-
Args:
|
|
216
|
-
mcp_config: A dictionary containing MCP server configurations.
|
|
217
|
-
|
|
218
|
-
Raises:
|
|
219
|
-
ValueError: If the MCP configuration is empty or None.
|
|
220
|
-
KeyError: If a server with the same name already exists in the MCP configuration.
|
|
221
|
-
"""
|