feat(integrations): add full cascade PydanticAI Model integration#179
Merged
saschabuehrle merged 1 commit intomainfrom Apr 2, 2026
Merged
feat(integrations): add full cascade PydanticAI Model integration#179saschabuehrle merged 1 commit intomainfrom
saschabuehrle merged 1 commit intomainfrom
Conversation
Add gold-standard PydanticAI integration with full cascade intelligence: speculative drafting with quality gating, complexity-based pre-routing, domain policies, tool risk validation, cost tracking with savings calculation, and harness metrics recording. - CascadeFlowModel: drop-in PydanticAI Model with drafter→verifier cascade - Pre-routing via ComplexityDetector for HARD/EXPERT queries - Quality scoring bridge (core QualityValidator + heuristic fallback) - Tool risk escalation for high-risk tool calls - Domain policy overrides (threshold, force_verifier, direct_to_verifier) - Streaming support with optimistic drafter + quality-gated escalation - Full harness integration (cost, latency, energy, budget gates) - 58 tests covering cascade flow, domain policies, tool risk, streaming, harness metrics, budget enforcement, and fail-open behavior - Docs, README, example, and pyproject.toml optional dependency
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
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.
Summary
CascadeFlowModeldrops in as any PydanticAIModel, performing speculative drafting with quality gating, complexity-based pre-routing, domain policies, tool risk validation, and cost tracking with savingsWhat's included
cascadeflow/integrations/pydantic_ai/model.pyCascadeFlowModel— full cascade Model implementationcascadeflow/integrations/pydantic_ai/config.pyCascadeFlowPydanticAIConfig+DomainPolicytypescascadeflow/integrations/pydantic_ai/quality.pycascadeflow/integrations/pydantic_ai/harness_bridge.pycascadeflow/integrations/pydantic_ai/types.pyCascadeResult,CostMetadatacascadeflow/integrations/pydantic_ai/__init__.pycreate_cascade_model()factorytests/test_pydantic_ai_integration.pydocs-site/integrations/pydantic-ai.mdxexamples/integrations/pydantic_ai_harness.pypyproject.tomlpydantic-aiextraUsage
Test plan
pydantic_ai: True