Skip to content

Commit 9ec615e

Browse files
committed
🎨 Formatting weather
Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
1 parent 7501299 commit 9ec615e

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

a2a/weather_service/src/weather_service/agent.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
from a2a.types import AgentCapabilities, AgentCard, AgentSkill, TaskState, TextPart
1212
from a2a.utils import new_agent_text_message, new_task
1313
from openinference.instrumentation.langchain import LangChainInstrumentor
14-
from pydantic import AnyUrl
1514
from langchain_core.messages import HumanMessage
1615

1716
from weather_service.graph import get_graph, get_mcpclient
18-
from keycloak import KeycloakOpenID
1917

2018
logging.basicConfig(level=logging.DEBUG)
2119
logger = logging.getLogger(__name__)
@@ -116,9 +114,9 @@ async def execute(self, context: RequestContext, event_queue: EventQueue):
116114
output = None
117115
# Test MCP connection first
118116
logger.info(f'Attempting to connect to MCP server at: {os.getenv("MCP_URL", "http://localhost:8000/sse")}')
119-
117+
120118
mcpclient = get_mcpclient()
121-
119+
122120
# Try to get tools to verify connection
123121
try:
124122
tools = await mcpclient.get_tools()
@@ -127,7 +125,7 @@ async def execute(self, context: RequestContext, event_queue: EventQueue):
127125
logger.error(f'Failed to connect to MCP server: {tool_error}')
128126
await event_emitter.emit_event("Error: Cannot connect to MCP weather service at {os.getenv('MCP_URL', 'http://localhost:8000/sse')}. Please ensure the weather MCP server is running. Error: {tool_error}", failed=True)
129127
return
130-
128+
131129
graph = await get_graph(mcpclient)
132130
async for event in graph.astream(input, stream_mode="updates"):
133131
await event_emitter.emit_event(
@@ -151,7 +149,7 @@ async def cancel(self, context: RequestContext, event_queue: EventQueue) -> None
151149
Not implemented
152150
"""
153151
raise Exception("cancel not supported")
154-
152+
155153
def run():
156154
"""
157155
Runs the A2A Agent application.

mcp/weather_tool/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ RUN chown -R 1001:1001 /app
1212
USER 1001
1313

1414
CMD ["uv", "run", "--no-sync", "weather_tool.py"]
15-

0 commit comments

Comments
 (0)