From 9d16573619ee503f1009511aecc8968c6e5e59fe Mon Sep 17 00:00:00 2001 From: Bryant Date: Fri, 6 Nov 2026 07:39:11 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20(python-sdk-docs):=20Resync=20th?= =?UTF-8?q?e=2016=20quick-start=20snippets=20with=20the=20examples'=20enfo?= =?UTF-8?q?rcement=5Fmode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The examples now pass enforcement_mode="observe" in each offline quick start because the default posture fails closed when registration cannot reach a gateway. The vendored snippets and the generated tabs still showed the old call, so copying them verbatim into an offline script failed closed. The local import headers and the completed with-bodies are kept. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01TLpw696KjUDUg4QjH83En4 --- docs/quick-start.md | 48 +++++++++++++++++++ quickstart_snippets/agno-tool-policy.py | 3 ++ quickstart_snippets/autogen-tool-policy.py | 3 ++ quickstart_snippets/crewai-research-crew.py | 3 ++ quickstart_snippets/custom-tool-policy.py | 3 ++ quickstart_snippets/google-adk.py | 3 ++ quickstart_snippets/haystack-tool-policy.py | 3 ++ quickstart_snippets/langchain-basic-agent.py | 3 ++ .../langchain-research-agent.py | 3 ++ quickstart_snippets/langgraph.py | 3 ++ quickstart_snippets/llamaindex-tool-policy.py | 3 ++ .../microsoft-agent-framework-tool-policy.py | 3 ++ quickstart_snippets/openai-agents-sdk.py | 3 ++ quickstart_snippets/pydantic-ai.py | 3 ++ .../semantic-kernel-tool-policy.py | 3 ++ quickstart_snippets/smolagents-tool-policy.py | 3 ++ .../strands-agents-tool-policy.py | 3 ++ 17 files changed, 96 insertions(+) diff --git a/docs/quick-start.md b/docs/quick-start.md index 918ad001..50af20d4 100644 --- a/docs/quick-start.md +++ b/docs/quick-start.md @@ -119,6 +119,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="agno-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -165,6 +168,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="autogen-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -196,6 +202,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="crewai-research-crew", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -235,6 +244,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="custom-tool-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -271,6 +283,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="google-adk-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -299,6 +314,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="haystack-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -344,6 +362,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="langchain-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -375,6 +396,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="langchain-research-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -407,6 +431,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="langgraph-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -444,6 +471,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="llamaindex-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -507,6 +537,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="microsoft-agent-framework-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -536,6 +569,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="openai-agents-demo", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -564,6 +600,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="pydantic-ai-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -592,6 +631,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="semantic-kernel-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -621,6 +663,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="smolagents-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") @@ -653,6 +698,9 @@ with no API keys and no outbound network. api_key=api_key, agent_id="strands-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/agno-tool-policy.py b/quickstart_snippets/agno-tool-policy.py index 482dd47f..10b6d588 100644 --- a/quickstart_snippets/agno-tool-policy.py +++ b/quickstart_snippets/agno-tool-policy.py @@ -8,6 +8,9 @@ api_key=api_key, agent_id="agno-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/autogen-tool-policy.py b/quickstart_snippets/autogen-tool-policy.py index f1c61c4f..83f1d106 100644 --- a/quickstart_snippets/autogen-tool-policy.py +++ b/quickstart_snippets/autogen-tool-policy.py @@ -7,6 +7,9 @@ api_key=api_key, agent_id="autogen-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/crewai-research-crew.py b/quickstart_snippets/crewai-research-crew.py index 2b2fc581..7fc55d92 100644 --- a/quickstart_snippets/crewai-research-crew.py +++ b/quickstart_snippets/crewai-research-crew.py @@ -9,6 +9,9 @@ api_key=api_key, agent_id="crewai-research-crew", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/custom-tool-policy.py b/quickstart_snippets/custom-tool-policy.py index 31438a3a..5891d9ae 100644 --- a/quickstart_snippets/custom-tool-policy.py +++ b/quickstart_snippets/custom-tool-policy.py @@ -13,6 +13,9 @@ api_key=api_key, agent_id="custom-tool-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/google-adk.py b/quickstart_snippets/google-adk.py index 78629ce1..990b1000 100644 --- a/quickstart_snippets/google-adk.py +++ b/quickstart_snippets/google-adk.py @@ -14,6 +14,9 @@ api_key=api_key, agent_id="google-adk-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/haystack-tool-policy.py b/quickstart_snippets/haystack-tool-policy.py index 42e797b6..5d197974 100644 --- a/quickstart_snippets/haystack-tool-policy.py +++ b/quickstart_snippets/haystack-tool-policy.py @@ -8,6 +8,9 @@ api_key=api_key, agent_id="haystack-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/langchain-basic-agent.py b/quickstart_snippets/langchain-basic-agent.py index 8e2eaa7a..5ba3911b 100644 --- a/quickstart_snippets/langchain-basic-agent.py +++ b/quickstart_snippets/langchain-basic-agent.py @@ -8,6 +8,9 @@ api_key=api_key, agent_id="langchain-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/langchain-research-agent.py b/quickstart_snippets/langchain-research-agent.py index 9a9fe0ee..f73ae8d5 100644 --- a/quickstart_snippets/langchain-research-agent.py +++ b/quickstart_snippets/langchain-research-agent.py @@ -8,6 +8,9 @@ api_key=api_key, agent_id="langchain-research-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/langgraph.py b/quickstart_snippets/langgraph.py index 347dbe9e..7e0e42dc 100644 --- a/quickstart_snippets/langgraph.py +++ b/quickstart_snippets/langgraph.py @@ -9,6 +9,9 @@ api_key=api_key, agent_id="langgraph-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/llamaindex-tool-policy.py b/quickstart_snippets/llamaindex-tool-policy.py index 6cd1d72a..6cfd772a 100644 --- a/quickstart_snippets/llamaindex-tool-policy.py +++ b/quickstart_snippets/llamaindex-tool-policy.py @@ -8,6 +8,9 @@ api_key=api_key, agent_id="llamaindex-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/microsoft-agent-framework-tool-policy.py b/quickstart_snippets/microsoft-agent-framework-tool-policy.py index fee46e6b..f95e118f 100644 --- a/quickstart_snippets/microsoft-agent-framework-tool-policy.py +++ b/quickstart_snippets/microsoft-agent-framework-tool-policy.py @@ -24,6 +24,9 @@ api_key=api_key, agent_id="microsoft-agent-framework-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/openai-agents-sdk.py b/quickstart_snippets/openai-agents-sdk.py index 8390909e..5d67ef31 100644 --- a/quickstart_snippets/openai-agents-sdk.py +++ b/quickstart_snippets/openai-agents-sdk.py @@ -8,6 +8,9 @@ api_key=api_key, agent_id="openai-agents-demo", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/pydantic-ai.py b/quickstart_snippets/pydantic-ai.py index da8a4bc4..c018a651 100644 --- a/quickstart_snippets/pydantic-ai.py +++ b/quickstart_snippets/pydantic-ai.py @@ -13,6 +13,9 @@ api_key=api_key, agent_id="pydantic-ai-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/semantic-kernel-tool-policy.py b/quickstart_snippets/semantic-kernel-tool-policy.py index 87152324..e6f7aecc 100644 --- a/quickstart_snippets/semantic-kernel-tool-policy.py +++ b/quickstart_snippets/semantic-kernel-tool-policy.py @@ -8,6 +8,9 @@ api_key=api_key, agent_id="semantic-kernel-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/smolagents-tool-policy.py b/quickstart_snippets/smolagents-tool-policy.py index 4e173fa1..fde0479e 100644 --- a/quickstart_snippets/smolagents-tool-policy.py +++ b/quickstart_snippets/smolagents-tool-policy.py @@ -14,6 +14,9 @@ api_key=api_key, agent_id="smolagents-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}") diff --git a/quickstart_snippets/strands-agents-tool-policy.py b/quickstart_snippets/strands-agents-tool-policy.py index 3cba7408..dc028294 100644 --- a/quickstart_snippets/strands-agents-tool-policy.py +++ b/quickstart_snippets/strands-agents-tool-policy.py @@ -7,6 +7,9 @@ api_key=api_key, agent_id="strands-demo-agent", mode="sdk-only", + # No gateway here: the default posture fails closed when registration + # can't reach one, so an offline demo must name its dry-run posture. + enforcement_mode="observe", ) as ctx: print(f" Agent: {ctx.client.agent_id}") print(f" Gateway: {ctx.client.gateway_url}")