Skip to content

Python SDK overview

The deepintshield package is the supported Python entry point for routing native provider and framework clients through DeepIntShield and for calling the explicit guardrail, RAG, MCP, and Agentic APIs. This reference is audited against SDK 2.5.1 and Python 3.10 or newer.

Install the core package for configuration, direct HTTP calls, guardrails, RAG, and Agentic governance:

Terminal window
pip install deepintshield

Provider and framework integrations are optional extras:

ExtraAdds
openaiOpenAI sync client
anthropicAnthropic sync client
anthropic-mcpAnthropic’s maintained client-side MCP helpers plus the official MCP client
bedrockboto3 Bedrock Runtime client
genaiGoogle GenAI client and managed Gemini context-cache wrapper
litellmLiteLLM completion helper
langchainLangChain model integration
mcpOfficial MCP Python SDK 1.29 client and Streamable HTTP transport
langchain-mcpMaintained langchain-mcp-adapters integration plus the official MCP client
langgraphLangGraph and LangChain model/embedding binders
pydanticaiPydanticAI model and agent builders
crewaiCrewAI binder and enforcement integration
openai-agentsOpenAI Agents SDK binder and enforcement integration
llamaindexLlamaIndex model/embedding binders and enforcement
autogenAutoGen/AG2 model binder and enforcement
temporal, strands, google-adkDurable/plugin runtime enforcement integrations
azureAzure Identity support for Entra workload identity
allEvery optional integration above

For example:

Terminal window
pip install "deepintshield[openai,langgraph]"
Terminal window
export DEEPINTSHIELD_VIRTUAL_KEY="sk-ds-your-virtual-key"
from deepintshield import DeepintShield
with DeepintShield.from_env() as shield:
client = shield.openai()
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)

DeepintShield.from_env() defaults to https://app.deepintshield.com. Creating the SDK client does not contact the gateway. Calls, provider construction that needs a key, Agentic discovery, and identity resolution can perform I/O.

NeedPublic surfaceReturn type
Native provider clientshield.openai(), .anthropic(), .bedrock(), .genai()Provider SDK object
Unified chat callshield.chat(..., stream=False) / shield.chat(..., stream=True)dict / ChatCompletionStream
Explicit content/tool guardshield.guard(...), shield.agent.*GuardrailResult or a blocking exception
RAG policy evaluationshield.rag.evaluate(...), .filter(...)Gateway response and/or allowed chunks
Native MCP protocolshield.mcp.connect()Official mcp.ClientSession and MCP result types
Framework MCP configurationshield.mcp.connection()DeepIntShield /mcp URL and guarded headers
Native framework transportshield.bind("...")A framework binder
Agentic PDP enforcementshield.agentic.*Decision, decorated tools, or framework integration objects
Manual gateway transportshield.connection(), .create_headers(), .http_client()URL/headers or httpx.Client

The shield.agent and shield.agentic names are intentionally different: agent is the explicit five-stage guardrail helper, while agentic is the identity, policy-decision, registration, approval, and tool-enforcement layer.

Configuration & transport

Constructors, environment variables, endpoints, headers, lifecycle, and raw requests.

Open →

Chat & guardrails

Native chat clients, explicit evaluation, stages, decisions, and blocking behavior.

Open →

RAG

Chunk contracts, filtering, retriever hooks, and embedder hooks.

Open →

Agents & Agentic

Explicit agent guards, PDP enforcement, identity, registration, and framework boundaries.

Open →

MCP

Official MCP sessions, third-party adapters, and stable coded failures.

Open →

Providers & frameworks

Supported builders, binders, endpoint choices, and optional dependencies.

Open →

Error codes

Central catalog, structured exception handling, retry guidance, and the stable-code contract.

Open →

The SDK is synchronous at its core; shield.mcp.connect() is an asynchronous context manager because it yields the official asynchronous mcp.ClientSession. Native provider objects retain their provider’s normal sync/async behavior, and Agentic integrations support both synchronous and asynchronous framework boundaries where the framework does. The SDK does not add a general retry policy to request(), RAG, or MCP calls. Apply retries only to catalog entries marked retryable, and keep a stable idempotency or tool-call identifier for side-effecting operations.

Latency and throughput depend on the gateway deployment, selected policies, provider, payload, cache state, and network. Benchmark the complete path with your payloads and concurrency; SDK-local helpers and catalog lookups do not establish an end-to-end latency guarantee.