Skip to content

feat(agents,core): [ENG-1272]/[ENG-1271] refactor rate limiters and add generator retry/timeout policies#2239

Merged
Hartorn merged 261 commits intomainfrom
feature/eng-1272-add-composite-limiter-global-kind-target-to-giskard-agents
Feb 26, 2026
Merged

feat(agents,core): [ENG-1272]/[ENG-1271] refactor rate limiters and add generator retry/timeout policies#2239
Hartorn merged 261 commits intomainfrom
feature/eng-1272-add-composite-limiter-global-kind-target-to-giskard-agents

Conversation

@kevinmessiaen
Copy link
Copy Markdown
Member

@kevinmessiaen kevinmessiaen commented Feb 6, 2026

  • Moved rate limiters to core library
  • Added timeout support for generator requests
  • Implemented max delay for retry backoff
  • Enhanced retry policy configuration (+ new tests)

mattbit and others added 30 commits June 12, 2025 14:42
* feat: reorganize generators with base class and mixins

* fix: import formatting
…y complete (#8)

* feat: add stream_many and stream_batch to get pipeline results as they complete

* fix: batch context copy

* fix: deep copy context

---------

Co-authored-by: Pierre Le Jeune <pierre@giskard.ai>
* Fix: Added missing finish reason

* Update src/counterpoint/generators/base.py

---------

Co-authored-by: Pierre Le Jeune <pierre@giskard.ai>
* Added temperature

* Fix default temperature in pipeline

* Moved temperature conf to generator

* Ran linter

* Fixed typing issue with conftest

---------

Co-authored-by: Pierre Le Jeune <pierre@giskard.ai>
* feat: better transcript for chats with tool usage
* feat: add retry policy to generators

* fix: remove unused code

* fix retry for batch_complete
Copy link
Copy Markdown
Member

@mattbit mattbit left a comment

Choose a reason for hiding this comment

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

The approach is good, but the implementation has some little bugs/improvements to fix.

I would also rename the module to rate_limiter since this seems to be the term used for all objects.

mattbit and others added 7 commits February 13, 2026 08:35
* improve workflows

* add labeler workflow

* drop ci scope

* pin action versions
- Adjusted dependency grouping settings to match all package names and update types.
- Changed group name and slug to be dynamic based on the manager.
…-limiter-global-kind-target-to-giskard-agents
…in BasicRateLimiter

This commit improves type annotations for the `RateLimiterRegistry` class by specifying the type for `_lock` and initializing `instances` with a type hint in the `get` method. Additionally, the unused `model_post_init` method in `BasicRateLimiter` has been removed to streamline the code.
…ate limiters

This commit improves the state management in the `RateLimiterRegistry` and `BaseRateLimiter` classes by introducing a private attribute for state handling. It also updates type annotations for better clarity and consistency. The unused `get_state` method has been removed, streamlining the code further.
This commit introduces a warning mechanism in the `RateLimiterRegistry` to alert users when attempting to register a rate limiter with an existing ID. A new environment variable, `GISKARD_DISABLE_DUPLICATE_RATE_LIMITERS_WARNINGS`, has been added to control the display of these warnings. Additionally, tests have been updated to verify the warning behavior when duplicate IDs are used, ensuring that the functionality works as intended.
docs(limiter): enhance module docstrings and add method descriptions

This commit improves the documentation for the rate limiter modules by adding detailed docstrings to classes and methods. The changes provide clearer explanations of the functionality, parameters, and return values, enhancing the overall understanding of the rate limiting system.
"""
Base automatically changed from feature/giskard-v3 to main February 17, 2026 15:32
@henchaves
Copy link
Copy Markdown
Member

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This is a solid pull request that refactors the rate limiting mechanism into the core library, enhancing modularity and reusability. The new rate limiter implementation is robust, featuring a registry for state sharing across instances and comprehensive test coverage. Additionally, the retry policy has been improved with max_delay and timeout support for generator requests, both of which are well-tested. I have one suggestion to improve the robustness of the retry condition logic.

mattbit and others added 8 commits February 26, 2026 14:12
…p tests

- Make BaseRateLimiter abstract (ABC) with throttle as @AbstractMethod
- Add lock to get_instance for consistency with register_instance
- Fix docstring referencing wrong class name (RateLimiter → BaseRateLimiter)
- Fix RetriableError extending BaseException instead of Exception
- Remove dead mock_response fixture with bogus self parameter
- Use uuid ids in registry tests to isolate from singleton state
- Document rate limiting inside retry loop on LiteLLMGenerator
…patibility

Without a yield in the body, Pyright classifies the async def as a
regular coroutine rather than an async generator function, causing a
type mismatch with @asynccontextmanager.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

6 participants