Skip to content

Commit 6c1d9f5

Browse files
committed
feat: Add connect timeout to McpToolset
The default is too low when using supergateway with uvx.
1 parent b245337 commit 6c1d9f5

2 files changed

Lines changed: 39 additions & 2 deletions

File tree

adk/README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,25 @@ Basic usage example:
2222

2323
```python
2424
from agenticlayer.agent_to_a2a import to_a2a
25+
from agenticlayer.config import parse_sub_agents, parse_tools
2526
from agenticlayer.otel import setup_otel
27+
from google.adk.agents import LlmAgent
2628

2729
# Set up OpenTelemetry instrumentation, logging and metrics
2830
setup_otel()
2931

32+
# Parse sub agents and tools from JSON configuration
33+
sub_agent, agent_tools = parse_sub_agents("{}")
34+
mcp_tools = parse_tools("{}")
35+
tools = agent_tools + mcp_tools
36+
3037
# Declare your ADK root agent
31-
root_agent = ...
38+
root_agent = LlmAgent(
39+
name="root-agent",
40+
sub_agents=sub_agent,
41+
tools=tools,
42+
# [...]
43+
)
3244

3345
# Define the URL where the agent will be available from outside
3446
# This can not be determined automatically,
@@ -40,6 +52,30 @@ rpc_url = "http://localhost:8000/"
4052
app = to_a2a(root_agent, rpc_url)
4153
```
4254

55+
## Configuration
56+
57+
The JSON configuration for sub agents should follow this structure:
58+
```json5
59+
{
60+
"agent_name": {
61+
"url": "http://agent-url/.well-known/agent-card.json",
62+
// Optional: interaction type, defaults to "tool_call"
63+
// "transfer" for full delegation, "tool_call" for tool-like usage
64+
"interaction_type": "transfer|tool_call"
65+
}
66+
}
67+
```
68+
69+
The JSON configuration for `AGENT_TOOLS` should follow this structure:
70+
```json5
71+
{
72+
"tool_name": {
73+
"url": "https://mcp-tool-endpoint:8000/mcp",
74+
"timeout": 30 // Optional: connect timeout in seconds
75+
}
76+
}
77+
```
78+
4379
## OpenTelemetry Configuration
4480

4581
The SDK automatically configures OpenTelemetry observability when running `setup_otel()`. You can customize the OTLP

adk/agenticlayer/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def parse_sub_agents(sub_agents_config: str) -> tuple[list[BaseAgent], list[Tool
5050
def parse_tools(tools_config: str) -> list[ToolUnion]:
5151
"""
5252
Get tools from JSON string.
53-
Format: {"tool_name": {"url": "http://tool_url"}, ...}
53+
Format: {"tool_name": {"url": "http://tool_url", "timeout": 30}, ...}
5454
5555
:return: A list of McpToolset tools
5656
"""
@@ -70,6 +70,7 @@ def parse_tools(tools_config: str) -> list[ToolUnion]:
7070
McpToolset(
7171
connection_params=StreamableHTTPConnectionParams(
7272
url=config["url"],
73+
timeout=config.get("timeout", 30),
7374
),
7475
)
7576
)

0 commit comments

Comments
 (0)