Skip to content

Commit 25e7e48

Browse files
tedwonamineremache
authored andcommitted
feat(samples): add real-estate-agent sample
This commit introduces a new, self-contained sample for a real-estate agent. The sample demonstrates an agent capable of understanding natural language queries to search for rental properties. It is composed of three services orchestrated with Docker Compose: - A core Python A2A agent (`real-estate-agent`). - A Node.js MCP tool server (`dafty-mcp`) for interacting with a real-estate service. - A local LLM service (`ollama`) for natural language understanding. The sample is fully self-contained, with all necessary code and configuration included. The README provides detailed instructions for setup, usage, and testing, and directs contributions back to the original source repositories.
1 parent e9857f1 commit 25e7e48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+15191
-18
lines changed

demo/ui/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
"""
55

66
import os
7+
import sys
8+
9+
# Add the project root to the Python path
10+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'samples', 'python')))
711

812
from contextlib import asynccontextmanager
913

samples/java/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The project implements an intelligent translation agent supporting multi-languag
7979
Complete implementation of A2A protocol specifications:
8080

8181
**Core Operations**:
82-
- `tasks/send`: Send task messages
82+
- `message/send`: Send task messages
8383
- `tasks/get`: Query task status
8484
- `tasks/cancel`: Cancel task execution
8585

@@ -172,7 +172,7 @@ curl -X POST http://localhost:8080/a2a \
172172
-d '{
173173
"jsonrpc": "2.0",
174174
"id": "request-1",
175-
"method": "tasks/send",
175+
"method": "message/send",
176176
"params": {
177177
"id": "translation-task-1",
178178
"message": {
@@ -199,7 +199,7 @@ curl -X POST http://localhost:8080/a2a/stream \
199199
-d '{
200200
"jsonrpc": "2.0",
201201
"id": "stream-request-1",
202-
"method": "tasks/send",
202+
"method": "message/send",
203203
"params": {
204204
"id": "streaming-translation-task",
205205
"message": {

samples/java/client/src/main/java/com/google/a2a/client/A2AClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public JSONRPCResponse sendTask(TaskSendParams params) throws A2AClientException
6060
JSONRPCRequest request = new JSONRPCRequest(
6161
generateRequestId(),
6262
"2.0",
63-
"tasks/send",
63+
"message/send",
6464
params
6565
);
6666

@@ -116,7 +116,7 @@ public CompletableFuture<Void> sendTaskStreaming(TaskSendParams params, Streamin
116116
JSONRPCRequest request = new JSONRPCRequest(
117117
generateRequestId(),
118118
"2.0",
119-
"tasks/send",
119+
"message/send",
120120
params
121121
);
122122

samples/java/server/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Content-Type: application/json
5454
{
5555
"jsonrpc": "2.0",
5656
"id": "request-1",
57-
"method": "tasks/send",
57+
"method": "message/send",
5858
"params": {
5959
"id": "task-1",
6060
"message": {

samples/java/server/src/main/java/com/google/a2a/server/A2AController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public ResponseEntity<JSONRPCResponse> handleJsonRpcRequest(@RequestBody JSONRPC
6565
}
6666

6767
JSONRPCResponse response = switch (request.method()) {
68-
case "tasks/send" -> server.handleTaskSend(request);
68+
case "message/send" -> server.handleTaskSend(request);
6969
case "tasks/get" -> server.handleTaskGet(request);
7070
case "tasks/cancel" -> server.handleTaskCancel(request);
7171
default -> {
@@ -101,7 +101,7 @@ public SseEmitter handleStreamingTask(@RequestBody JSONRPCRequest request) {
101101
// Process task asynchronously
102102
CompletableFuture.runAsync(() -> {
103103
try {
104-
if (!"tasks/send".equals(request.method())) {
104+
if (!"message/send".equals(request.method())) {
105105
sendErrorEvent(emitter, request.id(), ErrorCode.METHOD_NOT_FOUND, "Method not found");
106106
return;
107107
}

samples/java/server/src/test/java/com/google/a2a/server/A2AServerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void testHandleTaskSend() {
104104
JSONRPCRequest request = new JSONRPCRequest(
105105
"request-1",
106106
"2.0",
107-
"tasks/send",
107+
"message/send",
108108
params
109109
);
110110

@@ -156,7 +156,7 @@ void testHandleTaskGet() {
156156
JSONRPCRequest sendRequest = new JSONRPCRequest(
157157
"request-1",
158158
"2.0",
159-
"tasks/send",
159+
"message/send",
160160
sendParams
161161
);
162162

@@ -216,7 +216,7 @@ void testHandleTaskCancel() {
216216
JSONRPCRequest sendRequest = new JSONRPCRequest(
217217
"request-1",
218218
"2.0",
219-
"tasks/send",
219+
"message/send",
220220
sendParams
221221
);
222222

samples/multi_language/python_and_java_multiagent/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The `AgentCard` and `AgentExecutor` classes mentioned above are part of the [A2A
4040
```xml
4141
...
4242
<properties>
43-
<io.a2a.sdk.version>0.2.3</io.a2a.sdk.version>
43+
<io.a2a.sdk.version>0.2.3.Beta</io.a2a.sdk.version>
4444
...
4545
</properties>
4646
...
@@ -138,16 +138,16 @@ uv run .
138138

139139
> *⚠️ This is a temporary step until our A2A Java SDK is released.
140140
> The A2A Java SDK isn't available yet in Maven Central but will be soon. For now, be
141-
> sure to check out the latest tag (you can see the tags [here](https://github.com/a2aproject/a2a-java/tags)), build from the tag, and reference that version below. For example, if the latest tag is `0.2.3`, you can use
142-
`git checkout 0.2.3` as shown below.*
141+
> sure to check out the latest tag (you can see the tags [here](https://github.com/a2aproject/a2a-java/tags)), build from the tag, and reference that version below. For example, if the latest tag is `0.2.3.Beta`, you can use
142+
`git checkout 0.2.3.Beta` as shown below.*
143143

144144
Open a new terminal and build the A2A Java SDK:
145145

146146
```bash
147147
git clone https://github.com/a2aproject/a2a-java
148148
cd a2a-java
149149
git fetch --tags
150-
git checkout 0.2.3
150+
git checkout 0.2.3.Beta
151151
mvn clean install
152152
```
153153

samples/multi_language/python_and_java_multiagent/weather_agent/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<maven.compiler.source>17</maven.compiler.source>
1313
<maven.compiler.target>17</maven.compiler.target>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15-
<io.a2a.sdk.version>0.2.3</io.a2a.sdk.version>
15+
<io.a2a.sdk.version>0.2.3.Beta</io.a2a.sdk.version>
1616
<jakarta.enterprise.cdi-api.version>4.1.0</jakarta.enterprise.cdi-api.version>
1717
<quarkus.platform.version>3.22.3</quarkus.platform.version>
1818
<quarkus.langchain4j.version>1.0.0</quarkus.langchain4j.version>

samples/python/agents/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ To interact with the servers, use an A2AClient in a host app (such as the CLI).
88

99
## Agents Directory
1010

11-
* [**Google ADK Facts**](/samples/python/agents/adk-facts/README.md)
11+
* [**Google ADK Facts**](/samples/python/agents/adk_facts/README.md)
1212
Sample agent to give fun facts using Grounding with Google Search and ADK
1313

14-
* [**Google ADK Expense Reimbursement**](/samples/python/agents/adk-expense-reimbursement/README.md)
14+
* [**Google ADK Expense Reimbursement**](/samples/python/agents/adk_expense_reimbursement/README.md)
1515
Sample agent to (mock) fill out expense reports. Showcases multi-turn interactions and returning/replying to webforms through A2A.
1616

1717
* [**AG2 MCP Agent with A2A Protocol**](/samples/python/agents/ag2/README.md)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.git
2+
.gitignore
3+
tests
4+
.env
5+
.vscode
6+
__pycache__
7+
*.pyc

0 commit comments

Comments
 (0)