Mathematical Operations
Project description
Hypertic is the fastest and easiest way to build AI agent applications. It provides a clean, simple interface for connecting models, tools, vector databases, memory, and more.
Key Features:
- Tools: Create custom tools with Python functions or connect to MCP servers
- Memory: Store conversation history with in-memory, PostgreSQL, MongoDB, or Redis backends
- Retriever: Connect agent to your documents and data for RAG capabilities
- Structured Output: Get validated, structured responses using Pydantic models or schemas
- Guardrails: Add safety and validation rules to control agent behavior
Check out the examples to see how Hypertic works, and visit our documentation to learn more.
Get Started
To get started, set up your Python environment (Python 3.10 or newer required), and then install the Hypertic package.
venv
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install hypertic
For specific model providers, install the corresponding packages:
pip install openai # For OpenAI
pip install anthropic # For Anthropic
pip install google-genai # For Google Gemini
uv
If you're familiar with uv, installing the package would be even easier:
uv init
uv add hypertic
For specific model providers:
uv add openai # For OpenAI
uv add anthropic # For Anthropic
uv add google-genai # For Google Gemini
Quick Start
Sync (non-streaming):
Use run() for synchronous, non-streaming responses. This returns the complete response after the agent finishes processing:
from hypertic import Agent, tool
from openai import OpenAI
# Define a tool
@tool
def get_weather(city: str) -> str:
"""Get weather for a given city."""
return f"Sunny, 72°F in {city}"
# Create agent
model = OpenAI(model="gpt-4")
agent = Agent(
model=model,
tools=[get_weather],
instructions="You are a helpful assistant."
)
# Use it
response = agent.run("What's the weather in San Francisco?")
print(response.content)
Sync (streaming):
Use stream() for synchronous streaming. This yields events in real-time as the agent generates responses, improving user experience for longer outputs:
from hypertic import Agent, tool
from openai import OpenAI
@tool
def get_weather(city: str) -> str:
"""Get weather for a given city."""
return f"Sunny, 72°F in {city}"
model = OpenAI(model="gpt-4")
agent = Agent(
model=model,
tools=[get_weather],
instructions="You are a helpful assistant."
)
# Stream responses in real-time
for event in agent.stream("What's the weather in San Francisco?"):
if event.type == "content":
print(event.content, end="", flush=True)
Async (non-streaming):
Use arun() for asynchronous, non-streaming responses. This is ideal for concurrent operations and non-blocking I/O:
import asyncio
from hypertic import Agent, tool
from openai import OpenAI
@tool
def get_weather(city: str) -> str:
"""Get weather for a given city."""
return f"Sunny, 72°F in {city}"
model = OpenAI(model="gpt-4")
agent = Agent(
model=model,
tools=[get_weather],
instructions="You are a helpful assistant."
)
async def main():
response = await agent.arun("What's the weather in San Francisco?")
print(response.content)
asyncio.run(main())
Async (streaming):
Use astream() for asynchronous streaming. This combines the benefits of async operations with real-time response streaming:
import asyncio
from hypertic import Agent, tool
from openai import OpenAI
@tool
def get_weather(city: str) -> str:
"""Get weather for a given city."""
return f"Sunny, 72°F in {city}"
model = OpenAI(model="gpt-4")
agent = Agent(
model=model,
tools=[get_weather],
instructions="You are a helpful assistant."
)
async def main():
async for event in agent.astream("What's the weather in San Francisco?"):
if event.type == "content":
print(event.content, end="", flush=True)
asyncio.run(main())
Contributing
Contributions are welcome! Please see our Contributing Guide for details.
License
This project is licensed under the Apache License 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prsdm-0.0.2.tar.gz.
File metadata
- Download URL: prsdm-0.0.2.tar.gz
- Upload date:
- Size: 155.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e624910d8cae570f730182d5176396f8fe9b0719ccb9458224d85658a2151b86
|
|
| MD5 |
a58c07f226d4d3e7f17a26c1daace2b7
|
|
| BLAKE2b-256 |
bf0fac6a6974bb1a5899292232d2baae91b30440391c0717e1ea668ab4216f2c
|
File details
Details for the file prsdm-0.0.2-py3-none-any.whl.
File metadata
- Download URL: prsdm-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cef9adfb555a910013067758460b9e21225da5be717ac961bcccab9bbf8b2217
|
|
| MD5 |
9b04575d46a81e87a382e4ef6f983335
|
|
| BLAKE2b-256 |
324e061e52cbdf89c42ddf26b1212d0c8521e789cd7f7e5b0a1770c060a2f4ca
|