/ examples / consolidated_params / basic_caching.py
basic_caching.py
 1  """
 2  Basic Caching Example - Agent-Centric API
 3  
 4  Demonstrates caching with consolidated params.
 5  Presets: enabled, disabled, prompt
 6  """
 7  
 8  from praisonaiagents import Agent
 9  
10  # Basic: Enable caching with preset
11  agent = Agent(
12      instructions="You are a helpful assistant with caching enabled.",
13      caching="prompt",  # Presets: enabled, disabled, prompt
14  )
15  
16  if __name__ == "__main__":
17      # First call - will cache
18      response = agent.start("What is the capital of France?")
19      print(response)
20      
21      # Second call - may use cache
22      response = agent.start("What is the capital of France?")
23      print(response)