Official Python client for the Hawk daemon API
The Hawk SDK for Python provides an idiomatic client for interacting with the Hawk daemon API. It supports both synchronous and async operations, including streaming.
- Sync and async - Use
HawkClientorAsyncHawkClient - Streaming support - Real-time response streaming
- Context managers - Automatic resource cleanup
- Type hints - Full type annotations for IDE support
- Error handling - Detailed exception types
pip install hawk-sdkfrom hawk import HawkClient
with HawkClient() as client:
# Health check
health = client.health()
print(f"Version: {health.version}")
# Chat
response = client.chat("Explain decorators in Python")
print(response.response)from hawk import AsyncHawkClient
async with AsyncHawkClient() as client:
response = await client.chat("Hello!")
print(response.response)with HawkClient() as client:
with client.chat_stream("Write a haiku") as stream:
for event in stream.events():
print(event.data, end="", flush=True)See the examples/ directory for complete runnable examples.
Contributions are welcome — please read CONTRIBUTING.md before opening a pull request.
MIT - see LICENSE for details.