Docs / Recipes / Haystack

// AGENT FRAMEWORK · HAYSTACK

Haystack

Pattern A · full governance

Point Haystack's OpenAIGenerator at the gateway with api_base_url. Every pipeline run routes through Agentics.

Pattern A — routed through the gateway. Your call travels through Agentics via a base-URL swap, so it is governed (routing, budgets, guardrails) inline and the Proof Ledger writes one verifiable receipt server-side. The receipt hash comes back in the x-agentics-receipt response header.

Install

shell
pip install haystack-ai

Point the framework's OpenAI client at the gateway

The parameter is api_base_url on OpenAIGenerator.

Python
from haystack.components.generators import OpenAIGenerator from haystack.utils import Secret gen = OpenAIGenerator( model="@anthropic/claude-opus-4-8", api_key=Secret.from_token("ak_…"), # AGENTICS_API_KEY api_base_url="https://agentics.you/api/v1", # the only change ) print(gen.run("hi")["replies"][0])

Run one call → see the receipt

Run your normal invocation, then read the receipt for that call off the ledger:

shell
# after your run, the last call's receipt hash: agentics log tail --limit 1 # → shows x-agentics-receipt: <receipt_hash> (verify it at /trust)

Every call the framework makes is now routed, governed, and receipted server-side.