Skip to content

Implement fail-fast in Lungo project in case the configured LLM doesn't support it#383

Open
delthazor wants to merge 9 commits intomainfrom
fix-247-fail-fast-streaming
Open

Implement fail-fast in Lungo project in case the configured LLM doesn't support it#383
delthazor wants to merge 9 commits intomainfrom
fix-247-fail-fast-streaming

Conversation

@delthazor
Copy link

@delthazor delthazor commented Feb 24, 2026

In Lungo project, agents treat native streaming support as a given, and if the configured LLM does not support that, it can cause problems. Therefore this capability should be detected early, cause a fail if missing.

Description

Add an optional fail-fast check so that when the corresponding feature flag is enabled, the application does not start if the configured LLM does not support streaming (according to LiteLLM metadata), avoiding supervisors that require streaming from starting with a non-streaming model.

Feature flag: ENSURE_STREAMING_LLM (default false)

Check: read LLM_MODEL from config, call litellm.get_model_info() for supports_native_streaming; if the flag is on and the model does not support streaming, log guidance and raise StreamingNotSupportedError before the graph is created. Exception handling: known LiteLLM errors (e.g. NotFoundError, APIConnectionError) and any other exception are caught with debug logging; failures to get model info are treated as streaming not supported (fail closed).

Tests: unit tests (no app-sdk) and integration-style parametrized tests for all three supervisors.

Issue Link

Fixes #247

Type of Change

  • Bugfix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

codyhartsook
codyhartsook previously approved these changes Feb 24, 2026
Copy link
Contributor

@codyhartsook codyhartsook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks solid

…'t support streaming

In Lungo project, agents treat native streaming support as a given, and if the configured LLM does not support that, it can cause problems. Therefore this capability should be detected early, cause a fail if missing.

Signed-off-by: pdobrei <[email protected]>
Overwriting the common module caused failures in other tests, as not all of them purges the loaded modules. Replaced the overwrite with a fake name import intsead.

Signed-off-by: pdobrei <[email protected]>
Instead of directly reading the config, the check utility uses a param to get the LLM model name. Caller can provide the appropriate name.

Signed-off-by: pdobrei <[email protected]>
If calling get streaming capability function causes any exception to occur in API calls, they should be returned, so the caller knows if the result is due to an error.

Signed-off-by: pdobrei <[email protected]>
Change unit tests to use parameter tables for running similar tests to reduce test bloat at the beginning of each test.

Signed-off-by: pdobrei <[email protected]>
Current tests use only single calls, so they should expect functions to be called only once.

Signed-off-by: pdobrei <[email protected]>
pregnor
pregnor previously approved these changes Feb 25, 2026
Tests changing env vars had a chance to bleed into other tests even though there was a cleanup. So changed the way they are set and cleaned, so the handling is safer.

Signed-off-by: pdobrei <[email protected]>
pregnor
pregnor previously approved these changes Feb 26, 2026
codyhartsook
codyhartsook previously approved these changes Feb 26, 2026
Copy link
Contributor

@codyhartsook codyhartsook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Fixing how config import is used to allow more precise reference to the config flag.

Signed-off-by: pdobrei <[email protected]>
Save imported module states before and do a proper restore after the failfast tests, due to other tests depending on the original class identifiers.

Signed-off-by: pdobrei <[email protected]>
@delthazor delthazor dismissed stale reviews from codyhartsook and pregnor via 467f1bb February 27, 2026 10:44
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.

Fail fast when LLM lacks streaming for agents that have native streaming support in their framework

3 participants