1- """AgentGuard client for policy evaluation and tool execution."""
1+ """TealTiger client for policy evaluation and tool execution."""
22
33import logging
44import time
55from typing import Any , Awaitable , Callable , Dict , Optional , Union
66
77import httpx
88
9- from agentguard .types import ExecutionContext , ExecutionResult , SecurityDecision
9+ from tealtiger .types import ExecutionContext , ExecutionResult , SecurityDecision
1010
1111logger = logging .getLogger (__name__ )
1212
1313
14- class AgentGuardError (Exception ):
15- """Base exception for AgentGuard errors."""
14+ class TealTigerError (Exception ):
15+ """Base exception for TealTiger errors."""
1616
1717 def __init__ (self , message : str , code : str = "UNKNOWN_ERROR" , details : Optional [Dict [str , Any ]] = None ):
1818 super ().__init__ (message )
1919 self .code = code
2020 self .details = details or {}
2121
2222
23- class AgentGuard :
24- """Main client for interacting with the AgentGuard Security Sidecar Agent."""
23+ class TealTiger :
24+ """Main client for interacting with the TealTiger Security Sidecar Agent."""
2525
2626 def __init__ (
2727 self ,
@@ -36,7 +36,7 @@ def __init__(
3636 on_security_decision : Optional [Callable [[SecurityDecision ], None ]] = None ,
3737 on_error : Optional [Callable [[Exception ], None ]] = None ,
3838 ) -> None :
39- """Initialize the AgentGuard client.
39+ """Initialize the TealTiger client.
4040
4141 Args:
4242 api_key: API key for authentication
@@ -63,7 +63,7 @@ def __init__(
6363 # Configure logging
6464 if debug :
6565 logging .basicConfig (level = logging .DEBUG )
66- logger .debug (f"[AgentGuard ] Initialized with SSA URL: { self .ssa_url } " )
66+ logger .debug (f"[TealTiger ] Initialized with SSA URL: { self .ssa_url } " )
6767
6868 self ._headers = {
6969 "Authorization" : f"Bearer { api_key } " ,
@@ -122,8 +122,8 @@ async def execute_tool(
122122 context_dict = context .dict () if isinstance (context , ExecutionContext ) else context
123123
124124 if self .debug :
125- logger .debug (f"[AgentGuard ] Evaluating tool: { tool_name } " )
126- logger .debug (f"[AgentGuard ] Parameters: { self ._sanitize_params (parameters )} " )
125+ logger .debug (f"[TealTiger ] Evaluating tool: { tool_name } " )
126+ logger .debug (f"[TealTiger ] Parameters: { self ._sanitize_params (parameters )} " )
127127
128128 # Evaluate security
129129 decision = await self ._evaluate_security_async (tool_name , parameters , context_dict )
@@ -151,7 +151,7 @@ async def execute_tool(
151151 self .on_error (error )
152152
153153 if self .debug :
154- logger .error (f"[AgentGuard ] Tool execution failed: { error } " )
154+ logger .error (f"[TealTiger ] Tool execution failed: { error } " )
155155
156156 return ExecutionResult (
157157 success = False ,
@@ -193,7 +193,7 @@ def execute_tool_sync(
193193 context_dict = context .dict () if isinstance (context , ExecutionContext ) else context
194194
195195 if self .debug :
196- logger .debug (f"[AgentGuard ] Evaluating tool: { tool_name } " )
196+ logger .debug (f"[TealTiger ] Evaluating tool: { tool_name } " )
197197
198198 # Evaluate security
199199 decision = self ._evaluate_security_sync (tool_name , parameters , context_dict )
@@ -221,7 +221,7 @@ def execute_tool_sync(
221221 self .on_error (error )
222222
223223 if self .debug :
224- logger .error (f"[AgentGuard ] Tool execution failed: { error } " )
224+ logger .error (f"[TealTiger ] Tool execution failed: { error } " )
225225
226226 return ExecutionResult (
227227 success = False ,
@@ -316,7 +316,7 @@ async def _handle_allow_async(
316316 ) -> ExecutionResult :
317317 """Handle allow decision asynchronously."""
318318 if self .debug :
319- logger .debug (f"[AgentGuard ] Tool allowed: { decision .reason } " )
319+ logger .debug (f"[TealTiger ] Tool allowed: { decision .reason } " )
320320
321321 data = None
322322 if executor :
@@ -340,7 +340,7 @@ def _handle_allow_sync(
340340 ) -> ExecutionResult :
341341 """Handle allow decision synchronously."""
342342 if self .debug :
343- logger .debug (f"[AgentGuard ] Tool allowed: { decision .reason } " )
343+ logger .debug (f"[TealTiger ] Tool allowed: { decision .reason } " )
344344
345345 data = None
346346 if executor :
@@ -362,7 +362,7 @@ async def _handle_transform_async(
362362 ) -> ExecutionResult :
363363 """Handle transform decision asynchronously."""
364364 if self .debug :
365- logger .debug (f"[AgentGuard ] Tool transformed: { decision .reason } " )
365+ logger .debug (f"[TealTiger ] Tool transformed: { decision .reason } " )
366366
367367 if not decision .original_request :
368368 return ExecutionResult (
@@ -392,7 +392,7 @@ def _handle_transform_sync(
392392 ) -> ExecutionResult :
393393 """Handle transform decision synchronously."""
394394 if self .debug :
395- logger .debug (f"[AgentGuard ] Tool transformed: { decision .reason } " )
395+ logger .debug (f"[TealTiger ] Tool transformed: { decision .reason } " )
396396
397397 if not decision .original_request :
398398 return ExecutionResult (
@@ -418,7 +418,7 @@ def _handle_transform_sync(
418418 def _handle_deny (self , decision : SecurityDecision ) -> ExecutionResult :
419419 """Handle deny decision."""
420420 if self .debug :
421- logger .debug (f"[AgentGuard ] Tool denied: { decision .reason } " )
421+ logger .debug (f"[TealTiger ] Tool denied: { decision .reason } " )
422422
423423 return ExecutionResult (
424424 success = False ,
@@ -444,12 +444,12 @@ def _update_stats(self, decision: SecurityDecision, response_time: float) -> Non
444444 def _validate_tool_name (self , tool_name : str ) -> None :
445445 """Validate tool name."""
446446 if not tool_name or not isinstance (tool_name , str ):
447- raise AgentGuardError ("Tool name must be a non-empty string" , "VALIDATION_ERROR" )
447+ raise TealTigerError ("Tool name must be a non-empty string" , "VALIDATION_ERROR" )
448448
449449 def _validate_parameters (self , parameters : Dict [str , Any ]) -> None :
450450 """Validate parameters."""
451451 if not isinstance (parameters , dict ):
452- raise AgentGuardError ("Parameters must be a dictionary" , "VALIDATION_ERROR" )
452+ raise TealTigerError ("Parameters must be a dictionary" , "VALIDATION_ERROR" )
453453
454454 def _sanitize_params (self , parameters : Dict [str , Any ]) -> Dict [str , Any ]:
455455 """Sanitize parameters for logging."""
@@ -465,15 +465,15 @@ def close_sync(self) -> None:
465465 """Close the sync HTTP client."""
466466 self ._sync_client .close ()
467467
468- async def __aenter__ (self ) -> "AgentGuard " :
468+ async def __aenter__ (self ) -> "TealTiger " :
469469 """Async context manager entry."""
470470 return self
471471
472472 async def __aexit__ (self , * args : Any ) -> None :
473473 """Async context manager exit."""
474474 await self .close ()
475475
476- def __enter__ (self ) -> "AgentGuard " :
476+ def __enter__ (self ) -> "TealTiger " :
477477 """Sync context manager entry."""
478478 return self
479479
0 commit comments