by deepset-ai
Easily deploy Haystack pipelines as REST APIs and MCP Tools.
# Add to your Claude Code skills
git clone https://github.com/deepset-ai/hayhooksHayhooks makes it easy to deploy and serve Haystack Pipelines and Agents.
With Hayhooks, you can:
đ For detailed guides, examples, and API reference, check out our comprehensive documentation.
# Install Hayhooks
pip install hayhooks
hayhooks run
Create a minimal agent wrapper with streaming chat support and a simple HTTP POST API:
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, async_streaming_generator
# Define a Haystack Tool that provides weather information for a given location.
def weather_function(location):
return f"The weather in {location} is sunny."
weather_tool = Tool(
name="weather_tool",
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:
...