Skip to main content

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.

PyPI version

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.1.5

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fetch_hive_sdk-0.1.5.tar.gz (73.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fetch_hive_sdk-0.1.5-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file fetch_hive_sdk-0.1.5.tar.gz.

File metadata

  • Download URL: fetch_hive_sdk-0.1.5.tar.gz
  • Upload date:
  • Size: 73.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for fetch_hive_sdk-0.1.5.tar.gz
Algorithm Hash digest
SHA256 60516ed0ff99ebf27e68e7e56e3a8fa4d6cfacf98fc2d80dc89fb9cbb91822e2
MD5 eda1da3f35e34b2273bc930a8139f613
BLAKE2b-256 eb2655cbe7c9c70d97f9baa017b5ba7e1e5c4bf9c50418bcde9e2b7d9e2a5a5d

See more details on using hashes here.

File details

Details for the file fetch_hive_sdk-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: fetch_hive_sdk-0.1.5-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

Hashes for fetch_hive_sdk-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6e178da45d07f3c1fe565798354e0a3324945134e25d9f162f902a5c280da6c3
MD5 93f09b1a3e1f015afd9194085c34769e
BLAKE2b-256 1ccbfc963c8ef098f3c73638d3183908d942f0448bd6438e4f2da9759cab5367

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page