Skip to content

Commit dae7827

Browse files
committed
address review comments
1 parent 6c5aa71 commit dae7827

File tree

10 files changed

+188
-111
lines changed

10 files changed

+188
-111
lines changed

example-apps/agent-builder-a2a-agent-framework/Dockerfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

example-apps/agent-builder-a2a-agent-framework/docker-compose.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

example-apps/agent-builder-a2a-agent-framework/env.example

Lines changed: 0 additions & 2 deletions
This file was deleted.

example-apps/agent-builder-a2a-agent-framework/test_elastic_agent_builder_a2a.py

Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM python:3.11-slim
2+
3+
WORKDIR /app
4+
5+
RUN python -m venv /opt/venv
6+
7+
ENV PATH="/opt/venv/bin:$PATH"
8+
9+
COPY requirements.txt .
10+
11+
RUN pip install -r requirements.txt
12+
13+
COPY elastic_agent_builder_a2a.py .
14+
15+
CMD ["python", "elastic_agent_builder_a2a.py"]

example-apps/agent-builder-a2a-agent-framework/README.md renamed to supporting-blog-content/agent-builder-a2a-agent-framework/README.md

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This is an example Python console app that demonstrates how to connect and utili
88

99
1. An Elasticsearch deployment running in [Elastic Cloud](https://cloud.elastic.co/registration?utm_source=github&utm_content=elasticsearch-labs-example-apps).
1010
* Requires Elasticsearch Serverless (or for hosted deployments at least Elasticsearch version 9.2.0).
11-
2. An integrated development environment (IDE) like [Visual Studio Code](https://code.visualstudio.com/download) running on your local computer.
11+
2. A text editor or an integrated development environment (IDE) like [Visual Studio Code](https://code.visualstudio.com/download) running on your local computer.
1212
3. [Python version 3.10 or greater](https://www.python.org/downloads/) installed on your local computer.
1313

1414
## Setup your Elasticsearch deployment
@@ -72,41 +72,44 @@ This is an example Python console app that demonstrates how to connect and utili
7272

7373

7474

75-
## Running the example app
75+
## Clone the example app
7676

77-
1. Open Visual Studio Code and open a new terminal within the Visual Studio Code editor.
78-
2. In the open terminal, clone the Search Labs source code repository which contains the Elastic Agent Builder A2A App example.
77+
1. Open a terminal and clone the Search Labs source code repository which contains the Elastic Agent Builder A2A App example. Run the following command to clone the example app:
7978

8079
git clone https://github.com/elastic/elasticsearch-labs
8180

82-
3. `cd` to change directory to the example code located in the `example-apps/agent-builder-a2a-agent-framework` subdirectory.
81+
3. `cd` to change directory to the example code located in the `supporting-blog-content/agent-builder-a2a-agent-framework` subdirectory.
8382

84-
cd elasticsearch-labs/example-apps/agent-builder-a2a-agent-framework
83+
cd elasticsearch-labs/supporting-blog-content/agent-builder-a2a-agent-framework
8584

86-
4. Replace placeholder values in `elastic_agent_builder_a2a.py` with values copied from your Elastic deployment.
87-
1. Open the file `elastic_agent_builder_a2a.py` in the Visual Studio editor.
88-
2. Replace <YOUR-ELASTIC-AGENT-BUILDER-URL\>
85+
## Setup up the environment variables
86+
87+
1. Setup the environment variables with values copied from your Elastic deployment.
88+
1. Make a copy of the file `env.example` and name the new file `.env `
89+
2. Edit the `.env` file to set the values of the environment variables to use the values copied from your Elastic deployment.
90+
* Replace <YOUR-ELASTIC-AGENT-BUILDER-URL\>
8991
1. In your Elastic deployment, go to the Elastic Agent Builder - Tools page. Click the **MCP Server** dropdown at the top of the Tools page. Select **Copy MCP Server URL.**
90-
2. In Visual Studio add the **MCP Server URL** value to the `elastic-agent-builder-a2a.py` file.
92+
2. Add the **MCP Server URL** value to the `.env` file.
9193
* Find where the placeholder text “**<YOUR-ELASTIC-AGENT-BUILDER-URL\>**” appears and paste in the copied **MCP Server URL** to replace the placeholder text. Now edit the pasted **MCP Server URL**. Delete the text “mcp” at the end of the URL and replace it with the text “a2a”. The edited URL should look something like this
9294

9395
`https://example-project-a123.kb.westus2.azure.elastic.cloud/api/agent_builder/a2a`
9496

95-
3. Replace <YOUR-ELASTIC-API-KEY\>
97+
* Replace <YOUR-ELASTIC-API-KEY\>
9698
1. In your Elastic deployment, click **Elasticsearch** in the navigation menu to go to your deployment’s home page.
9799
2. Click **Create API key** to create a new API key.
98100
3. After the API key is created, copy the API Key value.
99-
4. In Visual Studio add the API Key value to the `elastic-agent-builder-a2a.py` file.
101+
4. Add the API Key value to the `.env` file.
100102
* Find where the placeholder text “**<YOUR-ELASTIC-API-KEY\>**” appears and paste in the copied API Key value to replace the placeholder text.
103+
104+
3. Save the changes to the `.env` file.
101105

102-
4. Confirm the **relative_card_path** is set correctly in the `elastic-agent-builder-a2a.py` file by finding the code line that starts with the text “agent_card”. Confirm that the **relative_card_path** matches the Agent ID you specified when you created the agent in Elastic Agent Builder. If your Agent ID is “helloworld_agent” then the **relative_card_path** should be set to `/helloworld_agent.json`
103-
5. Save the `elastic_agent_builder_a2a.py` file in the Visual Studio editor.
106+
## Running the example app with Python
104107

105-
5. Create a Python virtual environment by running the following code in the Visual Studio Code terminal.
108+
1. Create a Python virtual environment by running the following code in the terminal.
106109

107110
python -m venv .venv
108111
109-
6. Activate the Python virtual environment.
112+
2. Activate the Python virtual environment.
110113
* If you’re running MacOS, the command to activate the virtual environment is:
111114

112115
source .venv/bin/activate
@@ -115,25 +118,16 @@ This is an example Python console app that demonstrates how to connect and utili
115118

116119
.venv\Scripts\activate
117120

118-
7. Install the Microsoft Agent Framework with the following `pip` command:
121+
3. Install the Microsoft Agent Framework along with its necessary Python packages by running the following `pip` command:
119122

120-
pip install agent-framework
123+
pip install -r requirements.txt
121124

122-
8. Run the example code by entering the following command into the terminal:
125+
4. Run the example app by entering the following command into the terminal:
123126

124127
python elastic_agent_builder_a2a.py
125128

126-
## Running the example test
127-
128-
1. Setup the environment variables.
129-
1. Make a copy of the file `env.example` and name the new file `.env `
130-
2. Edit the `.env` file to set the values of the environment variables to use the values copied from your Elastic deployment. See instructions on where to get these values in the [Running the example app](#running-the-example-app) section of this `README.md` file.
131-
* Set the value of **ES_AGENT_URL** to be the value of **YOUR-ELASTIC-AGENT-BUILDER-URL**
132-
* Set the value of **ES_API_KEY** to be value of **YOUR-ELASTIC-API-KEY**
133-
2. Run the test directly with Python.
134-
135-
python test_elastic_agent_builder_a2a.py
129+
## Running the example app with Docker
136130

137-
3. Run the test with Docker.
131+
1. Run the example app with Docker by entering the following command into the terminal:
138132

139-
docker compose up
133+
docker compose run elastic-agent-builder-a2a
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
elastic-agent-builder-a2a:
3+
build: .
4+
container_name: elastic-agent-builder-a2a
5+
stdin_open: true
6+
tty: true
7+
environment:
8+
- ES_AGENT_URL=${ES_AGENT_URL}
9+
- ES_API_KEY=${ES_API_KEY}

example-apps/agent-builder-a2a-agent-framework/elastic_agent_builder_a2a.py renamed to supporting-blog-content/agent-builder-a2a-agent-framework/elastic_agent_builder_a2a.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import asyncio
2+
from dotenv import load_dotenv
23
import httpx
4+
import os
35
from a2a.client import A2ACardResolver
46
from agent_framework.a2a import A2AAgent
57

68

79
async def main():
8-
a2a_agent_host = "<YOUR-ELASTIC-AGENT-BUILDER-URL>"
10+
load_dotenv()
11+
a2a_agent_host = os.getenv("ES_AGENT_URL")
12+
a2a_agent_key = os.getenv("ES_API_KEY")
913

1014
print(f"Connection to Elastic A2A agent at: {a2a_agent_host}")
1115

12-
custom_headers = {"Authorization": "ApiKey <YOUR-ELASTIC-API-KEY>"}
16+
custom_headers = {"Authorization": f"ApiKey {a2a_agent_key}"}
1317

1418
async with httpx.AsyncClient(timeout=60.0, headers=custom_headers) as http_client:
1519
# Resolve the A2A Agent Card
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ES_AGENT_URL=<YOUR-ELASTIC-AGENT-BUILDER-URL>
2+
ES_API_KEY=<YOUR-ELASTIC-API-KEY>
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
a2a-sdk~=0.3.14
2+
ag-ui-protocol~=0.1.10
3+
agent-framework~=1.0.0b251114
4+
agent-framework-a2a~=1.0.0b251114
5+
agent-framework-ag-ui~=1.0.0b251117
6+
agent-framework-anthropic~=1.0.0b251114
7+
agent-framework-azure-ai~=1.0.0b251114
8+
agent-framework-azurefunctions~=1.0.0b251114
9+
agent-framework-chatkit~=1.0.0b251114
10+
agent-framework-copilotstudio~=1.0.0b251114
11+
agent-framework-core~=1.0.0b251114
12+
agent-framework-devui~=1.0.0b251114
13+
agent-framework-lab~=1.0.0b251024
14+
agent-framework-mem0~=1.0.0b251114
15+
agent-framework-purview~=1.0.0b251114
16+
agent-framework-redis~=1.0.0b251114
17+
aiohappyeyeballs~=2.6.1
18+
aiohttp~=3.13.2
19+
aiosignal~=1.4.0
20+
annotated-doc~=0.0.4
21+
annotated-types~=0.7.0
22+
anthropic~=0.74.0
23+
anyio~=4.11.0
24+
attrs~=25.4.0
25+
azure-ai-agents~=1.2.0b5
26+
azure-ai-projects~=2.0.0b2
27+
azure-core~=1.36.0
28+
azure-functions~=1.24.0
29+
azure-functions-durable~=1.4.0
30+
azure-identity~=1.25.1
31+
azure-storage-blob~=12.27.1
32+
backoff~=2.2.1
33+
cachetools~=6.2.2
34+
certifi~=2025.11.12
35+
cffi~=2.0.0
36+
charset-normalizer~=3.4.4
37+
click~=8.3.1
38+
colorama~=0.4.6
39+
cryptography~=46.0.3
40+
distro~=1.9.0
41+
docstring_parser~=0.17.0
42+
fastapi~=0.121.2
43+
frozenlist~=1.8.0
44+
furl~=2.1.4
45+
google-api-core~=2.28.1
46+
google-auth~=2.43.0
47+
googleapis-common-protos~=1.72.0
48+
griffe~=1.15.0
49+
grpcio~=1.76.0
50+
h11~=0.16.0
51+
h2~=4.3.0
52+
hpack~=4.1.0
53+
httpcore~=1.0.9
54+
httptools~=0.7.1
55+
httpx~=0.28.1
56+
httpx-sse~=0.4.3
57+
hyperframe~=6.1.0
58+
idna~=3.11
59+
importlib_metadata~=8.7.0
60+
isodate~=0.7.2
61+
jiter~=0.12.0
62+
jsonpath-ng~=1.7.0
63+
jsonschema~=4.25.1
64+
jsonschema-specifications~=2025.9.1
65+
MarkupSafe~=3.0.3
66+
mcp~=1.21.2
67+
mem0ai~=1.0.1
68+
microsoft-agents-activity~=0.6.0
69+
microsoft-agents-copilotstudio-client~=0.6.0
70+
microsoft-agents-hosting-core~=0.6.0
71+
ml_dtypes~=0.5.4
72+
msal~=1.34.0
73+
msal-extensions~=1.3.1
74+
multidict~=6.7.0
75+
numpy~=2.3.5
76+
openai~=2.8.1
77+
openai-agents~=0.6.0
78+
openai-chatkit~=1.3.0
79+
opentelemetry-api~=1.38.0
80+
opentelemetry-exporter-otlp-proto-common~=1.38.0
81+
opentelemetry-exporter-otlp-proto-grpc~=1.38.0
82+
opentelemetry-proto~=1.38.0
83+
opentelemetry-sdk~=1.38.0
84+
opentelemetry-semantic-conventions~=0.59b0
85+
opentelemetry-semantic-conventions-ai~=0.4.13
86+
orderedmultidict~=1.0.2
87+
packaging~=25.0
88+
ply~=3.11
89+
portalocker~=3.2.0
90+
posthog~=7.0.1
91+
propcache~=0.4.1
92+
proto-plus~=1.26.1
93+
protobuf~=5.29.5
94+
pyasn1~=0.6.1
95+
pyasn1_modules~=0.4.2
96+
pycparser~=2.23
97+
pydantic~=2.12.4
98+
pydantic-settings~=2.12.0
99+
pydantic_core~=2.41.5
100+
PyJWT~=2.10.1
101+
python-dateutil~=2.9.0.post0
102+
python-dotenv~=1.2.1
103+
python-multipart~=0.0.20
104+
python-ulid~=3.1.0
105+
pytz~=2025.2
106+
PyYAML~=6.0.3
107+
qdrant-client~=1.16.0
108+
redis~=6.4.0
109+
redisvl~=0.11.0
110+
referencing~=0.37.0
111+
requests~=2.32.5
112+
rpds-py~=0.29.0
113+
rsa~=4.9.1
114+
six~=1.17.0
115+
sniffio~=1.3.1
116+
SQLAlchemy~=2.0.44
117+
sse-starlette~=3.0.3
118+
starlette~=0.49.3
119+
tenacity~=9.1.2
120+
tqdm~=4.67.1
121+
types-requests~=2.32.4.20250913
122+
typing-inspection~=0.4.2
123+
typing_extensions~=4.15.0
124+
urllib3~=2.5.0
125+
uvicorn~=0.38.0
126+
uvloop~=0.22.1
127+
watchfiles~=1.1.1
128+
websockets~=15.0.1
129+
Werkzeug~=3.1.3
130+
yarl~=1.22.0
131+
zipp~=3.23.0

0 commit comments

Comments
 (0)