Installation
Install the Tawa Python SDK and construct the client.
pip install tawaguard-sdkRequires Python 3.9+. The only runtime dependency is
httpx.
Construct the client
tawaguard-sdk ships both a sync (TawaGuard) and an async (AsyncTawaGuard)
client, with the same method surface.
import os
from tawaguard import TawaGuard
client = TawaGuard(os.environ["TAWA_API_KEY"])By default the sync constructor verifies your key against /verify
immediately — a bad key raises TawaAPIError at construction time rather
than on the first scan call.
import os
from tawaguard import AsyncTawaGuard
client = await AsyncTawaGuard.create(os.environ["TAWA_API_KEY"])AsyncTawaGuard.create verifies eagerly, the same way the sync client does.
Constructing AsyncTawaGuard(...) directly instead is lazy — see
Configuration for the full breakdown of eager vs.
lazy verification.
Keep your secret key server-side. Don't ship it to the browser or commit it.
Using the OpenAI Agents SDK? See the OpenAI Agents SDK integration for a guardrail helper built on top of this client.