wavefront icon indicating copy to clipboard operation
wavefront copied to clipboard

Agent inference returns {} for plain-text replies when output_json_enabled is true (the default)

Open vizsatiz opened this issue 1 month ago • 3 comments

Summary

output_json_enabled defaults to true for agent inference. For an agent without a parser, whose reply is plain text, the API then returns "result": {}: the answer is silently lost.

Reproduce

Agent with no parser. POST /floware/v2/agents/<id>/inference with {"inputs": [{"role": "user", "content": "…"}]}:

  • default → "result": {}
  • "output_json_enabled": false → "result": "The customer's name is …"

Expected

When JSON extraction finds no JSON, return the raw text (or fail clearly), rather than an empty object. Alternatively default output_json_enabled to whether the agent has a parser.

vizsatiz avatar Oct 17 '26 12:10 vizsatiz

The best fix is the API failing when such executions are done

vizsatiz avatar Oct 17 '26 12:10 vizsatiz

I’m working on a focused fix following the maintainer direction: fail the v2 API clearly when JSON output is requested but no JSON object can be extracted. I’ll add mocked-response regression coverage and preserve valid JSON (including {}), plain-text mode, and the existing parser contract. AI assistance will be disclosed in the PR.

Vamsi-2581 avatar Oct 17 '26 12:10 Vamsi-2581

Update: the focused non-streaming v2 fix is prepared: strict extraction returns HTTP 502 when no JSON object is found, with no raw-text fallback. The 3 failing-before regression cases now pass, as do all 9 focused cases and all 379 agents-module tests (cloud proxy variables cleared). Pre-commit checks pass. The full server run has 64 failures and 319 errors, exactly matching the unmodified baseline; this environment lacks PostgreSQL initdb. Publication is currently blocked by unavailable git push credentials in this cloud session. The signed patch is preserved; no PR has been opened. Please do not treat this as an exclusive claim while publication is blocked.

Vamsi-2581 avatar Oct 17 '26 13:10 Vamsi-2581