Replies: 2 comments 1 reply
|
I'm confirming that callouts from #87 do not meet your needs. It's a separate HTTP stack on purpose -- to prevent connection re-use across filter pipelines. Continuations would resolve issues we are currently having with provider fallback in discussion 287 -- showing that you've identified a need that expands beyond the scope of the agentic loop service. That is to say, I support adding this to core. In short, my analysis on discussion 287 leads me to believe that 1. you are right that we need this new primitive and 2. it belongs in core. For point 3. I'll try to think through it from the perspective of the key properties first:
We should consider being explicit about things like mTLS and SNI being inherited by continuations. My thought is that they should be inherited, because particularly for mTLS that's our identity and it would be strange for our continuation to have a different "identity" than the parent.
This makes connection re-use less problematic. This is the restriction that I couldn't add for generic http callouts, which is why it needed its own HTTP stack. Perfect. 👌🏻 ✨
Makes sense to me. And then ownership is easy because we should be able to return a response stream handle from our inner loop if we'd like. Clean.
Yes. Key feature. Makes perfect sense. For the shape of the API then, we minimally need
Open questions that come to mind
Performance questions
Overall big ➕ 1️⃣ from me. This will make the work I've been trying to do on provider fallback easier. |
|
➕ thank you for raising this. Agreed, that action is needed. I expect this will take some time, and there's some relation to https://github.com/orgs/praxis-proxy/discussions/87, so I have created #786 to encompass this, made it |
Uh oh!
There was an error while loading. Please reload this page.
Problem
Agentic AI loops need a decision after an upstream response, followed
by another upstream exchange:
Each iteration must target a configured upstream cluster -- with
routing, load balancing, endpoint selection, TLS, retries, and health
checks -- and pass through the full filter pipeline: guardrails,
auth, token accounting, logging, model rewrite.
This cannot be solved with existing primitives:
upstream response exists. Response-derived decisions (like tool calls
from a model) cannot trigger branch re-entry.
go to arbitrary endpoints and bypass the filter pipeline. Intermediate
model calls need the same guardrails and observability as the initial
call. A sub-request API also pushes proxy-level responsibility (cluster
routing, TLS, retries, response replacement) into filter logic.
Why a New Primitive
What is missing is an exchange-level loop: run a complete HTTP
exchange (request filters, upstream, response filters), inspect the
result, and optionally run another complete exchange before returning a
final response to the client.
This is different from branch chains (request-phase composition within
a single exchange) and different from sub-requests (filter-owned
callouts to external services). It loops over the proxy's own machinery
-- each iteration is a full proxy exchange through the configured
pipeline targeting the configured cluster.
Proposed Mechanism: Pipeline Continuations
A continuation is a core-scheduled follow-up HTTP exchange that
runs before the root request returns a final response to the
downstream client.
Key properties:
them. Filters never hold HTTP clients, manage TLS, or replace
downstream responses directly.
proxy's routing and upstream selection, not to an arbitrary endpoint
the filter specifies.
request filters, request body filters, upstream exchange, response
filters, and response body filters.
body buffers, retry counters) resets between steps. Workflow state
(iteration count, accumulated context) persists explicitly.
cancellation are enforced by core, not by individual filters.
Non-Goals
What We Are Asking
existing branch chains or other current primitives.
with the separation that filters request continuations while core
executes them.
proposal covering the executor, filter API, state lifecycle, config
shape, and safety semantics.
All reactions