Skip to main content

Wauldo Python SDK

PyPI Downloads Python License: MIT

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

Contributing

Found a bug? Have a feature request? Open an issue.

License

MIT — see LICENSE

Metadata

Release files for wauldo 0.23.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wauldo 0.23.0
File Size Uploaded Provenance Actions
wauldo-0.23.0.tar.gz 101.7 kB With provenance Details for wauldo-0.23.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wauldo 0.23.0
File Interpreter ABI Platform Actions
wauldo-0.23.0-py3-none-any.whl Python 3 none any Details for wauldo-0.23.0-py3-none-any.whl

Total release size: 180.1 kB

Release files / wauldo-0.23.0.tar.gz

Download URL wauldo-0.23.0.tar.gz
Size 101.7 kB
Tags Source
SHA-256 checksum
How to use checksums
661b4459e37a238429d50f604adc9f01c18aa565caf81bfab740610c7ab834ca
BLAKE2b-256 checksum
How to use checksums
5a1351ce3fe8d0c7cea17b837b87e906557c196219c085de07f1eb9f0574a7cb
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 log

Release files / wauldo-0.23.0-py3-none-any.whl

Download URL wauldo-0.23.0-py3-none-any.whl
Size 78.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
668fddb86c9a9148fa459d6815386dca55c9283feda4bce7038286242f36e04c
BLAKE2b-256 checksum
How to use checksums
c61841c84891080103ac0fb9a11e600a80236998ce523f7814d57cf49407640a
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 log

Security for wauldo 0.23.0

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.

Select from 2 files

Attestation for wauldo-0.23.0.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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page