Skip to content

Commit f160a6f

Browse files
committed
Further logging
Signed-off-by: Ed Snible <snible@us.ibm.com>
1 parent 11aae23 commit f160a6f

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

a2a/a2a_currency_converter/app/agent_executor.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
"""
44

55
import logging
6+
import os
67

78
from app.agent import CurrencyAgent
89

9-
from openai import AuthenticationError
10+
from openai import AuthenticationError, InternalServerError
1011

1112
from a2a.server.agent_execution import AgentExecutor, RequestContext
1213
from a2a.server.events import EventQueue
@@ -89,6 +90,22 @@ async def execute(
8990
updater.complete()
9091
break
9192

93+
except InternalServerError as e:
94+
msg=f"""CurrencyAgentExecutor reports an InternalServerError error.\n
95+
This can happen if the LLM_API_BASE environment variable does not point to an OpenAI server.\n
96+
LLM_API_BASE is {os.getenv("LLM_API_BASE", "undefined")}\n
97+
{e}"""
98+
logger.error(msg=msg)
99+
updater.update_status(
100+
TaskState.input_required,
101+
new_agent_text_message(
102+
msg,
103+
task.contextId,
104+
task.id,
105+
),
106+
final=True,
107+
)
108+
92109
except AuthenticationError as e:
93110
msg=f"""CurrencyAgentExecutor reports an authentication error.\n
94111
When importing this agent into Kagenti, expand Environment Variables and Add Variable,

0 commit comments

Comments
 (0)