Skip to content

Examples

Start from the real SDK scripts and notebooks shipped in the repo instead of inventing workflows from scratch.

The fastest way to understand the SDK is often to run one of the shipped examples and then read the corresponding guide page alongside it.

All examples live under packages/sdk/examples/:

  • scripts: packages/sdk/examples/scripts
  • notebooks: packages/sdk/examples/notebooks

Run scripts from packages/sdk with uv run python ....

Terminal window
cd packages/sdk
uv run python examples/scripts/agent_with_tools.py
from pathlib import Path
SDK_EXAMPLES = Path("packages/sdk/examples")
print(SDK_EXAMPLES / "scripts" / "agent_with_tools.py")
print(SDK_EXAMPLES / "notebooks" / "agentic_red_teaming.ipynb")
FileWhat it demonstratesRead this first
agent_with_tools.pycore Agent loop, Python tools, trajectoriesAgents and Tools
basic_tracing.pyspans, trace grouping, and local observabilityTracing
evaluation_with_scorers.pyEvaluation, dataset rows, built-in and custom scorersEvaluations and Scorers
optimization_study.pyStudy, RandomSampler, and search-space tuningStudies & Samplers
submit_training_job.pypublishing artifacts, then submitting a hosted SFT jobPackages & Capabilities and Training
world_manifest_and_trajectories.pylow-level worlds control-plane calls from PythonAPI Client
airt_pair.pysingle-attack AIRT workflow with pair_attackAIRT
airt_crescendo.pymulti-turn red teaming with CrescendoAIRT
airt_trace.pytracing around attack executionAIRT and Tracing
multi_attack_assessment.pyone Assessment containing several attack familiesAIRT
FileWhat it demonstratesRead this first
agentic_red_teaming.ipynbend-to-end agentic red teaming workflowAIRT
openai_agentic_red_teaming.ipynbprovider-specific red teaming walkthroughAIRT
pair_attack.ipynbnotebook-friendly PAIR workflowAIRT
crescendo_with_transforms.ipynbCrescendo plus input transformsTransforms
tree_of_attacks_with_transforms.ipynbTAP-style attacks with transformsTransforms and AIRT
graph_of_attacks_with_transforms.ipynbgraph-style attack searchStudies & Samplers
multimodal_attacks_transforms.ipynbmultimodal attack surface plus transformsTransforms
ide_coding_assistant_attacks.ipynbIDE-agent attack patternsAIRT
compliance_tagging.ipynbtransform and attack tagging for reportingTransforms

If you are new to the SDK:

  1. agent_with_tools.py
  2. evaluation_with_scorers.py
  3. optimization_study.py
  4. one AIRT script such as airt_pair.py

If you already know the basics and care about platform-backed workflows:

  1. submit_training_job.py
  2. world_manifest_and_trajectories.py
  3. multi_attack_assessment.py

Most examples assume one or both of these:

  • provider credentials such as OPENAI_API_KEY
  • Dreadnode config via dn.configure() or DREADNODE_* environment variables

Examples that create hosted jobs also assume:

  • a reachable platform server
  • an API key with access to the target organization and workspace
  • published or publishable artifacts such as capabilities and datasets

Treat the examples as working starting points, not perfect architecture. The best workflow is:

  1. run the closest example
  2. confirm it works in your environment
  3. copy only the parts you actually need into your own codebase

That is usually faster and safer than starting from a blank file.