Skip to content

Commit 3c5e56c

Browse files
committed
pre-commit formatting
1 parent 4d6ca5b commit 3c5e56c

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33
from a2a.client import A2ACardResolver
44
from agent_framework.a2a import A2AAgent
55

6+
67
async def main():
78
a2a_agent_host = "<YOUR-ELASTIC-AGENT-BUILDER-URL>"
89

910
print(f"Connection to Elastic A2A agent at: {a2a_agent_host}")
1011

11-
custom_headers = {
12-
"Authorization": "ApiKey <YOUR-ELASTIC-API-KEY>"
13-
}
12+
custom_headers = {"Authorization": "ApiKey <YOUR-ELASTIC-API-KEY>"}
1413

1514
async with httpx.AsyncClient(timeout=60.0, headers=custom_headers) as http_client:
1615
# Resolve the A2A Agent Card
1716
resolver = A2ACardResolver(httpx_client=http_client, base_url=a2a_agent_host)
18-
agent_card = await resolver.get_agent_card(relative_card_path="/helloworld_agent.json")
17+
agent_card = await resolver.get_agent_card(
18+
relative_card_path="/helloworld_agent.json"
19+
)
1920
print(f"Found Agent: {agent_card.name} - {agent_card.description}")
2021

2122
# Use the Agent
@@ -24,7 +25,7 @@ async def main():
2425
description=agent_card.description,
2526
agent_card=agent_card,
2627
url=a2a_agent_host,
27-
http_client=http_client
28+
http_client=http_client,
2829
)
2930
prompt = input("Enter Greeting >>> ")
3031
print("\nSending message to Elastic A2A agent...")
@@ -33,5 +34,6 @@ async def main():
3334
for message in response.messages:
3435
print(message.text)
3536

37+
3638
if __name__ == "__main__":
3739
asyncio.run(main())

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
from dotenv import load_dotenv
44
import os
55
import asyncio
6-
from pathlib import Path
6+
from pathlib import Path
77
import importlib.util
88

9+
910
class test_main_function(unittest.TestCase):
1011
def setUp(self):
1112
# Replace placeholder values with .env values
@@ -21,12 +22,18 @@ def setUp(self):
2122
self.es_agent_url = os.getenv("ES_AGENT_URL")
2223
self.es_api_key = os.getenv("ES_API_KEY")
2324
content = self.test_file.read_text()
24-
modified_content = content.replace("<YOUR-ELASTIC-AGENT-BUILDER-URL>", self.es_agent_url)
25-
modified_content = modified_content.replace("<YOUR-ELASTIC-API-KEY>", self.es_api_key)
25+
modified_content = content.replace(
26+
"<YOUR-ELASTIC-AGENT-BUILDER-URL>", self.es_agent_url
27+
)
28+
modified_content = modified_content.replace(
29+
"<YOUR-ELASTIC-API-KEY>", self.es_api_key
30+
)
2631
self.test_file.write_text(modified_content)
2732

2833
# Import the modified module
29-
spec = importlib.util.spec_from_file_location("elastic_agent_builder_a2a", self.test_file)
34+
spec = importlib.util.spec_from_file_location(
35+
"elastic_agent_builder_a2a", self.test_file
36+
)
3037
self.user_input_module = importlib.util.module_from_spec(spec)
3138
spec.loader.exec_module(self.user_input_module)
3239

@@ -35,13 +42,13 @@ def tearDown(self):
3542
self.test_file.write_text(self.backup_file.read_text())
3643
self.backup_file.unlink()
3744

38-
39-
@patch('builtins.input', return_value='hello world')
40-
@patch('builtins.print')
45+
@patch("builtins.input", return_value="hello world")
46+
@patch("builtins.print")
4147
def test_main_input(self, mock_print, mock_input):
4248
# Run test
4349
asyncio.run(self.user_input_module.main())
4450
mock_print.assert_called_with("Hello World! 🌎")
45-
51+
52+
4653
if __name__ == "__main__":
47-
unittest.main()
54+
unittest.main()

0 commit comments

Comments
 (0)