https://github.com/deepset-ai/hayhooks

Easily deploy Haystack pipelines as REST APIs and MCP Tools.

https://github.com/deepset-ai/hayhooks

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 13 committers (7.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.3%) to scientific vocabulary

Keywords

ai api api-rest haystack llm mcp mcp-server mcp-tools rest

Keywords from Contributors

agent mlops transformers summarization semantic-search question-answering information-retrieval generative-ai demo-app haystack-ai
Last synced: 4 months ago · JSON representation

Repository

Easily deploy Haystack pipelines as REST APIs and MCP Tools.

Basic Info
  • Host: GitHub
  • Owner: deepset-ai
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage: https://haystack.deepset.ai
  • Size: 19.4 MB
Statistics
  • Stars: 116
  • Watchers: 7
  • Forks: 32
  • Open Issues: 16
  • Releases: 23
Topics
ai api api-rest haystack llm mcp mcp-server mcp-tools rest
Created about 2 years ago · Last pushed 5 months ago
Metadata Files
Readme License

README.md

Hayhooks

Hayhooks makes it easy to deploy and serve Haystack Pipelines and Agents.

With Hayhooks, you can:

  • 📦 Deploy your Haystack pipelines and agents as REST APIs with maximum flexibility and minimal boilerplate code.
  • 🛠️ Expose your Haystack pipelines and agents over the MCP protocol, making them available as tools in AI dev environments like Cursor or Claude Desktop. Under the hood, Hayhooks runs as an MCP Server, exposing each pipeline and agent as an MCP Tool.
  • 💬 Integrate your Haystack pipelines and agents with Open WebUI as OpenAI-compatible chat completion backends with streaming support.
  • 🕹️ Control Hayhooks core API endpoints through chat - deploy, undeploy, list, or run Haystack pipelines and agents by chatting with Claude Desktop, Cursor, or any other MCP client.

PyPI - Version PyPI - Python Version Docker image release Tests

Documentation

📚 For detailed guides, examples, and API reference, check out our comprehensive documentation.

Quick Start

1. Install Hayhooks

```bash

Install Hayhooks

pip install hayhooks ```

2. Start Hayhooks

bash hayhooks run

3. Create a simple agent

Create a minimal agent wrapper with streaming chat support and a simple HTTP POST API:

```python from typing import AsyncGenerator from haystack.components.agents import Agent from haystack.dataclasses import ChatMessage from haystack.tools import Tool from haystack.components.generators.chat import OpenAIChatGenerator from hayhooks import BasePipelineWrapper, asyncstreaminggenerator

Define a Haystack Tool that provides weather information for a given location.

def weather_function(location): return f"The weather in {location} is sunny."

weathertool = Tool( name="weathertool", description="Provides weather information for a given location.", parameters={ "type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"], }, function=weather_function, )

class PipelineWrapper(BasePipelineWrapper): def setup(self) -> None: self.agent = Agent( chatgenerator=OpenAIChatGenerator(model="gpt-4o-mini"), systemprompt="You're a helpful agent", tools=[weather_tool], )

# This will create a POST /my_agent/run endpoint
# `question` will be the input argument and will be auto-validated by a Pydantic model
async def run_api_async(self, question: str) -> str:
    result = await self.agent.run_async({"messages": [ChatMessage.from_user(question)]})
    return result["replies"][0].text

# This will create an OpenAI-compatible /chat/completions endpoint
async def run_chat_completion_async(
    self, model: str, messages: list[dict], body: dict
) -> AsyncGenerator[str, None]:
    chat_messages = [
        ChatMessage.from_openai_dict_format(message) for message in messages
    ]

    return async_streaming_generator(
        pipeline=self.agent,
        pipeline_run_args={
            "messages": chat_messages,
        },
    )

```

Save as my_agent_dir/pipeline_wrapper.py.

4. Deploy it

bash hayhooks pipeline deploy-files -n my_agent ./my_agent_dir

5. Run it

Call the HTTP POST API (/my_agent/run):

bash curl -X POST http://localhost:1416/my_agent/run \ -H 'Content-Type: application/json' \ -d '{"question": "What can you do?"}'

Call the OpenAI-compatible chat completion API (streaming enabled):

bash curl -X POST http://localhost:1416/chat/completions \ -H 'Content-Type: application/json' \ -d '{ "model": "my_agent", "messages": [{"role": "user", "content": "What can you do?"}] }'

Or integrate it with Open WebUI and start chatting with it!

Key Features

🚀 Easy Deployment

  • Deploy Haystack pipelines and agents as REST APIs with minimal setup
  • Support for both YAML-based and wrapper-based pipeline deployment
  • Automatic OpenAI-compatible endpoint generation

