Wauldo Python SDK
Verified AI answers from your documents. Every response includes source citations, a confidence score and an audit trail — and when your documents don't hold the answer, it says so.
Official Python SDK for the Wauldo API — answers grounded in your documents, with sources, a confidence score and smart model routing.
Why Wauldo?
- Grounded answers — every answer is checked against your source documents, with citations
- Smart model routing — auto-selects the cheapest model that meets quality
- One API, 7+ providers — OpenAI, Anthropic, Google, Qwen, Meta, Mistral, DeepSeek with automatic fallback
- OpenAI-compatible — swap your
base_url, keep your existing code - Full audit trail — confidence score, grounded status, model used, latency on every response
Quick Start
from wauldo import HttpClient
client = HttpClient(base_url="https://api.wauldo.com", api_key="YOUR_API_KEY")
reply = client.chat_simple("auto", "What is Python?")
print(reply)
Got your key from RapidAPI? Use the RapidAPI host instead — see RapidAPI.
Installation
pip install wauldo
Requirements: Python 3.9+
Features
Chat Completions
from wauldo import HttpClient, ChatRequest, HttpChatMessage
client = HttpClient(base_url="https://api.wauldo.com", api_key="YOUR_API_KEY")
request = ChatRequest(
model="auto",
messages=[
HttpChatMessage.system("You are a helpful assistant."),
HttpChatMessage.user("Explain Python decorators"),
],
)
response = client.chat(request)
print(response.choices[0].message.content)
RAG — Upload & Query
# Upload a document
upload = client.rag_upload(content="Contract text here...", filename="contract.txt")
print(f"Indexed {upload.chunks_count} chunks")
# Or a file (PDF, DOCX, image, text; 10 MB max for the whole request) — text extraction happens server-side
upload = client.upload_file("contract.pdf", title="Q3 Contract")
print(f"Indexed {upload.chunks_count} chunks ({upload.content_type})")
# Query with verified answer
result = client.rag_query("What are the payment terms?")
print(f"Answer: {result.answer}")
print(f"Confidence: {result.get_confidence():.0%}")
print(f"Grounded: {result.audit.grounded}")
for source in result.sources:
print(f" Source ({source.score:.0%}): {source.content[:80]}")
Guard — Fact-Check Any Text
# Verify a response against ground-truth sources
result = client.fact_check(
text="Returns are accepted within 60 days.",
source_context="Our return policy: 14 days.",
)
print(result.verdict) # rejected
print(result.action) # block
# Optional: score relevance to the original question (decoupled from factuality)
result = client.fact_check(
text="Rust was first released in 2010 by Mozilla Research.",
source_context="Rust is a systems language released in 2010 by Mozilla Research.",
query="What year was Rust released?",
)
print(result.verdict) # verified
if result.relevance: # None when relevance could not be computed (see relevance_warning)
print(result.relevance.verdict) # relevant | partial | off_topic
print(result.relevance.score) # cosine similarity — interpret through verdict, not absolute value
A response can be fully verified against sources and still off-topic
for the question asked — the relevance block never influences the factual
verdict. Currently only relevance_mode="fast" (embedding cosine) is supported.
Deployed Agents — create, run, stream
AgentsClient (plural) runs your deployed agents over the REST API. It is not
AgentClient, the client of the local MCP server.
from wauldo import AgentsClient
agents = AgentsClient(base_url="https://api.wauldo.com", api_key="YOUR_API_KEY", tenant="my-tenant")
# Transient failures are retried (max_retries=3, Retry-After honoured): 429/503 on any call,
# 500/502/504 and connection errors on GET only, so a POST never runs an agent twice.
agent = agents.create(
"support-bot",
'[agent]\nname = "support-bot"\n[model]\nprovider = "openrouter"\nname = "auto"',
description="Answers refund questions",
preset="general_task",
)
# One call: the server holds the response while the run completes,
# so a quick run comes back verified in a single round-trip.
task = agents.run_and_wait(agent.id, "Can I return a shirt 30 days after purchase?")
print(task.result) # The answer
print(task.verification.verdict) # SAFE | UNVERIFIED | BLOCK | ...
print(task.verification.support_score) # 0.0 – 1.0
# Need progress events? Start the run, then stream each workflow state as it completes.
run = agents.run(agent.id, "Can I return a shirt 30 days after purchase?")
for event in agents.stream_task(run.task_id):
# STREAM_LAGGED is a notice, not a state: the stream fell behind, the run goes on and
# the terminal event still comes (agents.get_task holds every state of the run).
print(f" {event.state_name}: {event.duration_ms}ms")
if event.is_terminal: # last event: result + verification, nothing left to fetch
payload = event.terminal_payload() # None when the server withheld the output
print(payload["result"] if payload else event.condition)
# Batch job: no polling, the server POSTs the task to your webhook when the run ends.
run = agents.run(agent.id, "Summarise ticket #4521", webhook_url="https://example.com/hooks/wauldo")
# A public link to the run, at creation.
run = agents.run(agent.id, "Summarise ticket #4521", auto_share=True)
print(run.share_url)
# Waiting has a limit (timeout_sec, default 360 s: enough for ordinary runs); the task
# keeps running past it. For long runs, pass a larger timeout_sec, stream, or use a webhook.
from wauldo import TaskTimeoutError
try:
task = agents.wait_for_task(run.task_id, timeout_sec=60)
except TaskTimeoutError as e: # also a TimeoutError
print(f"{e.task_id} still {e.last_status}")
task = agents.wait_for_task(e.task_id) # keep waiting
# Human approval: pause a task, then approve (it runs again) or reject (cancelled).
# The reason is stored with the decision (task.decisions). A task left paused 7 days
# without a decision is cancelled; resume_task() runs it again as a new task.
agents.pause_task(run.task_id, reason="check the refund amount")
agents.approve_task(run.task_id) # or agents.reject_task(run.task_id)
# An inline workflow at creation, used from the first run.
flow_agent = agents.create("triage-bot", toml, custom_preset=my_workflow_contract)
# A failed task is not an exception: its error is "code: message", parsed for you.
if task.status == "failed":
info = task.error_info # TaskErrorInfo(code, message)
if info.code in ("invalid_preset", "invalid_agent_config"):
print(f"Fix the agent: {info.message}")
else: # any other code, known or new: transient
retry = agents.resume_task(task.task_id) # run it again later
error_info.code |
Meaning | What to do |
|---|---|---|
invalid_preset |
The agent names a workflow preset that does not exist | Fix the agent |
invalid_agent_config |
The agent's inline workflow could not be loaded | Fix the agent |
rate_limited |
The model service is saturated | Retry in a few minutes |
timeout |
The run did not finish within its time limit | Retry, or simplify the request |
model_unavailable |
The model service is temporarily unavailable | Retry later |
run_failed |
The run failed for another reason | Retry later |
New codes may be added: handle an unknown one like run_failed. An error that
does not start with a code (a task cancelled after 7 days without an approval
decision) has code set to None and the whole error in message.
Streaming (SSE)
from wauldo import ChatRequest, HttpChatMessage
request = ChatRequest(model="auto", messages=[HttpChatMessage.user("Hello!")])
for chunk in client.chat_stream(request):
print(chunk, end="", flush=True)
Conversation Helper
conv = client.conversation(system="You are an expert on Python.", model="auto")
reply = conv.say("What are list comprehensions?")
follow_up = conv.say("Give me a nested example")
Error Handling
from wauldo import WauldoError, ServerError, AgentTimeoutError
try:
response = client.chat(ChatRequest.quick("auto", "Hello"))
except ServerError as e:
print(f"Server error: {e}")
except AgentTimeoutError:
print("Request timed out")
except WauldoError as e:
print(f"SDK error: {e}")
AgentsClient, MemoryClient and WorkflowsClient raise HttpError on an
HTTP error status: a ServerError (so a WauldoError) that is also a
urllib.error.HTTPError, so existing except HTTPError code keeps working.
A wait that runs out raises TaskTimeoutError (an AgentTimeoutError).
from wauldo import AgentsClient, HttpError, TaskTimeoutError
try:
task = agents.run_and_wait(agent_id, "Qualify acme.com")
except HttpError as e:
print(e.code, e.body) # HTTP status, and the server's JSON error
except TaskTimeoutError as e:
task = agents.wait_for_task(e.task_id)
RapidAPI
Keys from the free RapidAPI plan work on the RapidAPI host, not on api.wauldo.com (Enterprise keys):
client = HttpClient(
base_url="https://smart-rag-api.p.rapidapi.com",
headers={
"X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
"X-RapidAPI-Host": "smart-rag-api.p.rapidapi.com",
},
)
Get your free API key (500 verifications/month): RapidAPI
Links
Contributing
Found a bug? Have a feature request? Open an issue.
License
MIT — see LICENSE
Metadata
Release files for wauldo 0.23.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wauldo-0.23.1.tar.gz | 108.2 kB | With provenance | Details for wauldo-0.23.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wauldo-0.23.1-py3-none-any.whl | Python 3 | none | any | Details for wauldo-0.23.1-py3-none-any.whl |
Total release size: 190.3 kB
Release files / wauldo-0.23.1.tar.gz
| Download URL | wauldo-0.23.1.tar.gz |
|---|---|
| Size | 108.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
003fe15da28ff58740534e5080042caa4c322ab6ca648c5b98cd058be18d8e1b
|
|
BLAKE2b-256 checksum How to use checksums |
774c1dceaafcd12c2e6195c3459e5cd2c4f5f2cf9e033aa56f95adc2993afb00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / wauldo-0.23.1-py3-none-any.whl
| Download URL | wauldo-0.23.1-py3-none-any.whl |
|---|---|
| Size | 82.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3297519b57b8ece426ade683fa48395c580b6c1b0c0967af2f7dde9809c0b8b2
|
|
BLAKE2b-256 checksum How to use checksums |
912a83ba322547b19022b873a76148235a93b0911e78ec31b5ae73f55fc76da9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for wauldo 0.23.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for wauldo-0.23.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.