Skip to content

feat(http): native SSE/text streaming support for http_json targets#324

Open
placerda wants to merge 1 commit into
simplify-readme-foundry-defaultfrom
feat/http-streaming-target
Open

feat(http): native SSE/text streaming support for http_json targets#324
placerda wants to merge 1 commit into
simplify-readme-foundry-defaultfrom
feat/http-streaming-target

Conversation

@placerda

Copy link
Copy Markdown
Contributor

Native SSE/text streaming for http_json eval targets

Lets 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 /orchestrator endpoint, which
responds with text/event-stream and prefixes its first chunk with the
conversation_id.

Defaults are unchanged: response_mode defaults to json and the existing
single-json.loads path is byte-for-byte compatible.

What changed

  • response_mode: json|sse|text on http_json targets selects the parser.
  • Optional stream block for aggregation: text_field (dotted path to token
    text when each data: line is JSON), done_marker (e.g. [DONE]),
    strip_leading_token (drops the leading whitespace-delimited token, e.g. the
    orchestrator's conversation_id).
  • Configurable auth header via auth_header_name (default Authorization) and
    auth_value_template (default Bearer {token}), so shared-secret gates such
    as X-API-KEY work without hardcoding the secret. {token} is replaced by
    the auth_header_env value at run time.
  • Streaming reuses the same stdlib urllib transport and 3-try backoff as the
    JSON path. A failed JSON parse on a text/event-stream response now suggests
    setting response_mode: sse|text.

Files

  • src/agentops/core/agentops_config.py: ResponseMode, StreamConfig, new
    fields, extended http-only validation gate.
  • src/agentops/pipeline/invocations.py: _http_request_stream,
    _strip_leading_token, _aggregate_stream, rewritten auth + streaming branch
    in _invoke_http_json.
  • tests/unit/test_http_streaming.py (new), tests/unit/test_agentops_config.py
    (gate tests).
  • CHANGELOG.md, AGENTS.md, and the agentops-eval SKILL (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.3 line (simplify-readme-foundry-default), which
is the latest released code. origin/main and origin/develop are still behind
v0.4.3, so this PR targets that branch to keep the diff to the streaming change
only. The v0.4.4 tag and GitHub release are cut from the head of this branch.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant