Add supervisor cache#12
Open
xabiandrade-db wants to merge 10 commits into
Open
Conversation
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
Implements a routing cache for the Supervisor agent, relying on VS. This implementation caches routing decisions (which agent to use) rather than complete responses. Queries like "What is my bill today?" or "What is my account status?" contain user-specific and time-sensitive data that requires tool calling.
Changes
Cache Manager (
telco_support_agent/cache/manager.py)Implemented a new
CacheManagerclass that handles routing cache operations:Cache lookup with similarity validation:
get_cache()vector similarity search and validates results against a configurable threshold. Only returns cached routing decisions when the similarity score meets or exceeds the threshold.Cache writing:
put_cache()andadd_to_cache_async()methods write new routing decisions to the cache table. The async variant uses background threads to avoid blocking the routing flow.Supervisor Agent Integration (
telco_support_agent/agents/supervisor.py)Modified the supervisor's routing logic to leverage the cache:
Cache initialization: Supervisor instantiates
CacheManagerwhen cache is enabled in configuration (configs/agents/supervisor.yaml)Routing flow with cache: The
route_query()method now:get_cache(query)add_to_cache_async()(agent_type, cache_hit_boolean)for trackingConfigurable behavior: Cache can be toggled on/off and similarity threshold tuned via
supervisor.yamlconfigurationConfiguration
Testing
notebooks/02_run_agent/test_routing_cache.py.