Utils API#

Auto-generated API documentation for utils.

Prompts#

Prompt templates for different agents.

src.utils.prompts.strip_suggested_prompts(prompt)[source]#

Remove the suggested-prompts section from a system prompt.

src.utils.prompts.get_hpc_agent_system_prompt()[source]#

Generate HPC agent system prompt with current configuration.

src.utils.prompts.build_rag_agent_prompt(*, read_only=False)[source]#

Build the RAG agent system prompt, adjusting tools for read_only mode.

API Usage#

API usage monitoring utilities.

This module provides functions to check API usage for various external services.

src.utils.api_usage.is_api_key_configured(api_key)[source]#

Return True if api_key looks like a real value (not empty/placeholder).

class src.utils.api_usage.TavilyUsageStats(key_usage, key_limit, key_percentage, current_plan, plan_usage, plan_limit, plan_percentage, paygo_usage, paygo_limit, paygo_percentage)[source]#

Bases: object

Tavily API usage statistics.

key_usage: int#
key_limit: int#
key_percentage: float#
current_plan: str#
plan_usage: int#
plan_limit: int#
plan_percentage: float#
paygo_usage: int#
paygo_limit: int#
paygo_percentage: float#
property is_approaching_limit: bool#

Check if usage is approaching limit (>80%).

property is_critical: bool#

Check if usage is critical (>95%).

__init__(key_usage, key_limit, key_percentage, current_plan, plan_usage, plan_limit, plan_percentage, paygo_usage, paygo_limit, paygo_percentage)#
src.utils.api_usage.get_tavily_usage(api_key)[source]#

Get Tavily API usage statistics.

Parameters:

api_key (str) – Tavily API key

Returns:

Usage statistics object or None if request fails

Return type:

TavilyUsageStats or None

Example:

Example response from Tavily API:
{
  "key": {"usage": 150, "limit": 1000},
  "account": {
    "current_plan": "Bootstrap",
    "plan_usage": 500,
    "plan_limit": 15000,
    "paygo_usage": 25,
    "paygo_limit": 100
  }
}