Official Python SDK for the Fetch Hive API
Project description
fetch-hive-sdk
Official Python SDK for Fetch Hive — invoke AI prompts, workflows, and agents from your application.
Installation
pip install fetch-hive-sdk
Quick start
from fetch_hive_sdk import FetchHive
client = FetchHive(api_key="fhk_...")
# or: client = FetchHive() # reads FETCH_HIVE_API_KEY env var
Get your API key from the Fetch Hive dashboard.
Invoke a prompt
result = client.invoke_prompt(
deployment="my-prompt",
inputs={"name": "Alice", "topic": "machine learning"},
)
print(result["response"])
Invoke a prompt (streaming)
for chunk in client.invoke_prompt_stream(
deployment="my-prompt",
inputs={"name": "Alice"},
):
if chunk.get("type") == "delta":
print(chunk.get("content", ""), end="", flush=True)
Invoke a workflow
run = client.invoke_workflow(
deployment="my-workflow",
inputs={"customer_id": "42"},
)
print(run["status"], run.get("output"))
Async workflow
run = client.invoke_workflow(
deployment="my-workflow",
inputs={"customer_id": "42"},
async_mode=True,
callback_url="https://example.com/webhook",
)
print("Queued:", run["run_id"])
Invoke an agent (streaming)
for chunk in client.invoke_agent_stream(
agent="my-agent",
message="What is the weather in London?",
thread_id="session-abc123", # optional — persist conversation history
):
if chunk.get("type") == "delta":
print(chunk.get("content", ""), end="", flush=True)
elif chunk.get("type") == "tool_start":
print(f"\n[Calling tool: {chunk.get('tool_name')}]")
Async streaming
import asyncio
async def main():
async for chunk in client.ainvoke_agent_stream(
agent="my-agent",
message="Hello",
):
if chunk.get("type") == "delta":
print(chunk.get("content", ""), end="", flush=True)
asyncio.run(main())
Multimodal (image) inputs
result = client.invoke_agent(
agent="vision-agent",
message="Describe this image",
image_urls=["https://example.com/photo.jpg"],
)
Authentication
Pass the API key to the constructor or set the FETCH_HIVE_API_KEY environment variable:
export FETCH_HIVE_API_KEY=fhk_...
Version
0.2.2
License
MIT — see LICENSE.
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 fetch_hive_sdk-0.2.2.tar.gz.
File metadata
- Download URL: fetch_hive_sdk-0.2.2.tar.gz
- Upload date:
- Size: 40.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6421261081275c9a146bf36bbba3f24889f0035a4fae92529f97417892df850
|
|
| MD5 |
f450ac7233689671d8db75acae3e413c
|
|
| BLAKE2b-256 |
c31787d3203543f57c376610593875d0d66894a2c3f3d589d8f41634da238925
|
File details
Details for the file fetch_hive_sdk-0.2.2-py3-none-any.whl.
File metadata
- Download URL: fetch_hive_sdk-0.2.2-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9615426cc46d199dbf12a60dead7087c0d42a399f4d30a03eb8683c8049464d
|
|
| MD5 |
44b91302faea88c09ec7e17ab3c2fbb1
|
|
| BLAKE2b-256 |
5f8b4515deb38d5f8a94ff4404f3597f16b152acd2f6253357ffdb61ce525025
|