Autonomous Agent Audit
An Autonomous Agent Audit tests your AI agent for security vulnerabilities, safety risks, and quality issues using autonomous red teaming agents. It explores how your agent behaves, builds a risk model for its use case, and runs targeted attacks to find weaknesses.
Use hub.red_team_audits to run audits from Python, or launch and review them in the Hub UI.
Before you start
Section titled âBefore you startâFollow the SDK quickstart to connect to the Hub, then register the agent you want to audit.
The audit calls your agentâs endpoint and can send hundreds to thousands of requests. Check the endpointâs capacity and rate limits before launching.
Launch an audit
Section titled âLaunch an auditâUse target_agent_id to identify the agent you want to audit. It must belong to the selected project.
from giskard_hub import HubClient
hub = HubClient()
audit = hub.red_team_audits.create( project_id="project-id", target_agent_id="agent-id", name="Customer support agent audit", mode="light",)
print(audit.id, audit.status)The audit runs in the Hub. Save audit.id to check its progress and retrieve the results.
A Light audit (mode="light") tests a prioritized subset of the risk scenarios in a single attack wave and takes around one hour, while a Full audit (mode="regular") covers every scenario in the risk model across multiple attack waves and can take several hours.
Provide existing evaluations
Section titled âProvide existing evaluationsâPass input_evaluation_ids to give attacker agents leads to investigate further. You can use any evaluation from the same project, such as results from another scanner that you uploaded as a Hub evaluation, or an evaluation on an internal dataset of known failure cases:
audit = hub.red_team_audits.create( project_id="project-id", target_agent_id="agent-id", name="Audit informed by existing evaluations", mode="light", input_evaluation_ids=["evaluation-id-1", "evaluation-id-2"],)Monitor progress
Section titled âMonitor progressâRetrieve the audit to inspect its current status and optional progress details:
audit = hub.red_team_audits.retrieve("audit-id")print(audit.status)
if audit.progress is not None: print("Phase:", audit.progress.phase) print("Findings so far:", audit.progress.findings)Retrieve the audit again to refresh its progress while it runs.
Retrieve the output dataset and evaluation
Section titled âRetrieve the output dataset and evaluationâThe audit dataset (output_dataset_id) contains every interaction that the attacker agents had with your agent as reusable scenarios, while the evidence evaluation (output_evaluation_id) holds the results of the observed failures that support the auditâs findings:
if audit.output_dataset_id: dataset = hub.datasets.retrieve(audit.output_dataset_id) print("Audit dataset:", dataset.id, dataset.name)
if audit.output_evaluation_id: evaluation = hub.evaluations.retrieve(audit.output_evaluation_id) print("Evidence evaluation:", evaluation.id, evaluation.name)See Datasets and Checks to refine the scenarios and Evaluations to test your fixes.
List and delete audits
Section titled âList and delete auditsâList audits in a project:
for previous_audit in hub.red_team_audits.list(project_id="project-id"): print(previous_audit.id, previous_audit.name, previous_audit.status)To delete an audit you no longer need:
hub.red_team_audits.delete("audit-id")Deleting an audit that is still running cancels it first.
Next steps
Section titled âNext stepsâ- Review the report in the Hub UI.
- Run evaluations using your auditâs regression dataset.
- Run vulnerability scans for testing with selected categories or probes.