Skip to content

Unable to Use Custom SessionService/MemoryService with to_a2a() #3590

@kishoreallwynraj

Description

@kishoreallwynraj

Describe the bug
The google.adk.a2a.utils.agent_to_a2a.to_a2a() function does not support passing a Runner with custom SessionService and MemoryService. This prevents integration with external session/memory backends (e.g., AWS Bedrock AgentCore Memory, database-backed sessions, etc.) when exposing agents via A2A protocol.

To Reproduce
The to_a2a() function signature only accepts an Agent:

from google.adk.a2a.utils.agent_to_a2a import to_a2a

# Only accepts Agent, not Runner or App
a2a_app = to_a2a(
    agent,           # ✅ Accepts Agent
    port=9000,
    agent_card=...
)

Expected behavior
The to_a2a() function should support passing a pre-configured Runner with custom services:

from google.adk.a2a.utils.agent_to_a2a import to_a2a
from google.adk.runners import Runner
from google.adk.apps import App

# Create runner with custom session and memory services
runner = Runner(
    app=app,
    session_service=MyCustomSessionService(),
    memory_service=MyCustomMemoryService()
)

# Pass runner to to_a2a() to preserve custom services
a2a_app = to_a2a(
    runner,          # ❌ Currently not supported
    port=9000,
    agent_card=...
)

Desktop (please complete the following information):

  • OS: Linux (Ubuntu WSL on Windows)
  • Python version(python -V): 3.12.3
  • ADK version(pip show google-adk): 1.18.0

Model Information:

  • Are you using LiteLLM: Yes
  • Which model is being used : Mistal Large on AWS Bedrock

Additional context
I am trying to deploy and ADK based agent on AWS Bedrock Agentcore services. I have structured my application in such a way like the Runner will take an ADK App (with plugins configured) and then runner is connected with custom session and memory implementation. Now when i want to enable A2A on the agent following the ADK documentations i see a gap as documents describe A2A at root agent and do not explain about how it will work with runner configured with different sessions and memory service. On looking into ADK code in github this looks to me like a limitation. Please correct me if my understand is not correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a2a[Component] This issue is related a2a support inside ADK.needs review[Status] The PR/issue is awaiting review from the maintainer

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions