5 Commits

Author SHA1 Message Date
Haran Rajkumar 0a62d39ff9 chore(agents): tag ManagedAgent traffic with a +managed_agent version suffix
ManagedAgent and Gemini(use_interactions_api=True) both reach the Interactions
API and surface identically as tool_name=google-adk in Google's usage pipeline,
with no way to tell them apart. Thread an optional framework_label through
merge_tracking_headers / get_tracking_headers / get_client_labels /
_get_default_labels, and have ManagedAgent emit google-adk/<version>+managed_agent
on the per-request extra_headers it sends to interactions.create, so its traffic
is distinguishable via the tool_version dimension while tool_name stays
google-adk. The suffix is applied on the request-time header path because that is
what reaches the Interactions wire (the per-request extra_headers override the
genai client's construction-time headers; verified by live capture). An explicit
framework_label takes precedence over the Agent Engine (+remote_reasoning_engine)
suffix; all other callers of merge_tracking_headers keep the no-arg default and
are unchanged. Follow-up to the ManagedAgent tracking-headers change.

Co-authored-by: Haran Rajkumar <haranrk@google.com>
PiperOrigin-RevId: 947239702
2026-07-13 14:19:30 -07:00
Haran Rajkumar cc444b6cbf docs(samples): add ManagedAgent remote MCP (Maps Grounding Lite) sample
Add a runnable sample wiring `ManagedAgent` to the Maps Grounding Lite MCP
server via `RemoteMcpServer`, with a `header_provider` callback that reads
`GOOGLE_MAPS_API_KEY` and sends it as the `X-Goog-Api-Key` header. Demonstrates
server-side remote MCP execution with runtime header minting.

Co-authored-by: Haran Rajkumar <haranrk@google.com>
PiperOrigin-RevId: 947137422
2026-07-13 11:07:40 -07:00
Haran Rajkumar 2e2ec09a76 feat(agents): support remote MCP servers for ManagedAgent with runtime header callbacks
Add `RemoteMcpServer`, a server-side remote MCP tool for `ManagedAgent`. The
Managed Agents / Interactions API runs the MCP server itself, so ADK only
forwards the server URL and headers as an `MCPServerParam` and never opens an
MCP session. A `header_provider` callback (the same contract as the `LlmAgent`
`McpToolset.header_provider`) mints auth headers at request time, driven by the
runner, and is merged over any static headers so a fresh token can be generated
per turn.

Only remote (HTTP/streamable) MCP servers are supported; raw
`types.Tool.mcp_servers` remains rejected. Includes a live integration test
against Maps Grounding Lite, scoped to the Gemini Developer API backend; the
Vertex Interactions endpoint does not yet accept the `mcp_server` tool param
(consistent with google-genai documenting `types.Tool.mcp_servers` as
unsupported on Vertex AI).

Co-authored-by: Haran Rajkumar <haranrk@google.com>
PiperOrigin-RevId: 945306712
2026-07-09 14:07:52 -07:00
Haran Rajkumar 527e3c1089 docs(samples): Add ManagedAgent code-execution sample
Add a runnable sample under contributing/samples/managed_agent/code_execution
showing how to use ManagedAgent with the server-side code execution tool. Since
ManagedAgent has no code_executor field, code execution is enabled by passing the
raw types.Tool(code_execution=types.ToolCodeExecution()) config in tools. The
sample exposes a root_agent in agent.py and ships a README plus a matching
single-turn live integration test that verifies a code-executed prime-sum
computation.

Co-authored-by: Haran Rajkumar <haranrk@google.com>
PiperOrigin-RevId: 943548907
2026-07-06 16:15:37 -07:00
Haran Rajkumar cf91b8443f feat(agents): add ManagedAgent backed by the Managed Agents API
Add ManagedAgent(BaseAgent), which drives the Managed Agents interactions.create
API directly. This first cut supports server-side tools only (ADK built-in tools
and raw types.Tool configs); client-executed tools (FunctionTool/callables) and
MCP are rejected with NotImplementedError. Multi-turn chaining reuses
previous_interaction_id and recovers the sandbox environment across turns.

Co-authored-by: Haran Rajkumar <haranrk@google.com>
PiperOrigin-RevId: 943406685
2026-07-06 11:38:04 -07:00