### Quick Start: RAG System Setup and Execution Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/examples/rag-system.md Follow these steps to set up and run the RAG system example from the repository root. This includes navigating to the example directory, installing dependencies, launching Hayhooks and Elasticsearch, deploying pipelines, indexing documents, and querying the system. ```bash cd examples/rag_indexing_query python -m venv .venv && source .venv/bin/activate pip install -r requirements.txt hayhooks run docker compose up hayhooks pipeline deploy-files -n indexing indexing_pipeline hayhooks pipeline deploy-files -n query query_pipeline hayhooks pipeline run indexing --dir files_to_index hayhooks pipeline run query --param 'question="is this recipe vegan?"' # Optional: check API docs # http://localhost:1416/docs ``` -------------------------------- ### Serve Documentation Locally with Hatch Source: https://github.com/deepset-ai/hayhooks/blob/main/CONTRIBUTING_DOCS.md Start a local development server with live reloading for the documentation. This command uses the dedicated docs environment, which automatically installs all necessary dependencies. ```bash hatch run docs:serve ``` ```bash hatch run docs:serve --open --dirty ``` -------------------------------- ### Configure Horizontal Scaling Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/deployment/deployment_guidelines.md Example setup for running multiple instances with a shared pipeline directory. ```bash # Each instance should use the same pipeline directory export HAYHOOKS_PIPELINES_DIR=/app/pipelines hayhooks run ``` -------------------------------- ### PipelineWrapper setup() Method Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/concepts/pipeline-wrapper.md The setup method is called once during deployment to initialize the pipeline. ```python def setup(self) -> None: # Initialize your pipeline here pass ``` -------------------------------- ### Basic PipelineWrapper Structure Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/concepts/pipeline-wrapper.md Example of a complete PipelineWrapper implementation including setup and run_api methods. ```python from collections.abc import AsyncGenerator, Generator from pathlib import Path from haystack import Pipeline from hayhooks import BasePipelineWrapper, get_last_user_message, async_streaming_generator, streaming_generator class PipelineWrapper(BasePipelineWrapper): def setup(self) -> None: pipeline_yaml = (Path(__file__).parent / "pipeline.yml").read_text() self.pipeline = Pipeline.loads(pipeline_yaml) def run_api(self, urls: list[str], question: str) -> str: result = self.pipeline.run({"fetcher": {"urls": urls}, "prompt": {"query": question}}) return result["llm"]["replies"][0] ``` -------------------------------- ### Install Frontend Dependencies Source: https://github.com/deepset-ai/hayhooks/blob/main/dashboard/README.md Navigate to the dashboard directory and install necessary frontend dependencies using npm. ```bash cd dashboard npm install ``` -------------------------------- ### Install Dependencies Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/pipeline_wrappers/image_generation/README.md Install the necessary library for interacting with Hugging Face models. ```bash pip install huggingface_hub ``` -------------------------------- ### Local Backend: Start SigNoz Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/reference/tracing.md Clone the SigNoz repository and use Docker Compose to start the SigNoz backend locally for tracing visualization. ```bash git clone -b main https://github.com/SigNoz/signoz.git cd signoz/deploy/docker docker compose up -d --remove-orphans ``` -------------------------------- ### Deploy Pipeline Wrappers with Docker Compose Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/examples/overview.md This command deploys all pipeline wrapper examples using Docker Compose. It sets up Hayhooks, auto-deploys pipelines, and installs necessary dependencies. Ensure your API key is exported as an environment variable. ```bash git clone https://github.com/deepset-ai/hayhooks.git cd hayhooks export OPENAI_API_KEY=your-api-key docker compose up -d ``` -------------------------------- ### Shell Command Example Source: https://github.com/deepset-ai/hayhooks/blob/main/CONTRIBUTING_DOCS.md Example of a shell command for documentation purposes. ```bash # Shell commands hatch run docs-serve ``` -------------------------------- ### Install Dashboard Dependencies and Build Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/tracing-dashboard-branch-review.md Installs npm dependencies and builds the dashboard. Run this within the dashboard directory. ```bash cd dashboard npm ci npm run test npm run build ``` -------------------------------- ### Manual Development Installation Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/getting-started/installation.md Set up a local development environment using a standard Python virtual environment. ```bash # Clone the repository git clone https://github.com/deepset-ai/hayhooks.git cd hayhooks # Create a virtual environment python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate # Install in development mode pip install -e . ``` -------------------------------- ### Install Hayhooks from Source Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/getting-started/installation.md Clone the repository and install in editable mode for development or testing. ```bash git clone https://github.com/deepset-ai/hayhooks.git cd hayhooks pip install -e . ``` -------------------------------- ### Development Setup with Hatch Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/getting-started/installation.md Use Hatch to manage the development environment, run tests, and serve documentation. ```bash # Clone the repository git clone https://github.com/deepset-ai/hayhooks.git cd hayhooks # Install Hatch (if not already installed) pip install hatch # Run unit tests hatch run test:unit # Run integration tests hatch run test:integration # Run tests hatch run test:all # Format code hatch run fmt # Serve documentation locally hatch run docs:serve ``` -------------------------------- ### Example User Query Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/pipeline_wrappers/chainlit_weather_agent/README.md An example of a user query to interact with the deployed weather agent pipeline. ```text What's the weather in Berlin? ``` -------------------------------- ### Start Vite Dev Server Source: https://github.com/deepset-ai/hayhooks/blob/main/dashboard/README.md Command to start the Vite development server for the frontend. ```bash npm run dev ``` -------------------------------- ### Log Format Examples Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/reference/logging.md Illustrates the default and verbose log formats, showing the difference in metadata included. ```bash # Default format 2026-03-27 10:47:00 | INFO | Pipelines dir set to: '/app/pipelines' ``` ```bash # Verbose format 2026-03-27 10:47:00 | INFO | hayhooks.server.app:deploy_pipelines:188 | Pipelines dir set to: '/app/pipelines' ``` -------------------------------- ### Run MCP Server Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/cli-commands.md Start the MCP server with optional host and port configurations. ```bash # Start MCP server hayhooks mcp run # With custom host and port hayhooks mcp run --host 0.0.0.0 --port 1417 ``` -------------------------------- ### Start Hayhooks Server Source: https://github.com/deepset-ai/hayhooks/blob/main/README.md Launch the Hayhooks server instance. ```bash hayhooks run ``` -------------------------------- ### Install Dependencies and Set OpenAI Credentials Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/pipeline_wrappers/custom_tracing/README.md Install necessary packages and configure your OpenAI API key and model. The `hayhooks[tracing]` package includes tracing capabilities. ```bash pip install "hayhooks[tracing]" openai export OPENAI_API_KEY=your_key_here # optional override export OPENAI_MODEL=gpt-5.4-mini ``` -------------------------------- ### Basic Pipeline Workflow Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/cli-commands.md Standard sequence for starting the server, deploying a pipeline, and executing a run command. ```bash # 1. Start server hayhooks run --port 1416 # 2. In another terminal, deploy pipeline hayhooks pipeline deploy-files -n chat_pipeline ./pipelines/chat # 3. Check status hayhooks status # 4. Run pipeline hayhooks pipeline run chat_pipeline --param 'query="Hello!"' # 5. Check logs # Use your process manager or container logs ``` -------------------------------- ### Install Chainlit support Source: https://github.com/deepset-ai/hayhooks/blob/main/README.md Install the necessary dependencies to enable the Chainlit chat UI integration. ```bash pip install "hayhooks[chainlit]" ``` -------------------------------- ### Deploy Pipeline Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/pipeline_wrappers/chat_completion_with_file_upload/README.md Start the Haystack server and then deploy the chat completion pipeline. ```bash # 1. Start the server hayhooks run # 2. Deploy the pipeline hayhooks pipeline deploy-files -n chat_completion_with_file_upload examples/pipeline_wrappers/chat_completion_with_file_upload ``` -------------------------------- ### Virtual Environment Setup Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/pipeline_wrappers/chainlit_weather_agent/README.md Commands to create and activate a Python virtual environment for project isolation. ```shell python -m venv .venv source .venv/bin/activate ``` -------------------------------- ### Sync-Only Component Integration Example Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/concepts/pipeline-wrapper.md A complete example showing a custom sync-only component integrated into a pipeline wrapper using hybrid streaming. ```python from collections.abc import AsyncGenerator from typing import Any from haystack import Pipeline from haystack.core.component import component from haystack.dataclasses import StreamingChunk from hayhooks import BasePipelineWrapper, get_last_user_message, async_streaming_generator @component class SyncOnlyGenerator: """A sync-only component: implements run() with a streaming_callback but no run_async().""" @component.output_types(replies=list[str]) def run(self, prompt: str, streaming_callback: Any | None = None) -> dict[str, Any]: reply = f"Answer: {prompt}" if streaming_callback: for index, word in enumerate(reply.split()): streaming_callback(StreamingChunk(content=word + " ", index=index)) return {"replies": [reply]} class SyncOnlyWrapper(BasePipelineWrapper): def setup(self) -> None: # SyncOnlyGenerator only supports sync streaming (no run_async) self.pipeline = Pipeline() self.pipeline.add_component("llm", SyncOnlyGenerator()) async def run_chat_completion_async( self, model: str, messages: list[dict], body: dict ) -> AsyncGenerator: question = get_last_user_message(messages) # Enable hybrid mode so the sync-only component can stream in an async pipeline return async_streaming_generator( pipeline=self.pipeline, pipeline_run_args={"llm": {"prompt": question}}, allow_sync_streaming_callbacks=True # ✅ Handles sync component ) ``` -------------------------------- ### Install Dependencies Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/rag_indexing_query/README.md Installs project dependencies using pip from a requirements file. Ensure requirements.txt is present in the project directory. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install Hayhooks Source: https://github.com/deepset-ai/hayhooks/blob/main/README.md Install the package via pip. ```bash # Install Hayhooks pip install hayhooks ``` -------------------------------- ### Direct MkDocs Usage for Serving and Building Source: https://github.com/deepset-ai/hayhooks/blob/main/CONTRIBUTING_DOCS.md If you prefer to use MkDocs directly, you can install the necessary dependencies and then serve or build the documentation using standard MkDocs commands. ```bash pip install mkdocs-material mkdocs serve mkdocs build ``` -------------------------------- ### Preview Documentation Changes Locally Source: https://github.com/deepset-ai/hayhooks/blob/main/CONTRIBUTING_DOCS.md Preview your documentation changes in the browser by starting the development server with the --open flag. ```bash hatch run docs:serve --open ``` -------------------------------- ### Run A2A Server Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/cli-commands.md Start the A2A server to expose pipelines as agents. ```bash # Start A2A server hayhooks a2a run # With custom host and port hayhooks a2a run --host 0.0.0.0 --port 1418 ``` -------------------------------- ### Install Hayhooks via PyPI Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/getting-started/installation.md Install the core package or specific feature sets using pip. ```bash pip install hayhooks ``` ```bash pip install hayhooks[mcp] ``` ```bash pip install "hayhooks[a2a]" ``` ```bash pip install "hayhooks[tracing]" ``` -------------------------------- ### Run the A2A Multi-Agent Demo Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/a2a_multi_agent/README.md Install dependencies, set the OpenAI API key, and execute the demo script. ```bash pip install -r requirements.txt export OPENAI_API_KEY=sk-... python run_demo.py ``` -------------------------------- ### Install additional dependencies Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/concepts/pipeline-wrapper.md Install required packages via pip to ensure they are available to the pipeline wrapper. ```bash pip install trafilatura ``` -------------------------------- ### Install Open WebUI via Docker Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/openwebui-integration.md Command to run the Open WebUI container with necessary host networking and volume configuration. ```bash docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -e WEBUI_AUTH=False -v open-webui:/app/backend/data --name open-webui ghcr.io/open-webui/open-webui:main ``` -------------------------------- ### Configure Development Environment Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/reference/environment-variables.md Sets environment variables for local development before starting the server. ```bash export HAYHOOKS_HOST=127.0.0.1 export HAYHOOKS_PORT=1416 export HAYHOOKS_PIPELINES_DIR=./pipelines export HAYHOOKS_LOG_LEVEL=DEBUG hayhooks run ``` -------------------------------- ### Install Hayhooks with Chainlit Extra Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/chainlit-integration.md Install Hayhooks with the `chainlit` extra to enable Chainlit integration. This is the first step to using the embedded chat UI. ```bash pip install "hayhooks[chainlit]" ``` -------------------------------- ### Start the A2A Server Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/a2a-support.md Launch the Hayhooks A2A server to begin exposing pipelines as agents. ```bash hayhooks a2a run ``` -------------------------------- ### Run Demo in Server-Only Mode Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/a2a_multi_agent/README.md Start the MCP and A2A servers without executing the automated demo flow. ```bash python run_demo.py --serve ``` -------------------------------- ### Start the Hayhooks MCP Server Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/mcp-support.md Start the MCP server using the hayhooks CLI. The server will run on the host and port specified by HAYHOOKS_MCP_HOST and HAYHOOKS_MCP_PORT environment variables. ```bash hayhooks mcp run ``` -------------------------------- ### Configure Streaming Component Selection Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/concepts/pipeline-wrapper.md Examples of different ways to define the streaming_components list or keyword. ```python # Stream only the first LLM streaming_components=["llm_1"] # Stream only the second LLM (same as default) streaming_components=["llm_2"] # Stream ALL capable components (shorthand) streaming_components="all" # Stream ALL capable components (specific list) streaming_components=["llm_1", "llm_2"] ``` -------------------------------- ### Run Hayhooks Server Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/cli-commands.md Start the Hayhooks HTTP server with various configuration options. ```bash # Basic server start hayhooks run # With custom host and port hayhooks run --host 0.0.0.0 --port 1416 # With multiple workers hayhooks run --workers 4 # With custom pipelines directory hayhooks run --pipelines-dir ./my_pipelines # With additional Python path hayhooks run --additional-python-path ./custom_code # Reload on changes (development) hayhooks run --reload # Enable tracing dashboard UI (auto-builds dashboard frontend locally at runtime) hayhooks run --with-tracing-dashboard # Equivalent aliases hayhooks run --with-dashboard hayhooks run --tracing-dashboard ``` -------------------------------- ### Run Hayhooks with Chainlit Source: https://github.com/deepset-ai/hayhooks/blob/main/README.md Start the Hayhooks server with the Chainlit frontend enabled. ```bash hayhooks run --with-chainlit ``` -------------------------------- ### Production Environment Configuration Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/getting-started/configuration.md Example .env file for a production environment, setting host to 0.0.0.0 and disabling traceback display. ```dotenv # .env.production HAYHOOKS_HOST=0.0.0.0 HAYHOOKS_PORT=1416 LOG=INFO HAYHOOKS_SHOW_TRACEBACKS=false ``` -------------------------------- ### Development Environment Configuration Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/getting-started/configuration.md Example .env file for a development environment, enabling debug logging and traceback display. ```dotenv # .env.development HAYHOOKS_HOST=localhost HAYHOOKS_PORT=1416 LOG=DEBUG HAYHOOKS_SHOW_TRACEBACKS=true ``` -------------------------------- ### Create New Documentation Files Source: https://github.com/deepset-ai/hayhooks/blob/main/CONTRIBUTING_DOCS.md Add new Markdown files to the appropriate directories within the 'docs/' folder to create new feature or example documentation. ```bash # Create a new feature document touch docs/features/new-feature.md # Create a new example touch docs/examples/new-example.md ``` -------------------------------- ### Deploy Example Pipeline via CLI Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/getting-started/quick-start-docker.md Deploy a sample chat pipeline using the Hayhooks CLI. This command deploys the 'chat_with_website_streaming' pipeline. ```bash hayhooks pipeline deploy-files -n chat_with_website pipelines/chat_with_website_streaming ``` -------------------------------- ### Implement Async Pipeline Wrapper Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/deployment/deployment_guidelines.md Example of using async methods within a pipeline wrapper to improve I/O-bound performance. ```python from hayhooks import BasePipelineWrapper, Pipeline class PipelineWrapper(BasePipelineWrapper): def setup(self) -> None: self.pipeline = Pipeline.loads( (Path(__file__).parent / "pipeline.yml").read_text() ) async def run_api_async(self, query: str) -> str: result = await self.pipeline.run_async({"prompt": {"query": query}}) return result["llm"]["replies"][0] ``` -------------------------------- ### Launch Elasticsearch with Docker Compose Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/rag_indexing_query/README.md Starts an Elasticsearch instance using Docker Compose. This is required for the document store. ```bash docker compose up ``` -------------------------------- ### Deploy and Call Streaming Endpoint Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/pipeline_wrappers/run_api_streaming/README.md Deploy the example pipeline and then call the /run_api_streaming/run endpoint with a JSON payload. Use curl -N to keep the connection open for streaming. ```bash # 1. Set your OpenAI API key (the pipeline uses OpenAIChatGenerator) export OPENAI_API_KEY=your_api_key_here # 2. Deploy the example hayhooks deploy examples/pipeline_wrappers/run_api_streaming # 3. Call the /run endpoint with streaming enabled (-N keeps curl open) curl -N http://localhost:1416/run_api_streaming/run \ -H "Content-Type: application/json" \ -d '{"question": "What is Redis?", "urls": ["https://www.redis.io"]}' ``` -------------------------------- ### Clone Hayhooks Docker Compose Repository Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/getting-started/quick-start-docker.md Clone the repository to get the Docker Compose setup for Hayhooks and Open WebUI. Navigate into the cloned directory. ```bash git clone https://github.com/deepset-ai/hayhooks-open-webui-docker-compose.git cd hayhooks-open-webui-docker-compose ``` -------------------------------- ### Example Pipeline Output Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/shared_code_between_wrappers/README.md Shows the expected JSON output from a successful pipeline execution, demonstrating the result of the operation. ```json {"result": 4} ``` -------------------------------- ### Configure Startup Deployment Strategy Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/deployment/deployment_guidelines.md Environment variables to control how pipelines are deployed during server startup. ```bash # Parallel startup with 8 workers (recommended for many pipelines) export HAYHOOKS_STARTUP_DEPLOY_STRATEGY=parallel export HAYHOOKS_STARTUP_DEPLOY_WORKERS=8 # Fall back to sequential if needed export HAYHOOKS_STARTUP_DEPLOY_STRATEGY=sequential ``` -------------------------------- ### Define .env Configuration File Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/reference/environment-variables.md Example of a comprehensive .env file for managing all available Hayhooks environment variables. ```env HAYHOOKS_HOST=0.0.0.0 HAYHOOKS_PORT=1416 HAYHOOKS_MCP_HOST=0.0.0.0 HAYHOOKS_MCP_PORT=1417 HAYHOOKS_PIPELINES_DIR=./pipelines HAYHOOKS_ADDITIONAL_PYTHON_PATH=./custom_code HAYHOOKS_USE_HTTPS=false HAYHOOKS_DISABLE_SSL=false HAYHOOKS_SHOW_TRACEBACKS=false HAYHOOKS_STREAMING_COMPONENTS=all HAYHOOKS_DEPLOY_CONCURRENCY=serialized HAYHOOKS_STARTUP_DEPLOY_STRATEGY=parallel HAYHOOKS_STARTUP_DEPLOY_WORKERS=4 HAYHOOKS_DASHBOARD_ENABLED=true HAYHOOKS_DASHBOARD_DIST_DIR=./dashboard/dist HAYHOOKS_DASHBOARD_TRACE_DEFAULT_LIMIT=25 HAYHOOKS_DASHBOARD_TRACE_MAX_LIMIT=100 # Optional: only highlight slowest components above 1s # HAYHOOKS_DASHBOARD_UI_SLOW_COMPONENT_MIN_DURATION_MS=1000 # Optional: exclude Haystack component spans (included by default) # HAYHOOKS_DASHBOARD_TRACE_INCLUDE_HAYSTACK_SPANS=false # Optional: include raw request payload values in dashboard trace tags (safe metadata only by default) # HAYHOOKS_DASHBOARD_TRACE_INCLUDE_PAYLOAD_VALUES=true HAYHOOKS_CORS_ALLOW_ORIGINS=["*"] HAYHOOKS_LOG_LEVEL=INFO HAYHOOKS_LOG_FORMAT=default ``` -------------------------------- ### Deploy pipelines from files Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/cli-commands.md Use these commands to deploy a pipeline from a directory of wrapper files with various configuration options. ```bash # Basic deployment hayhooks pipeline deploy-files -n my_pipeline ./path/to/pipeline # With custom name and description hayhooks pipeline deploy-files -n my_pipeline --description "My pipeline" ./path/to/pipeline # Overwrite existing pipeline hayhooks pipeline deploy-files -n my_pipeline --overwrite ./path/to/pipeline # Skip saving files to server hayhooks pipeline deploy-files -n my_pipeline --skip-saving-files ./path/to/pipeline # Skip MCP tool registration hayhooks pipeline deploy-files -n my_pipeline --skip-mcp ./path/to/pipeline ``` -------------------------------- ### Python Code Example Source: https://github.com/deepset-ai/hayhooks/blob/main/CONTRIBUTING_DOCS.md Example of a Python function for use within documentation. ```python # Python code def example_function(): return "Hello, World!" ``` -------------------------------- ### Verify Hayhooks Installation Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/getting-started/installation.md Check the installed version and view available CLI commands. ```bash # Check version hayhooks --version # Show help hayhooks --help ``` -------------------------------- ### Install Hayhooks with A2A Support Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/a2a-support.md Install the necessary dependencies to enable A2A protocol support. ```bash pip install hayhooks[a2a] ``` -------------------------------- ### Build Production Documentation Site with Hatch Source: https://github.com/deepset-ai/hayhooks/blob/main/CONTRIBUTING_DOCS.md Build the documentation for deployment. The recommended approach uses the docs environment. Options include a clean build that removes old files first, and a strict build that fails on warnings. ```bash hatch run docs:build ``` ```bash hatch run docs:build --clean ``` ```bash hatch run docs:build --strict ``` -------------------------------- ### Install Hayhooks tracing dependencies Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/reference/environment-variables.md Install the necessary extras to enable OpenTelemetry tracing support in Hayhooks. ```bash pip install "hayhooks[tracing]" ``` -------------------------------- ### Deploy and Build Documentation with Hatch Source: https://github.com/deepset-ai/hayhooks/blob/main/CONTRIBUTING_DOCS.md Use Hatch to deploy documentation to GitHub Pages or to build the site locally. The site will be generated in the 'site/' directory. ```bash # Deploy to GitHub Pages (builds and deploys in one command) hatch run docs:deploy ``` ```bash # Or build only without deploying hatch run docs:build # The site is now ready in the site/ directory ``` ```bash hatch run docs:serve ``` -------------------------------- ### Run Demo with Custom Question Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/a2a_multi_agent/README.md Execute the demo script with a specific user prompt. ```bash python run_demo.py "I'm in Lisbon today, what should I do?" ``` -------------------------------- ### Quick Start: Configure and Run Hayhooks with Tracing Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/reference/tracing.md Set OpenTelemetry environment variables to configure tracing and then run Hayhooks. Ensure the OTEL_EXPORTER_OTLP_ENDPOINT is correctly set for your tracing backend. ```bash export OTEL_SERVICE_NAME=hayhooks export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf export OTEL_TRACES_SAMPLER=parentbased_traceidratio export OTEL_TRACES_SAMPLER_ARG=1.0 export HAYHOOKS_TRACING_EXCLUDED_SPANS='["send", "receive"]' hayhooks run ``` -------------------------------- ### GET /v1/models Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/openai-compatibility.md Lists all deployed pipelines. ```APIDOC ## GET /v1/models ### Description List all deployed pipelines. ### Method GET ### Endpoint /v1/models ``` -------------------------------- ### Start Hayhooks and Open WebUI Services Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/getting-started/quick-start-docker.md Start the Hayhooks and Open WebUI services in detached mode using Docker Compose. This will launch Hayhooks server on port 1416, Hayhooks MCP server on port 1417, and Open WebUI on port 3000. ```bash docker-compose up -d ``` -------------------------------- ### Check CLI Version Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/cli-commands.md Verify the currently installed version of the Hayhooks CLI. ```bash hayhooks --version ``` -------------------------------- ### Minimal production configuration Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/guides/production-best-practices.md A reference for a minimal production .env file configuration, including host, port, and CORS settings. ```bash HAYHOOKS_HOST=0.0.0.0 HAYHOOKS_PORT=1416 HAYHOOKS_PIPELINES_DIR=/app/pipelines HAYHOOKS_SHOW_TRACEBACKS=false HAYHOOKS_CORS_ALLOW_ORIGINS=["https://app.example.com"] HAYHOOKS_CORS_ALLOW_CREDENTIALS=true HAYHOOKS_STARTUP_DEPLOY_STRATEGY=parallel HAYHOOKS_STARTUP_DEPLOY_WORKERS=4 LOG=INFO ``` -------------------------------- ### Agent with Tool Call Interception and Open WebUI Events Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/concepts/agent-deployment.md Demonstrates agent setup with tools, async streaming chat completion, tool call lifecycle hooks, and Open WebUI status events. Use this for integrating agents with Open WebUI for enhanced visualization and interaction. ```python import time from collections.abc import AsyncGenerator from haystack.components.agents import Agent from haystack.components.generators.chat import OpenAIChatGenerator from haystack.dataclasses import ChatMessage from haystack.tools import Tool from hayhooks import BasePipelineWrapper, async_streaming_generator from hayhooks.open_webui import ( OpenWebUIEvent, create_details_tag, create_notification_event, create_status_event, ) def weather_function(location): """Mock weather API with a small delay""" weather_info = { "Berlin": {"weather": "mostly sunny", "temperature": 7, "unit": "celsius"}, "Paris": {"weather": "mostly cloudy", "temperature": 8, "unit": "celsius"}, "Rome": {"weather": "sunny", "temperature": 14, "unit": "celsius"}, } time.sleep(3) return weather_info.get(location, {"weather": "unknown", "temperature": 0, "unit": "celsius"}) 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: self.agent = Agent( chat_generator=OpenAIChatGenerator(model="gpt-4o-mini"), system_prompt="You're a helpful agent", tools=[weather_tool], ) def on_tool_call_start( self, tool_name: str, arguments: dict, # noqa: ARG002 id: str, # noqa: ARG002, A002 ) -> list[OpenWebUIEvent]: return [ create_status_event(description=f"Tool call started: {tool_name}"), create_notification_event(notification_type="info", content=f"Tool call started: {tool_name}"), ] def on_tool_call_end( self, tool_name: str, arguments: dict, result: str, error: bool, # noqa: ARG002 ) -> list[OpenWebUIEvent]: return [ create_status_event(description=f"Tool call ended: {tool_name}", done=True), create_notification_event(notification_type="success", content=f"Tool call ended: {tool_name}"), create_details_tag( tool_name=tool_name, summary=f"Tool call result for {tool_name}", content=(f"```\nArguments:\n{arguments}\n\nResponse:\n{result}\n```"), ), ] async def run_chat_completion_async( self, model: str, # noqa: ARG002 messages: list[dict], body: dict, # noqa: ARG002 ) -> AsyncGenerator[str, None]: chat_messages = [ChatMessage.from_openai_dict_format(message) for message in messages] return async_streaming_generator( on_tool_call_start=self.on_tool_call_start, on_tool_call_end=self.on_tool_call_end, pipeline=self.agent, pipeline_run_args={"messages": chat_messages}, ) ``` -------------------------------- ### Recommended Development `.env` File Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/guides/development-best-practices.md Configure sensible development defaults by creating a `.env` file in your project root. Hayhooks automatically loads this file on startup. This example sets host, port, pipeline directory, logging level, and traceback visibility. ```bash # .env (development) HAYHOOKS_HOST=localhost HAYHOOKS_PORT=1416 HAYHOOKS_PIPELINES_DIR=./pipelines LOG=DEBUG HAYHOOKS_SHOW_TRACEBACKS=true # Uncomment if you share code across wrappers: # HAYHOOKS_ADDITIONAL_PYTHON_PATH=./common ``` -------------------------------- ### GET /status Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/a2a-support.md Retrieves the server status and a list of all currently exposed agents. ```APIDOC ## GET /status ### Description Returns the current status of the server and lists all pipelines exposed as A2A agents. ### Method GET ### Endpoint /status ``` -------------------------------- ### Get All Pipeline Statuses Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/reference/api-reference.md Retrieves the operational status of all currently deployed pipelines. ```APIDOC ## GET /status ### Description Retrieves the operational status of all currently deployed pipelines. ### Method GET ### Endpoint /status ### Response #### Success Response (200) - **pipelines** (array) - A list of names of all deployed pipelines. - **status** (string) - The overall status indicator. #### Response Example ```json { "pipelines": [ "pipeline1", "pipeline2" ], "status": "Up!" } ``` ``` -------------------------------- ### Get Pipeline Status Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/reference/api-reference.md Checks the operational status of a specific deployed pipeline. ```APIDOC ## GET /status/{pipeline_name} ### Description Checks the operational status of a specific deployed pipeline. ### Method GET ### Endpoint /status/{pipeline_name} ### Parameters #### Path Parameters - **pipeline_name** (string) - Required - The name of the pipeline to check. ### Response #### Success Response (200) - **status** (string) - The current status of the pipeline (e.g., "Up!"). - **pipeline** (string) - The name of the pipeline. #### Response Example ```json { "status": "Up!", "pipeline": "pipeline_name" } ``` ``` -------------------------------- ### Example Pipeline Response Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/concepts/yaml-pipeline-deployment.md The expected JSON structure returned by a successful pipeline execution. ```json { "replies": ["Haystack is an open source framework..."], "documents": [...], "metadata": {...} } ``` -------------------------------- ### Useful Commands for Dashboard Development Source: https://github.com/deepset-ai/hayhooks/blob/main/dashboard/README.md A collection of npm scripts for common development tasks like starting the dev server, running tests, linting, building, and previewing the production build. ```bash # Start dev server (HMR) npm run dev # Run tests once npm run test # Run tests in watch mode npm run test:watch # Lint npm run lint # Build production assets to dist/ npm run build # Preview production build npm run preview ``` -------------------------------- ### GET /{pipeline_name}/.well-known/agent-card.json Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/a2a-support.md Retrieves the agent card configuration for a specific deployed pipeline. ```APIDOC ## GET /{pipeline_name}/.well-known/agent-card.json ### Description Retrieves the agent card metadata for the specified pipeline. ### Method GET ### Endpoint /{pipeline_name}/.well-known/agent-card.json ### Parameters #### Path Parameters - **pipeline_name** (string) - Required - The name of the deployed pipeline. ``` -------------------------------- ### Get All Pipeline Statuses Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/reference/api-reference.md Retrieves the status of all currently deployed pipelines on the Hayhooks server. ```http GET /status ``` -------------------------------- ### Access CLI Help Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/cli-commands.md Display help information for the main CLI or specific subcommands. ```bash # Show main help hayhooks --help # Show help for specific command hayhooks run --help hayhooks pipeline --help ``` -------------------------------- ### Python: Handling Files and Additional Parameters Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/file-upload-support.md Demonstrates how to define and handle multiple parameters, including files and other string arguments, within the `run_api` method. This allows for flexible input processing. ```python from fastapi import UploadFile class PipelineWrapper(BasePipelineWrapper): def run_api( self, files: list[UploadFile] | None = None, query: str = "", additional_param: str = "default" ) -> str: if files and len(files) > 0: filenames = [f.filename for f in files if f.filename is not None] return f"Received files: {', '.join(filenames)} with query: {query}" return "No files received" ``` -------------------------------- ### Run Dashboard Tests Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/tracing-dashboard-branch-review.md Executes Python tests for the dashboard functionality. Ensure pytest is installed. ```python pytest tests/test_dashboard_mount.py tests/test_it_dashboard.py tests/test_live_trace_buffer.py tests/test_tracing.py ``` -------------------------------- ### Implement Error Handling and Retry Logic Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/advanced/running-pipelines.md Example of wrapping a request with exponential backoff for robustness. ```python import requests from requests.exceptions import RequestException import time def run_with_retry(pipeline_name, params, max_retries=3): url = f"http://localhost:1416/{pipeline_name}/run" for attempt in range(max_retries): try: response = requests.post(url, json=params) response.raise_for_status() return response.json() except RequestException as e: if attempt == max_retries - 1: raise time.sleep(2 ** attempt) # Exponential backoff ``` -------------------------------- ### Deploy a Pipeline from Files Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/mcp-support.md Call the 'deploy_pipeline' tool to deploy a pipeline from a list of files. This includes specifying the pipeline name, file content, and options for saving and overwriting. ```python result = await client.call_tool("deploy_pipeline", { "name": "my_pipeline", "files": [ {"name": "pipeline_wrapper.py", "content": "..."}, {"name": "pipeline.yml", "content": "..."} ], "save_files": True, "overwrite": False }) ``` -------------------------------- ### Run Hayhooks with Tracing Dashboard Source: https://github.com/deepset-ai/hayhooks/blob/main/dashboard/README.md Command to start Hayhooks and serve the tracing dashboard application. ```bash hayhooks run --with-tracing-dashboard ``` -------------------------------- ### Tune Startup Deployment Performance Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/guides/production-best-practices.md Configures parallel deployment of pipelines to reduce boot time. Adjust the worker count based on the number of pipelines and available CPU resources. ```bash export HAYHOOKS_STARTUP_DEPLOY_STRATEGY=parallel export HAYHOOKS_STARTUP_DEPLOY_WORKERS=8 ``` -------------------------------- ### GET /{pipeline_name}/schema Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/concepts/yaml-pipeline-deployment.md Retrieves the JSON schema for the specified pipeline's input requirements. ```APIDOC ## GET /{pipeline_name}/schema ### Description Returns the input schema definition for the specified pipeline. ### Method GET ### Endpoint /{pipeline_name}/schema ``` -------------------------------- ### Get OpenAPI Schema Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/reference/api-reference.md Retrieves the OpenAPI specification for the Hayhooks API in JSON or YAML format. ```APIDOC ## GET /openapi.json, /openapi.yaml ### Description Retrieves the OpenAPI specification for the Hayhooks API in JSON or YAML format. ### Method GET ### Endpoint /openapi.json /openapi.yaml ### Response #### Success Response (200) - The response body contains the OpenAPI specification in either JSON or YAML format, depending on the requested endpoint. ``` -------------------------------- ### Build and Run Hayhooks from Source with Docker Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/getting-started/installation.md Build a local Docker image using Buildx Bake and run it. ```bash # Clone the repository git clone https://github.com/deepset-ai/hayhooks.git cd hayhooks # Build with Docker Buildx Bake (current platform) and load into Docker cd docker IMAGE_NAME=hayhooks IMAGE_TAG_SUFFIX=local docker buildx bake --load # Run the image docker run -p 1416:1416 hayhooks:local ``` -------------------------------- ### Deploy Documentation to GitHub Pages with Hatch Source: https://github.com/deepset-ai/hayhooks/blob/main/CONTRIBUTING_DOCS.md Deploy the documentation to GitHub Pages. Custom options like --force are available. ```bash hatch run docs:deploy ``` ```bash hatch run docs:deploy --force ``` -------------------------------- ### Run Hayhooks with Worker Configurations Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/deployment/deployment_guidelines.md Commands to start the Hayhooks server with single or multiple worker processes. ```bash hayhooks run ``` ```bash hayhooks run --workers 4 ``` -------------------------------- ### Run Pipeline with Python requests Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/reference/api-reference.md Demonstrates how to run a pipeline using the Python 'requests' library, sending a POST request with a JSON body. ```python import requests response = requests.post( "http://localhost:1416/chat_pipeline/run", json={"query": "Hello!"} ) print(response.json()) ``` -------------------------------- ### Example Request with Multipart Uploaded YAML File Source: https://github.com/deepset-ai/hayhooks/blob/main/examples/pipeline_wrappers/custom_tracing/README.md Send a POST request to the deployed endpoint with the pipeline definition provided as a file upload. This is useful for larger or pre-saved pipeline configurations. ```bash curl -X POST "http://localhost:1416/custom_tracing/run" \ -F "files=@./my_pipeline.yml" ``` -------------------------------- ### Get Status of a Specific Pipeline Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/mcp-support.md Call the 'get_pipeline_status' tool to retrieve the status of a specific pipeline by its name. ```python result = await client.call_tool("get_pipeline_status", {"pipeline_name": "my_pipeline"}) ``` -------------------------------- ### Deploy pipeline files Source: https://github.com/deepset-ai/hayhooks/blob/main/docs/features/cli-commands.md Deploy a pipeline using local files via CLI or HTTP POST request. ```bash # CLI hayhooks pipeline deploy-files -n my_pipeline ./path/to/pipeline # HTTP API curl -X POST http://localhost:1416/deploy_files \ -H 'Content-Type: application/json' \ -d '{ "name": "my_pipeline", "description": "My pipeline", "files": [...], "overwrite": false }' ```