Python API
The CLI covers most use cases, but sometimes you need ai-blackteam inside your own scripts — automated pipelines, custom reporting, or integration with other tools. TheBlackteam class gives you the same capabilities as the CLI without subprocess calls.
Quick Start
The Blackteam Class
Constructor
The constructor loads your config (including API keys from environment variables) and initializes the engine.
run()
Run a single attack against a model.PromptResult objects, one per prompt variant the attack generates.
batch()
Run multiple attacks against a model.taxonomy()
Get the full attack taxonomy.Working with Results
Each result fromrun() contains: