Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion samples/agent/adk/orchestrator/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@
import json
import logging
import os
from typing import List
from typing import Any, List
from a2a.types import AgentCard
from a2a.client.client import Consumer
from a2a.client import A2ACardResolver
from a2a.client.client import Client
from a2a.client.middleware import ClientCallContext
from a2a.extensions.common import HTTP_EXTENSION_HEADER
from google.adk.models.lite_llm import LiteLlm
from google.adk.agents.llm_agent import LlmAgent
Expand Down
1 change: 1 addition & 0 deletions samples/agent/adk/orchestrator/agent_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
A2aAgentExecutorConfig,
A2aAgentExecutor,
)
from google.adk.a2a.converters.request_converter import AgentRunRequest
from a2a.types import AgentCapabilities, AgentCard, AgentExtension
from a2ui.a2ui_extension import is_a2ui_part, try_activate_a2ui_extension, A2UI_EXTENSION_URI, STANDARD_CATALOG_ID, SUPPORTED_CATALOG_IDS_KEY, get_a2ui_agent_extension, A2UI_CLIENT_CAPABILITIES_KEY
from google.adk.a2a.converters import event_converter
Expand Down
Empty file.
45 changes: 41 additions & 4 deletions samples/client/lit/shell/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,53 @@ export class A2UIClient {
}

const result = (response as SendMessageSuccessResponse).result as Task;
if (result.kind === "task" && result.status.message?.parts) {
const messages: v0_8.Types.ServerToClientMessage[] = [];
const messages: v0_8.Types.ServerToClientMessage[] = [];

console.log("A2A Response:", JSON.stringify(result, null, 2));

// Check for parts in the task status message (streaming/task-based responses)
if (result.kind === "task" && result.status?.message?.parts) {
console.log("Found parts in task status message");
for (const part of result.status.message.parts) {
if (part.kind === 'data') {
messages.push(part.data as v0_8.Types.ServerToClientMessage);
}
}
return messages;
if (messages.length > 0) return messages;
}

// Check for parts in artifacts (blocking responses)
if (result.artifacts && result.artifacts.length > 0) {
console.log("Found artifacts:", result.artifacts.length);
for (const artifact of result.artifacts) {
if (artifact.parts) {
for (const part of artifact.parts) {
console.log("Artifact part kind:", part.kind);
if (part.kind === 'data') {
messages.push(part.data as v0_8.Types.ServerToClientMessage);
}
}
}
}
if (messages.length > 0) return messages;
}

// Check for parts in the last history message (agent response)
if (result.history && result.history.length > 0) {
console.log("Found history:", result.history.length);
const lastMessage = result.history[result.history.length - 1];
console.log("Last message role:", lastMessage.role);
if (lastMessage.role === 'agent' && lastMessage.parts) {
for (const part of lastMessage.parts) {
console.log("History part kind:", part.kind);
if (part.kind === 'data') {
messages.push(part.data as v0_8.Types.ServerToClientMessage);
}
}
}
}

return [];
console.log("Total messages found:", messages.length);
return messages;
}
}