|
1 | | -package com.google.adk.a2a; |
| 1 | +/* |
| 2 | + * Copyright 2026 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package com.google.adk.a2a.agent; |
2 | 17 |
|
3 | 18 | import static com.google.common.base.Strings.nullToEmpty; |
4 | 19 |
|
|
44 | 59 | import org.slf4j.LoggerFactory; |
45 | 60 |
|
46 | 61 | /** |
47 | | - * Agent that communicates with a remote A2A agent via A2A client. |
48 | | - * |
49 | | - * <p>This agent supports multiple ways to specify the remote agent: |
| 62 | + * Agent that communicates with a remote A2A agent via an A2A client. |
50 | 63 | * |
51 | | - * <ol> |
52 | | - * <li>Direct AgentCard object |
53 | | - * <li>URL to agent card JSON |
54 | | - * <li>File path to agent card JSON |
55 | | - * </ol> |
| 64 | + * <p>The remote agent can be specified directly by providing an {@link AgentCard} to the builder, |
| 65 | + * or it can be resolved automatically using the provided A2A client. |
56 | 66 | * |
57 | | - * <p>The agent handles: |
| 67 | + * <p>Key responsibilities of this agent include: |
58 | 68 | * |
59 | 69 | * <ul> |
60 | 70 | * <li>Agent card resolution and validation |
61 | | - * <li>A2A message conversion and error handling |
62 | | - * <li>Session state management across requests |
| 71 | + * <li>Converting ADK session history events into A2A requests ({@link io.a2a.spec.Message}) |
| 72 | + * <li>Handling streaming and non-streaming responses from the A2A client |
| 73 | + * <li>Buffering and aggregating streamed response chunks into ADK {@link |
| 74 | + * com.google.adk.events.Event}s |
| 75 | + * <li>Converting A2A client responses back into ADK format |
63 | 76 | * </ul> |
64 | | - * |
65 | | - * <p>**EXPERIMENTAL:** Subject to change, rename, or removal in any future patch release. Do not |
66 | | - * use in production code. |
67 | 77 | */ |
68 | 78 | public class RemoteA2AAgent extends BaseAgent { |
69 | 79 |
|
@@ -436,7 +446,7 @@ private boolean mergeAggregatedContentIntoEvent(Event event) { |
436 | 446 | } |
437 | 447 | Content aggregatedContent = Content.builder().role("model").parts(parts).build(); |
438 | 448 |
|
439 | | - event.setContent(Optional.of(aggregatedContent)); |
| 449 | + event.setContent(aggregatedContent); |
440 | 450 |
|
441 | 451 | ImmutableList.Builder<CustomMetadata> newMetadata = ImmutableList.builder(); |
442 | 452 | event.customMetadata().ifPresent(newMetadata::addAll); |
|
0 commit comments