Skip to content

Commit 0037c3c

Browse files
authored
feat: Update Orchestrator client app to display smartchips on welcome screen. (#417)
Additional changes include - Marking a2ui python library pyproject.toml as editable=true so that local changes are applied to the agents without extra uv manipulation - Add missing imports to orchestrator agents code.
1 parent b61bfb3 commit 0037c3c

File tree

8 files changed

+1447
-1346
lines changed

8 files changed

+1447
-1346
lines changed

samples/agent/adk/orchestrator/agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import json
1616
import logging
1717
import os
18-
from typing import List
1918
from a2a.client import A2ACardResolver
2019
from a2a.extensions.common import HTTP_EXTENSION_HEADER
2120
from google.adk.models.lite_llm import LiteLlm
@@ -30,10 +29,11 @@
3029
from google.adk.models.llm_request import LlmRequest
3130
from google.adk.models.llm_response import LlmResponse
3231
from subagent_route_manager import SubagentRouteManager
33-
from typing import override
32+
from typing import Any, override, List
3433
from a2a.types import TransportProtocol as A2ATransport
3534

36-
from a2a.client.middleware import ClientCallInterceptor
35+
from a2a.client.client import Consumer, Client
36+
from a2a.client.middleware import ClientCallContext, ClientCallInterceptor
3737
from a2a.client.client import ClientConfig as A2AClientConfig
3838
from a2a.client.client_factory import ClientFactory as A2AClientFactory
3939
from a2ui.a2ui_extension import is_a2ui_part, A2UI_CLIENT_CAPABILITIES_KEY, A2UI_EXTENSION_URI, AGENT_EXTENSION_SUPPORTED_CATALOG_IDS_KEY, AGENT_EXTENSION_ACCEPTS_INLINE_CATALOGS_KEY, get_a2ui_agent_extension

samples/agent/adk/orchestrator/agent_executor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from google.adk.memory.in_memory_memory_service import InMemoryMemoryService
2727
from google.adk.runners import Runner
2828
from google.adk.sessions import InMemorySessionService
29+
from google.adk.a2a.converters.request_converter import AgentRunRequest
2930
from google.adk.a2a.executor.a2a_agent_executor import (
3031
A2aAgentExecutorConfig,
3132
A2aAgentExecutor,

samples/agent/adk/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ default = true
66
members = ["contact_lookup", "orchestrator", "restaurant_finder", "rizzcharts"]
77

88
[tool.uv.sources]
9-
a2ui = { path = "../../../a2a_agents/python/a2ui_extension" }
9+
a2ui = { path = "../../../a2a_agents/python/a2ui_extension", editable = true }
1010

samples/agent/adk/rizzcharts/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ url = "https://pypi.org/simple"
3030
default = true
3131

3232
[tool.uv.sources]
33-
a2ui = { path = "../../../../a2a_agents/python/a2ui_extension" }
33+
a2ui = { path = "../../../../a2a_agents/python/a2ui_extension", editable = true }

samples/agent/adk/uv.lock

Lines changed: 1338 additions & 1338 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/angular/projects/orchestrator/src/app/app.html

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,36 @@
1515
-->
1616

1717
<main class="main">
18-
<a2a-chat-canvas [messageDecorator]="demoMessageDecorator"></a2a-chat-canvas>
18+
<a2a-chat-canvas [messageDecorator]="demoMessageDecorator" [emptyHistoryTemplate]="welcomeMessage"></a2a-chat-canvas>
1919
</main>
2020

21+
<ng-template #welcomeMessage>
22+
<div class="empty-history">
23+
<div class="agent-header">
24+
<div class="agent-header-part agent-name">
25+
<strong>{{ agentName() }}</strong>
26+
</div>
27+
</div>
28+
<br />
29+
30+
<p class="empty-history-text">
31+
I help you orchestrate tasks across multiple agents.
32+
</p>
33+
<div class="suggestion-chips">
34+
<button mat-stroked-button class="chip" (click)="sendMessage('List Chinese restaurants in New York')">
35+
<span class="material-icons-outlined">restaurant</span>
36+
List restaurants
37+
</button>
38+
<button mat-stroked-button class="chip" (click)="sendMessage('List all contacts')">
39+
<span class="material-icons-outlined">contacts</span>
40+
List contacts
41+
</button>
42+
<button mat-stroked-button class="chip" (click)="sendMessage('Show me charts')">
43+
<span class="material-icons-outlined">analytics</span>
44+
Show me charts
45+
</button>
46+
</div>
47+
</div>
48+
</ng-template>
49+
2150
<router-outlet />

samples/client/angular/projects/orchestrator/src/app/app.scss

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,67 @@
1414

1515
main {
1616
height: 100vh;
17+
}
18+
19+
.empty-history {
20+
display: block;
21+
padding-bottom: 8rem;
22+
padding-top: 2rem;
23+
text-align: center;
24+
}
25+
26+
.empty-history-text {
27+
margin: 0;
28+
font: var(--mat-sys-display-small);
29+
margin-bottom: 2rem;
30+
}
31+
32+
.agent-header {
33+
display: flex;
34+
align-items: center;
35+
flex-flow: row wrap;
36+
justify-content: center;
37+
margin-bottom: 1rem;
38+
}
39+
40+
.agent-header-part {
41+
margin-inline-end: 1.25rem;
42+
margin-block: 8px;
43+
font-size: 1.5rem;
44+
}
45+
46+
.agent-name {
47+
background: linear-gradient(
48+
90deg,
49+
#217bfe 28.03%,
50+
#078efb 49.56%,
51+
#ac87eb 71.1%
52+
);
53+
background-clip: text;
54+
color: transparent;
55+
}
56+
57+
.suggestion-chips {
58+
display: flex;
59+
flex-wrap: wrap;
60+
gap: 8px;
61+
justify-content: center;
62+
margin-top: 32px;
63+
}
64+
65+
.chip {
66+
// Override Material button styles to look like a chip
67+
border-radius: 100px !important; // Force pill shape
68+
padding: 10px 16px !important;
69+
display: inline-flex !important;
70+
align-items: center !important;
71+
height: auto !important;
72+
line-height: 25px !important; // Match icon height
73+
.material-icons-outlined {
74+
font-size: 20px;
75+
margin-right: 8px;
76+
line-height: 1; // Prevent icon from affecting line height
77+
position: relative;
78+
top: 4px; // Move icon down slightly to match text
79+
}
1780
}

samples/client/angular/projects/orchestrator/src/app/app.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
*/
1616

1717
import { A2aChatCanvas } from '@a2a_chat_canvas/a2a-chat-canvas';
18+
import { ChatService } from '@a2a_chat_canvas/services/chat-service';
1819
import { DOCUMENT } from '@angular/common';
19-
import { Component, Inject, OnInit, Renderer2 } from '@angular/core';
20+
import { Component, Inject, OnInit, Renderer2, inject, signal } from '@angular/core';
21+
import { MatButtonModule } from '@angular/material/button';
2022
import { RouterOutlet } from '@angular/router';
2123
import { environment } from '../environments/environment';
2224
import { demoMessageDecorator } from '../message-decorator/demo-message-decorator';
@@ -25,10 +27,12 @@ import { demoMessageDecorator } from '../message-decorator/demo-message-decorato
2527
selector: 'app-root',
2628
templateUrl: './app.html',
2729
styleUrl: './app.scss',
28-
imports: [A2aChatCanvas, RouterOutlet],
30+
imports: [A2aChatCanvas, RouterOutlet, MatButtonModule],
2931
})
3032
export class App implements OnInit {
3133
protected demoMessageDecorator = demoMessageDecorator;
34+
protected readonly agentName = signal('Orchestrator Agent');
35+
private readonly chatService = inject(ChatService);
3236

3337
constructor(
3438
private _renderer2: Renderer2,
@@ -42,4 +46,8 @@ export class App implements OnInit {
4246
script.defer = true;
4347
this._renderer2.appendChild(this._document.body, script);
4448
}
49+
50+
sendMessage(text: string) {
51+
this.chatService.sendMessage(text);
52+
}
4553
}

0 commit comments

Comments
 (0)