Back to articles
One Decorator to Audit Every AI Agent Call
How-ToTools

One Decorator to Audit Every AI Agent Call

via Dev.to TutorialJoão André Gomes Marques

Your AI agent makes hundreds of API calls a day. Can you prove what it did last Tuesday at 3pm? asqav signs every function call with quantum-safe cryptography. One decorator. Setup pip install asqav Sign any function import asqav asqav . init ( api_key = " sk_... " ) @asqav.sign def call_model ( prompt : str ): return openai . chat . completions . create ( model = " gpt-4 " , messages = [{ " role " : " user " , " content " : prompt }] ) result = call_model ( " Summarize this document " ) # Function runs normally. A signed audit record is created automatically. The decorator detects async functions too. No changes needed. @asqav.sign async def async_call ( prompt : str ): return await client . chat . completions . create (...) Custom action types Default action type is function:call . Override it: @asqav.sign ( action_type = " deploy:production " ) def deploy ( version : str ): ... Group signs with sessions with asqav . session () as s : s . sign ( " step:fetch " , { " source " : " api

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
2 views

Related Articles