Recording a Haystack pipeline and replaying it with the provider unreachable #12729
xizhuomengcontin
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I maintain OrcaReplay (Apache-2.0), which records an agent or pipeline run from outside the process and can serve the recording back so the run happens again with no provider called. I checked it against Haystack tonight. Short version: it captures with no changes to your pipeline at all, and I want to correct something I had written down about Haystack a few days ago.
The correction first
My own notes said Haystack failed to capture: the client received the proxy URL but the request never arrived and the call timed out. I did not publish that anywhere, because I could not explain it and would not claim a framework was unsupported on one bad run.
Tonight I retested on the same version (
haystack-ai3.1.1, Python 3.12) in two shapes — the generator on its own and a realPipeline— and both captured cleanly. I cannot reproduce the earlier failure, so the honest conclusion is that it was environmental on my side (most likely a system proxy variable in that shell), not a Haystack or OrcaReplay defect. Saying so here rather than letting a wrong note sit in my own docs.Why it works with zero changes
OpenAIChatGeneratortakesapi_base_urldefaulting toNoneand passes it straight through as the client'sbase_url. When that isNone, the OpenAI SDK falls back toOPENAI_BASE_URLfrom the environment — which is exactly the variableorca recordsets for the child process it launches, and only for that process.So nothing in the pipeline changes:
Then, with the origin process killed:
exact=1means the replayed request matched the recording byte for byte — prompt rendering, message assembly and parameters all reproduced — with nothing upstream to talk to. Your components, your connections and your own code run for real; only the model's answer comes from the trace.Where this is useful in a Haystack project
ChatPromptBuildertemplate and replaying shows you the diff as a reported divergence, with its size, rather than a silently different run.Two limits, stated rather than buried
egress=blockedmeans model-provider egress, not network isolation. Replay stops the model call, but your components still run for real — a retriever still hits your document store, a custom component still makes its own calls. It is not a sandbox.One version note for anyone trying this:
OpenAIGenerator(the non-chat one) is gone in 3.1.1 —haystack.components.generators.chat.openai.OpenAIChatGeneratoris the path that exists.Tested with a deterministic local origin standing in for a provider, so the "same answer" above is a real byte comparison rather than a coincidence.
All reactions