From 21274c852367a6bfbdc915cba28b337cb5169b0f Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 2 Sep 2026 19:12:17 -0700 Subject: [PATCH] refactor(agent): pack import lists (AST-identical) --- agent/moa_loop.py | 14 +++----------- agent/nous_rate_guard.py | 7 +------ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/agent/moa_loop.py b/agent/moa_loop.py index 6fc0af6ac3..15109857d6 100644 --- a/agent/moa_loop.py +++ b/agent/moa_loop.py @@ -299,14 +299,9 @@ def _maybe_apply_moa_cache_control( Returns the messages unchanged on any error. """ try: - from agent.agent_runtime_helpers import ( - anthropic_prompt_cache_policy, - blank_cache_policy_stub, - ) + from agent.agent_runtime_helpers import anthropic_prompt_cache_policy, blank_cache_policy_stub from agent.prompt_caching import ( - apply_anthropic_cache_control, - effective_cache_ttl, - envelope_tool_part_cache_markers_supported, + apply_anthropic_cache_control, effective_cache_ttl, envelope_tool_part_cache_markers_supported, ) # Explicit kwarg > runtime snapshot (threaded from the live agent) > config. @@ -436,10 +431,7 @@ def _trim_messages_for_reference( if not messages: return messages - from agent.model_metadata import ( - estimate_messages_tokens_rough, - get_model_context_length, - ) + from agent.model_metadata import estimate_messages_tokens_rough, get_model_context_length model = str(slot.get("model") or "") provider = str(runtime.get("provider") or slot.get("provider") or "") diff --git a/agent/nous_rate_guard.py b/agent/nous_rate_guard.py index 15654598a4..3b87c8677a 100644 --- a/agent/nous_rate_guard.py +++ b/agent/nous_rate_guard.py @@ -16,12 +16,7 @@ import time from typing import Any, Mapping, Optional from utils import atomic_write_text from agent.rate_limit_tracker import ( - _BUCKET_TAGS, - _fmt_seconds, - _safe_float, - _safe_int, - has_rate_limit_headers, - lower_headers, + _BUCKET_TAGS, _fmt_seconds, _safe_float, _safe_int, has_rate_limit_headers, lower_headers, ) logger = logging.getLogger(__name__)