🌐 Multiple Integration Options

  • MCP Protocol: Expose pipelines as MCP tools for use in AI development environments
  • Open WebUI Integration: Use Hayhooks as a backend for Open WebUI with streaming support
  • OpenAI Compatibility: Seamless integration with OpenAI-compatible tools and frameworks

🔧 Developer Friendly

  • CLI for easy pipeline management
  • Flexible configuration options
  • Comprehensive logging and debugging support
  • Custom route and middleware support

📁 File Upload Support

  • Built-in support for handling file uploads in pipelines
  • Perfect for RAG systems and document processing

Next Steps

Community & Support

Hayhooks is actively maintained by the deepset team.

Owner

  • Name: deepset
  • Login: deepset-ai
  • Kind: organization
  • Email: hello@deepset.ai
  • Location: Berlin, Germany

Building enterprise search systems powered by latest NLP & open-source.

GitHub Events

Total
  • Create event: 71
  • Release event: 14
  • Issues event: 73
  • Watch event: 61
  • Delete event: 55
  • Issue comment event: 115
  • Push event: 214
  • Pull request review comment event: 169
  • Pull request event: 118
  • Pull request review event: 213
  • Fork event: 16
Last Year
  • Create event: 71
  • Release event: 14
  • Issues event: 73
  • Watch event: 61
  • Delete event: 55
  • Issue comment event: 115
  • Push event: 214
  • Pull request review comment event: 169
  • Pull request event: 118
  • Pull request review event: 213
  • Fork event: 16

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 175
  • Total Committers: 13
  • Avg Commits per committer: 13.462
  • Development Distribution Score (DDS): 0.474
Past Year
  • Commits: 107
  • Committers: 4
  • Avg Commits per committer: 26.75
  • Development Distribution Score (DDS): 0.14
Top Committers
Name Email Commits
Michele Pangrazzi x****3@g****m 92
Massimiliano Pippi m****i@g****m 47
anakin87 s****i@g****m 14
Wyatt Cannon w****n@n****v 5
Rustem Galiullin r****n@b****i 3
Silvano Cerza s****a@g****m 3
Bilge Yücel b****l@d****i 2
Rustem Galiullin r****l@g****m 2
Vladimir Blagojevic d****x@g****m 2
alex-stoica a****a@p****m 2
Alejandro Lazaro a****n@d****i 1
Alejandro Lazaro v****t@u****m 1
Sriniketh J s****7@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 5 months ago

All Time
  • Total issues: 64
  • Total pull requests: 91
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 7 days
  • Total issue authors: 36
  • Total pull request authors: 15
  • Average comments per issue: 1.03
  • Average comments per pull request: 0.43
  • Merged pull requests: 64
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 38
  • Pull requests: 69
  • Average time to close issues: 13 days
  • Average time to close pull requests: 2 days
  • Issue authors: 17
  • Pull request authors: 9
  • Average comments per issue: 0.76
  • Average comments per pull request: 0.38
  • Merged pull requests: 46
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • mpangrazzi (13)
  • julian-risch (6)
  • masci (5)
  • svanschalkwyk (4)
  • alex-stoica (2)
  • kkmarv (2)
  • jacksteussie (2)
  • anakin87 (2)
  • GiorgosAlexakis (1)
  • advin4603 (1)
  • superkelvint (1)
  • bmstoyon (1)
  • whisper-bye (1)
  • hoschmieder (1)
  • Shuntw6096 (1)
Pull Request Authors
  • mpangrazzi (56)
  • Rusteam (6)
  • anakin87 (6)
  • alex-stoica (4)
  • tellmewyatt (4)
  • bilgeyucel (3)
  • ParseDark (2)
  • srini047 (2)
  • vblagoje (2)
  • virtualroot (1)
  • Yuyang105 (1)
  • jianjungki (1)
  • zh4n7wm (1)
  • MrCatters (1)
  • lwsinclair (1)
Top Labels
Issue Labels
P1 (4) P2 (3) community-triage (3) P3 (3) enhancement (2) bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 4,730 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 35
  • Total maintainers: 1
pypi.org: hayhooks

Grab and deploy Haystack pipelines

  • Versions: 35
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 4,730 Last month
Rankings
Dependent packages count: 10.1%
Average: 38.3%
Dependent repos count: 66.6%
Maintainers (1)
Last synced: 5 months ago

Dependencies

pyproject.toml pypi
  • click *
  • fastapi *
  • haystack-ai *
  • python-multipart *
  • requests *
  • uvicorn *
.github/workflows/pypi.yml actions
  • actions/checkout v3 composite
.github/workflows/docker.yml actions
  • actions/checkout v4 composite
  • docker/bake-action v4 composite
  • docker/login-action v3 composite
  • docker/metadata-action v5 composite
  • docker/setup-buildx-action v3 composite
  • docker/setup-qemu-action v3 composite
docker/Dockerfile docker
  • $base_image latest build
  • $build_image latest build