feat(http): native SSE/text streaming support for http_json targets#324
Open
placerda wants to merge 1 commit into
Open
feat(http): native SSE/text streaming support for http_json targets#324placerda wants to merge 1 commit into
placerda wants to merge 1 commit into
Conversation
Add response_mode (json|sse|text), an optional stream block (text_field,
done_marker, strip_leading_token), and a configurable auth header
(auth_header_name / auth_value_template) to the http_json evaluation
target so AgentOps can evaluate SSE/streaming agents such as the
gpt-rag-orchestrator /orchestrator endpoint directly.
response_mode defaults to json and reproduces the existing single
json.loads behavior byte-for-byte. Streaming reuses the same stdlib
urllib transport and 3-try backoff as the JSON path. The auth header
defaults to Authorization: Bearer {token}, preserving current behavior,
while allowing a raw shared-secret header (e.g. X-API-KEY) sourced from
an env var. A JSON-parse failure on a text/event-stream response now
suggests response_mode: sse|text.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Native SSE/text streaming for
http_jsoneval targetsLets AgentOps evaluate streaming agents (Server-Sent Events or raw text)
directly, without writing and hosting a thin non-streaming adapter. The
motivating case is the gpt-rag-orchestrator
/orchestratorendpoint, whichresponds with
text/event-streamand prefixes its first chunk with theconversation_id.Defaults are unchanged:
response_modedefaults tojsonand the existingsingle-
json.loadspath is byte-for-byte compatible.What changed
response_mode: json|sse|textonhttp_jsontargets selects the parser.streamblock for aggregation:text_field(dotted path to tokentext when each
data:line is JSON),done_marker(e.g.[DONE]),strip_leading_token(drops the leading whitespace-delimited token, e.g. theorchestrator's
conversation_id).auth_header_name(defaultAuthorization) andauth_value_template(defaultBearer {token}), so shared-secret gates suchas
X-API-KEYwork without hardcoding the secret.{token}is replaced bythe
auth_header_envvalue at run time.urllibtransport and 3-try backoff as theJSON path. A failed JSON parse on a
text/event-streamresponse now suggestssetting
response_mode: sse|text.Files
src/agentops/core/agentops_config.py:ResponseMode,StreamConfig, newfields, extended http-only validation gate.
src/agentops/pipeline/invocations.py:_http_request_stream,_strip_leading_token,_aggregate_stream, rewritten auth + streaming branchin
_invoke_http_json.tests/unit/test_http_streaming.py(new),tests/unit/test_agentops_config.py(gate tests).
CHANGELOG.md,AGENTS.md, and theagentops-evalSKILL (plugin + template).Validation
Full unit suite: 991 passed, 1 skipped (14 net-new tests, no regressions).
Note on base branch
This PR is based on the
v0.4.3line (simplify-readme-foundry-default), whichis the latest released code.
origin/mainandorigin/developare still behindv0.4.3, so this PR targets that branch to keep the diff to the streaming change
only. The
v0.4.4tag and GitHub release are cut from the head of this branch.