Skip to main content

PyPI version

Seltz Python SDK

Official Python SDK for Seltz, the Web search engine for AI agents.

💾 Installation

pip install seltz

Requires Python 3.9 or higher.

⚡️ Quick Start

from seltz import Seltz

client = Seltz(api_key="your-api-key")

# Search the Web
response = client.search("best ai search engines", max_results=10)

# Access results
for document in response.documents:
    print(f"URL: {document.url}")
    print(f"Content: {document.content}")

Output:

URL: https://www.best-ai-search-engines.com
Content: Generative AI can make finding information faster and more intuitive.
If you’re tired of traditional search, explore some of the best AI-powered
search engines we've tested...

Answer

Get a natural-language answer grounded in Web search results, with citations:

from seltz import Seltz

client = Seltz(api_key="your-api-key")

response = client.answer("Who is Apple's next CEO?")

print(response.answer)
for citation in response.citations:
    print(f"Source: {citation.url}")

Pass model to pick an answer tier. It defaults to seltz-base; seltz-pro runs agentic RAG over a single grounding search:

response = client.answer("Who is Apple's next CEO?", model="seltz-pro")

Pass response_format (an OpenAI-style object) to get structured output. response.answer then carries a JSON string matching your schema instead of Markdown; response.citations are still returned:

response = client.answer(
    "Who is Apple's next CEO?",
    response_format={
        "type": "json_schema",
        "json_schema": {
            "name": "news_summary",
            "schema": {
                "type": "object",
                "properties": {"summary": {"type": "string"}},
                "required": ["summary"],
                "additionalProperties": False,
            },
        },
    },
)

import json
print(json.loads(response.answer)["summary"])

Pass system_prompt to steer how the answer is presented — tone, voice, format:

response = client.answer(
    "Who is Apple's next CEO?",
    system_prompt="Answer in British English. Open with a one-line summary, then the detail.",
)

Answer (streaming)

Stream an answer as it is generated, instead of waiting for the full response. answer_stream yields events as they arrive: a citations event first, then text_delta chunks, then a terminal finish_reason. Inspect each event with event.WhichOneof("event"):

from seltz import Seltz

client = Seltz(api_key="your-api-key")

for event in client.answer_stream("Who is Apple's next CEO?"):
    kind = event.WhichOneof("event")
    if kind == "citations":
        for citation in event.citations.citations:
            print(f"Source: {citation.url}")
    elif kind == "text_delta":
        print(event.text_delta, end="", flush=True)
    elif kind == "finish_reason":
        print()

Streaming is also available asynchronously via AsyncSeltzasync for over the events:

import asyncio

from seltz import AsyncSeltz


async def main():
    async with AsyncSeltz(api_key="your-api-key") as client:
        async for event in client.answer_stream("Who is Apple's next CEO?"):
            kind = event.WhichOneof("event")
            if kind == "citations":
                for citation in event.citations.citations:
                    print(f"Source: {citation.url}")
            elif kind == "text_delta":
                print(event.text_delta, end="", flush=True)
            elif kind == "finish_reason":
                print()


asyncio.run(main())

Async

The same API is available asynchronously via AsyncSeltzawait each call:

import asyncio

from seltz import AsyncSeltz


async def main():
    client = AsyncSeltz(api_key="your-api-key")

    response = await client.search("best ai search engines", max_results=10)

    for document in response.documents:
        print(f"URL: {document.url}")
        print(f"Content: {document.content}")


asyncio.run(main())

To close the connection deterministically rather than leaving it to garbage collection, use AsyncSeltz as an async context manager (async with) or call await client.close() when done.

📚 Documentation

Browse the documentation for more details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seltz-1.9.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seltz-1.9.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file seltz-1.9.0.tar.gz.

File metadata

  • Download URL: seltz-1.9.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for seltz-1.9.0.tar.gz
Algorithm Hash digest
SHA256 0755fece800920b8633ae9a986f8b00a1dcf5995f89381f3373591eab87056f9
MD5 0b56ae01c16c0ecb960083c37cfc9ca2
BLAKE2b-256 36f4ffade89f0ea36249b3c6036ecb4c5995f01195b19178cdb4984e7f9a6a6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for seltz-1.9.0.tar.gz:

Publisher: python-publish.yml on seltz-ai/seltz-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file seltz-1.9.0-py3-none-any.whl.

File metadata

  • Download URL: seltz-1.9.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for seltz-1.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a727b43e1fd2bfbd73c29e08ccadc522d68b5030006c7700dcffedfb7f108c8b
MD5 725abf049453f706ed03ea7006142da4
BLAKE2b-256 54d973a0653e7de9d583d17ffd2330eccd8459ec7701847fa4f438e827493f05

See more details on using hashes here.

Provenance

The following attestation bundles were made for seltz-1.9.0-py3-none-any.whl:

Publisher: python-publish.yml on seltz-ai/seltz-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.9.0 This release

2 files

1.8.0

2 files

1.7.0

2 files

1.6.0

2 files

1.5.0

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page