Skip to content

The to_a2a() function should allow for configuration of artifact_service, session_service, memory_service and credential_service #3104

@secprog

Description

@secprog

Describe the bug
The to_a2a() function should allow for configuration of artifact_service, session_service, memory_service and credential_service, right now is hard coded in the runner creation, so it is impossible to use proper services.

@a2a_experimental
def to_a2a(
    agent: BaseAgent,
    *,
    host: str = "localhost",
    port: int = 8000,
    protocol: str = "http",
    agent_card: Optional[Union[AgentCard, str]] = None,
) -> Starlette:
  """Convert an ADK agent to a A2A Starlette application.

  Args:
  # Set up ADK logging to ensure logs are visible when using uvicorn directly
  
  setup_adk_logger(logging.INFO)
  async def create_runner() -> Runner:

    """Create a runner for the agent."""
    return Runner(
        app_name=agent.name or "adk_agent",
        agent=agent,
        # Use minimal services - in a real implementation these could be configured
        artifact_service=InMemoryArtifactService(),
        session_service=InMemorySessionService(),
        memory_service=InMemoryMemoryService(),
        credential_service=InMemoryCredentialService(),
    )

Metadata

Metadata

Assignees

Labels

services[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions