Development Status
- 4 - Beta
Intended Audience
- Developers
Programming Language
- Python :: 3
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: 3.14
Topic
- Software Development :: Libraries :: Python Modules
- Internet :: WWW/HTTP :: Indexing/Search
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 search for harder, multi-hop questions:
response = client.answer("Who is Apple's next CEO?", model="seltz-pro")
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 AsyncSeltz — async 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 AsyncSeltz — await 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.