From da7009f70ec2bb8a36aaaf168a28790db8b38388 Mon Sep 17 00:00:00 2001 From: Saurabh Jain Date: Fri, 10 Jul 2026 02:10:00 +0200 Subject: [PATCH] fix(examples): indonesia_compliance reads AXONFLOW_USER_TOKEN [skip-runtime-e2e] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The example hardcoded user_token="" — on enterprise stacks (DEPLOYMENT_MODE=enterprise) every governed call 401'd and the generic AxonFlowError catch printed the auth failure as 'expected if no LLM configured' with exit 0 (the swallowed-auth-error class from the #2861 sweep; this file was missed by #213's example fixes). It now reads AXONFLOW_USER_TOKEN like the other examples and re-raises AuthenticationError so a credentials problem fails loudly. Signed-off-by: Saurabh Jain --- examples/indonesia_compliance.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/indonesia_compliance.py b/examples/indonesia_compliance.py index d1b8045..a739ffa 100644 --- a/examples/indonesia_compliance.py +++ b/examples/indonesia_compliance.py @@ -17,7 +17,7 @@ import os from axonflow import AxonFlow -from axonflow.exceptions import AxonFlowError +from axonflow.exceptions import AuthenticationError, AxonFlowError from axonflow.policies import PolicyCategory @@ -45,7 +45,9 @@ async def main() -> None: print("\nSending governed request with NIK...") try: resp = await client.proxy_llm_call( - user_token="", + # Enterprise stacks (DEPLOYMENT_MODE=enterprise) validate user + # tokens as JWTs; an empty token 401s on every governed call. + user_token=os.environ.get("AXONFLOW_USER_TOKEN", ""), query="Customer NIK is 3204110507900003 and their name is Budi Santoso", request_type="chat", context={"purpose": "identity_verification"}, @@ -53,6 +55,8 @@ async def main() -> None: print(f"Response blocked: {resp.blocked}") if resp.policy_info: print(f"Policies evaluated: {resp.policy_info.policies_evaluated}") + except AuthenticationError: + raise # credentials problem — never a "no LLM" situation; fail loudly except AxonFlowError as e: print(f"Request error (expected if no LLM configured): {e}")