Skip to content

feat(openapi): add max_output_bytes to cap response text size - #4490

Merged
dgageot merged 1 commit into
docker:mainfrom
dgageot:feat/openapi-max-output-bytes
Oct 1, 2026
Merged

dgageot merged 1 commit into
docker:mainfrom
dgageot:feat/openapi-max-output-bytes

Conversation

@dgageot

@dgageot dgageot commented Oct 1, 2026

Copy link
Copy Markdown
Member

Generated OpenAPI tools always truncated response text at 30,000 bytes. That's fine for small payloads, but it silently drops data on APIs that return larger objects — for example a public PokeAPI pokemon lookup, whose stats and types fields land past the cutoff and never reach the model.

This adds an optional max_output_bytes field to the openapi toolset. Omitting it keeps today's 30,000-byte default, 0 disables the text cutoff entirely, and any positive integer sets a custom cap. The field is rejected by schema and config validation when used on a non-openapi toolset or set to a negative value. The separate 1 MiB HTTP response read limit is unchanged, and truncation (both the new cutoff and the existing 1 MiB cap) still cuts on a UTF-8 rune boundary so output is never left with a partial multi-byte character. examples/openapi-pokemon.yaml and the docs at docs/tools/openapi/index.md show the new field in use.

This is backward compatible: existing configs that don't set max_output_bytes behave exactly as before.

@dgageot
dgageot requested a review from a team as a code owner October 1, 2026 07:18
@aheritier aheritier added area/api For features/issues/fixes related to the usage of the cagent API area/config For configuration parsing, YAML, environment variables area/docs Documentation changes kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Oct 1, 2026
@dgageot
dgageot force-pushed the feat/openapi-max-output-bytes branch from d4eac70 to 4d5e319 Compare October 1, 2026 08:05
Generated OpenAPI tools return at most 30,000 bytes of response text by
default, which silently drops data on APIs with larger payloads (e.g. the
public PokeAPI). Add an optional max_output_bytes toolset field: omitted
keeps the 30000 default, 0 disables the text cutoff, and any positive value
sets a custom cap. The separate 1 MiB HTTP read limit and UTF-8 boundary
safety are preserved.
@dgageot
dgageot force-pushed the feat/openapi-max-output-bytes branch from 4d5e319 to 20388da Compare October 1, 2026 08:16
@dgageot
dgageot added this pull request to the merge queue Oct 1, 2026
Merged via the queue into docker:main with commit 9671313 Oct 1, 2026
22 checks passed
@dgageot
dgageot deleted the feat/openapi-max-output-bytes branch October 1, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api For features/issues/fixes related to the usage of the cagent API area/config For configuration parsing, YAML, environment variables area/docs Documentation changes kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants