Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 3 additions & 51 deletions python/examples/adk-demo/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 0 additions & 80 deletions python/examples/ap2-demo/client_agent/_remote_agent_connection.py

This file was deleted.

164 changes: 0 additions & 164 deletions python/examples/ap2-demo/client_agent/_task_store.py

This file was deleted.

44 changes: 35 additions & 9 deletions python/examples/ap2-demo/client_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,40 @@
# limitations under the License.
import httpx

# Local imports
from client_agent._task_store import TaskStore
from google.adk.agents.remote_a2a_agent import RemoteA2aAgent
from client_agent.client_agent import ClientAgent

root_agent = ClientAgent(
remote_agent_addresses=[
"http://localhost:10000/agents/merchant_agent",
],
http_client=httpx.AsyncClient(timeout=30),
task_callback=TaskStore().update_task,
).create_agent()
# The addresses of the remote agents this agent will talk to.
REMOTE_AGENT_ADDRESSES = [
"http://localhost:10000/agents/merchant_agent",
]


def create_root_agent():
"""Creates and returns the root agent."""
# Create an httpx client to be shared across all remote agents.
async_client = httpx.AsyncClient(timeout=30)

# Create RemoteA2aAgent instances for each remote agent.
remote_agents = []
for address in REMOTE_AGENT_ADDRESSES:
# The server exposes the agent card at a path relative to the agent's RPC endpoint.
agent_card_url = f"{address}/.well-known/agent-card.json"
agent_name = address.split("/")[-1]
remote_agents.append(
RemoteA2aAgent(
name=agent_name,
agent_card=agent_card_url,
httpx_client=async_client,
)
)

# Create the main orchestrator agent, passing the remote agents as tools.
client_agent_impl = ClientAgent(
remote_agents=remote_agents,
http_client=async_client,
)
return client_agent_impl.create_agent()


root_agent = create_root_agent()
Loading
Loading