Skip to content

Commit 6891ac2

Browse files
committed
Don't return error details via A2A
Signed-off-by: Ed Snible <snible@us.ibm.com>
1 parent 540e45c commit 6891ac2

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

a2a/a2a_currency_converter/app/agent.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020
memory = MemorySaver()
2121

2222
class Configuration(BaseSettings):
23+
"""The configuration of the Agent"""
24+
2325
llm_model: str = "gpt-4o"
2426
llm_api_base: str = ""
25-
# We don't want the pod to crash without a valid key. Report authentication error to A2A user instead.
27+
# We don't want the pod to crash without a valid key.
28+
# Report authentication error to A2A user instead.
2629
llm_api_key: str = os.getenv("OPENAI_API_KEY", "Failed to load env var OPENAI_API_KEY")
2730

2831

a2a/a2a_currency_converter/app/agent_executor.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ async def execute(
9797
9898
LLM_API_BASE is {os.getenv("LLM_API_BASE", "undefined")}
9999
100-
Error: {e}"""
100+
Use `kubectl -n <namespace> logs deployment/<agent-name>` for details.
101+
"""
101102
logger.error(msg=msg)
103+
logger.error(msg=f"Raw InternalServerError: {e}")
102104
updater.update_status(
103105
TaskState.input_required,
104106
new_agent_text_message(
@@ -115,12 +117,13 @@ async def execute(
115117
When importing this agent into Kagenti, expand Environment Variables and Add Variable,
116118
or import https://github.com/kagenti/agent-examples/blob/main/a2a/a2a_currency_converter/.env.openai
117119
120+
Use `kubectl -n <namespace> logs deployment/<agent-name>` for details.
121+
118122
Also check
119123
`kubectl -n <namespace> get secret openai-secret -o jsonpath="{'{'}.data.apikey{'}'}" | base64 -d`
120-
The key should match your OpenAI key.
121-
122-
{e}"""
124+
The key should match your OpenAI key."""
123125
logger.error(msg=msg)
126+
logger.error(msg=f"Raw AuthenticationError {e}")
124127
updater.update_status(
125128
TaskState.input_required,
126129
new_agent_text_message(

0 commit comments

Comments
 (0)