Skip to content

Commit 504ae2e

Browse files
committed
docs: Add A2A logging documentation
1 parent 7773037 commit 504ae2e

File tree

3 files changed

+80
-9
lines changed

3 files changed

+80
-9
lines changed

docs/a2a/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
With Agent Development Kit (ADK), you can build complex multi-agent systems where different agents need to collaborate and interact using [Agent2Agent (A2A) Protocol](https://a2a-protocol.org/)! This section provides a comprehensive guide to building powerful multi-agent systems where agents can communicate and collaborate securely and efficiently.
44

5-
Navigate through the guides below to learn about ADK's A2A capabilities:
5+
Navigate through the guides below to learn about ADK\'s A2A capabilities:
66

77
**[Introduction to A2A](./intro.md)**
88

@@ -16,6 +16,10 @@ Navigate through the guides below to learn about ADK's A2A capabilities:
1616

1717
This quickstart covers: **"There is a remote agent, how do I let my ADK agent use it via A2A?"**.
1818

19+
**[A2A Logging](./logging.md)**
20+
21+
Learn how to enable and interpret the detailed and structured logs for A2A communication, which is invaluable for debugging and monitoring multi-agent systems.
22+
1923
[**Official Website for Agent2Agent (A2A) Protocol**](https://a2a-protocol.org/)
2024

2125
The official website for A2A Protocol.

docs/a2a/logging.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# A2A Logging
2+
3+
The ADK provides detailed and structured logging for A2A (Agent-to-Agent) communication, which is invaluable for debugging and monitoring multi-agent systems. When you enable debug-level logging, the ADK will output rich information about A2A requests and responses.
4+
5+
## Enabling A2A Logging
6+
7+
To enable A2A logging, you can set the log level to `debug` when running your ADK server. For example:
8+
9+
```bash
10+
adk api_server --a2a --port 8001 path/to/your/agent --log_level debug
11+
```
12+
13+
## Understanding the Logs
14+
15+
The A2A logs are designed to be human-readable and provide a clear view of the communication between agents.
16+
17+
### A2A Request Logs
18+
19+
When an agent sends a message to another agent via A2A, a log entry similar to the following is generated:
20+
21+
```
22+
A2A Send Message Request:
23+
-----------------------------------------------------------
24+
Message:
25+
ID: <message_id>
26+
Role: <role>
27+
Task ID: <task_id>
28+
Context ID: <context_id>
29+
-----------------------------------------------------------
30+
Message Parts:
31+
Part 0: <part_content>
32+
...
33+
-----------------------------------------------------------
34+
```
35+
36+
The request log includes:
37+
- **Message**: Core details of the message, including its ID, role, task ID, and context ID.
38+
- **Message Parts**: The content of each part of the message. For text parts, a snippet of the text is shown. For data parts, a summary of the data keys is provided.
39+
40+
### A2A Response Logs
41+
42+
When an agent receives a response from another agent, a log entry is generated that can represent either a `Task` or a `Message`:
43+
44+
```
45+
A2A Response:
46+
-----------------------------------------------------------
47+
Type: SUCCESS
48+
Result Type: <result_type>
49+
-----------------------------------------------------------
50+
Result Details:
51+
...
52+
-----------------------------------------------------------
53+
Status Message:
54+
...
55+
-----------------------------------------------------------
56+
History:
57+
...
58+
-----------------------------------------------------------
59+
```
60+
61+
The response log includes:
62+
- **Result Type**: The type of the result, which can be a `ClientEvent` (containing a `Task`) or a `Message`.
63+
- **Result Details**: Detailed information about the result, such as task status, message content, and metadata.
64+
- **Status Message**: If the response is a task update, this section contains the status message from the remote agent.
65+
- **History**: The conversation history associated with the task.
66+
67+
By inspecting these logs, you can trace the flow of communication between your agents, understand the content of the messages being exchanged, and diagnose any issues that may arise.

docs/a2a/quickstart-consuming.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ You can clone and navigate to the [**`a2a_basic`** sample](https://github.com/go
4141
git clone https://github.com/google/adk-python.git
4242
```
4343

44-
As you'll see, the folder structure is as follows:
44+
As you\'ll see, the folder structure is as follows:
4545

4646
```text
4747
a2a_basic/
@@ -70,7 +70,7 @@ a2a_basic/
7070

7171
### 2. Start the Remote Prime Agent server { #start-the-remote-prime-agent-server }
7272

73-
To show how your ADK agent can consume a remote agent via A2A, you'll first need to start a remote agent server, which will host the prime agent (under `check_prime_agent`).
73+
To show how your ADK agent can consume a remote agent via A2A, you\'ll first need to start a remote agent server, which will host the prime agent (under `check_prime_agent`).
7474

7575
```bash
7676
# Start the remote a2a server that serves the check_prime_agent on port 8001
@@ -82,10 +82,10 @@ adk api_server --a2a --port 8001 contributing/samples/a2a_basic/remote_a2a
8282
```bash
8383
adk api_server --a2a --port 8001 contributing/samples/a2a_basic/remote_a2a --log_level debug
8484
```
85-
This will give richer logs for you to inspect when testing your agents.
85+
This will give richer logs for you to inspect when testing your agents. To learn more about A2A logging, see the [A2A Logging](./logging.md) guide.
8686

8787
??? note "Why use port 8001?"
88-
In this quickstart, when testing locally, your agents will be using localhost, so the `port` for the A2A server for the exposed agent (the remote, prime agent) must be different from the consuming agent's port. The default port for `adk web` where you will interact with the consuming agent is `8000`, which is why the A2A server is created using a separate port, `8001`.
88+
In this quickstart, when testing locally, your agents will be using localhost, so the `port` for the A2A server for the exposed agent (the remote, prime agent) must be different from the consuming agent\'s port. The default port for `adk web` where you will interact with the consuming agent is `8000`, which is why the A2A server is created using a separate port, `8001`.
8989

9090
Once executed, you should see something like:
9191

@@ -127,7 +127,7 @@ In the sample, the `check_prime_agent` already has an agent card provided:
127127

128128
??? note "More info on agent cards in ADK"
129129

130-
In ADK, you can use a `to_a2a(root_agent)` wrapper which automatically generates an agent card for you. If you're interested in learning more about how to expose your existing agent so others can use it, then please look at the [A2A Quickstart (Exposing)](quickstart-exposing.md) tutorial.
130+
In ADK, you can use a `to_a2a(root_agent)` wrapper which automatically generates an agent card for you. If you\'re interested in learning more about how to expose your existing agent so others can use it, then please look at the [A2A Quickstart (Exposing)](quickstart-exposing.md) tutorial.
131131

132132
### 4. Run the Main (Consuming) Agent { #run-the-main-consuming-agent }
133133

@@ -217,13 +217,13 @@ Bot: Yes, 7 is a prime number.
217217
This interaction uses both the local Roll Agent and the remote Prime Agent:
218218

219219
```text
220-
User: Roll a 10-sided die and check if it's prime
220+
User: Roll a 10-sided die and check if it\'s prime
221221
Bot: I rolled an 8 for you.
222222
Bot: 8 is not a prime number.
223223
```
224224

225225
## Next Steps
226226

227-
Now that you have created an agent that's using a remote agent via an A2A server, the next step is to learn how to connect to it from another agent.
227+
Now that you have created an agent that\'s using a remote agent via an A2A server, the next step is to learn how to connect to it from another agent.
228228

229-
- [**A2A Quickstart (Exposing)**](./quickstart-exposing.md): Learn how to expose your existing agent so that other agents can use it via the A2A Protocol.
229+
- [**A2A Quickstart (Exposing)**](./quickstart-exposing.md): Learn how to expose your existing agent so that other agents can use it via the A2A Protocol.

0 commit comments

Comments
 (0)