Python SDK
Official Python SDK for Tenzro Cloud. Supports Python 3.10+ with both sync and async clients.
Installation
pip install tenzro# orpoetry add tenzro# oruv add tenzro
Quick Start
from tenzro import Tenzroimport ostenzro = Tenzro(api_key=os.environ["TENZRO_API_KEY"])# AI chat completionresponse = tenzro.ai.chat(model="gemini-2.5-flash",messages=[{"role": "user", "content": "Hello!"},],)print(response.choices[0].message.content)
Async Client
from tenzro import AsyncTenzroimport asyncioasync def main():tenzro = AsyncTenzro(api_key=os.environ["TENZRO_API_KEY"])response = await tenzro.ai.chat(model="gemini-2.5-flash",messages=[{"role": "user", "content": "Hello!"}],)print(response.choices[0].message.content)await tenzro.close()asyncio.run(main())
Vector Database
# Create vector databasedb = tenzro.vec.create(project_id="project-id",db_name="embeddings",dimension=1536,)# Insert vectorstenzro.vec.upsert(db_id=db.vec_db_id,vectors=[{"id": "doc-1","vector": embedding,"metadata": {"title": "Document 1"},},],)# Search vectorsresults = tenzro.vec.search(db_id=db.vec_db_id,vector=query_embedding,top_k=10,)
Key-Value Store
# Set value with TTLtenzro.kev.set(db_id=kev_db_id,key="session:123",value=user_data,ttl=3600, # 1 hour)# Get valuesession = tenzro.kev.get_value(db_id=kev_db_id, key="session:123")# Delete valuetenzro.kev.delete_key(db_id=kev_db_id, key="session:123")
AI Agents
# Create agentagent = tenzro.agents.create(project_id="project-id",agent_name="assistant",system_prompt="You are a helpful assistant.",ai_model="gemini-2.5-flash",)# Chat with agentresponse = tenzro.agents.chat(agent_id=agent.agent_id,message="Hello!",conversation_id="conv-123",)print(response.response)
Streaming
# Stream AI responsesstream = tenzro.ai.stream(model="gemini-2.5-flash",messages=[{"role": "user", "content": "Write a story"}],)for chunk in stream:print(chunk.text, end="", flush=True)
Error Handling
from tenzro import APIError, AuthenticationError, RateLimitErrortry:tenzro.ai.chat(model="gemini-2.5-flash", messages=[])except AuthenticationError:print("Invalid API key")except RateLimitError as e:print(f"Rate limited, retry after: {e.retry_after}")except APIError as e:print(f"API error {e.status_code}: {e.message}")
Context Manager
# Automatically close clientwith Tenzro(api_key=api_key) as tenzro:response = tenzro.ai.chat(model="gemini-2.5-flash",messages=[{"role": "user", "content": "Hello!"}],)# Async context managerasync with AsyncTenzro(api_key=api_key) as tenzro:response = await tenzro.ai.chat(model="gemini-2.5-flash",messages=[{"role": "user", "content": "Hello!"}],)
Available Services
| Service | Description |
|---|---|
tenzro.ai | AI inference (chat, embeddings, multi-modal) |
tenzro.agents | AI agent orchestration with tools and memory |
tenzro.vec | Vector database for embeddings and similarity search |
tenzro.kev | Key-value store for sessions, cache, and state |
tenzro.data | PostgreSQL databases for structured data |
tenzro.graph | Graph database for relationships and traversals |
tenzro.files | Object storage for files and media |
tenzro.workflows | Visual workflow execution |
tenzro.hub | Model hub for browsing and downloading models |
tenzro.enclaves | Secure enclaves for sensitive data |
tenzro.security | Cryptographic operations and key management |