From 55874d552ee78a2b9200dac37e9d0cb858d1d19f Mon Sep 17 00:00:00 2001 From: knielsen404 Date: Wed, 23 Apr 2025 13:08:57 +0100 Subject: [PATCH] feat: append_and_push_trace uses configurable API URL --- gateway/mcp/mcp.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gateway/mcp/mcp.py b/gateway/mcp/mcp.py index 6d268ef..f261096 100644 --- a/gateway/mcp/mcp.py +++ b/gateway/mcp/mcp.py @@ -27,6 +27,7 @@ INVARIANT_GUARDRAILS_BLOCKED_MESSAGE = """ Do not attempt to circumvent this block, rather explain to the user based on the following output what went wrong: %s """ +DEFAULT_API_URL = "https://explorer.invariantlabs.ai" def write_as_utf8_bytes(data: dict) -> bytes: @@ -102,7 +103,9 @@ async def append_and_push_trace( try: # If the trace_id is None, create a new trace with the messages. # Otherwise, append the message to the existing trace. - client = AsyncClient() + client = AsyncClient( + api_url=os.getenv("INVARIANT_API_URL", DEFAULT_API_URL), + ) if ctx.trace_id is None: ctx.trace.append(message) response = await client.push_trace(