Docs/Getting Started/Init Wizard

agentdiff init — Zero-Config Setup Wizard

agentdiff init is the fastest way to add AgentDiff to an existing AI agent codebase. It inspects your project, auto-detects which agent framework or telemetry format you use, and generates a tailored agentdiff.toml policy file alongside a production-ready GitHub Actions regression gate workflow.


1. Quick Usage

Run in your project root:

bash
agentdiff init

The wizard scans your environment, identifies installed packages, and outputs:

text
Detected framework: LangGraph (StateGraph checkpoint parser) Wrote agentdiff.toml Wrote .github/workflows/agentdiff.yml Next steps: 1. Record a baseline envelope: agentdiff record <your_agent:run> --runs 3 --out baselines/default.envelope.json 2. Commit agentdiff.toml, the workflow(s), and the baseline. 3. Open a PR — AgentDiff gates it automatically. 4. Reviewers bless accepted drift with: /agentdiff approve

2. Auto-Detection Matrix

agentdiff init automatically detects the following frameworks by checking installed packages in your virtual environment:

Framework / AdapterPackage CheckedGenerated Config AdapterGenerated Workflow Step
LangGraphlanggraphadapter.name = "langgraph"Ingests native LangGraph StateGraph snapshots
CrewAIcrewaiadapter.name = "crewai"Ingests multi-agent task hierarchy & CrewOutput dumps
OpenAI Agents SDKagentsadapter.name = "openai_agents"Ingests official OpenAI Agents SDK run trees
OpenTelemetry / OpenInferenceopentelemetry-apiadapter.name = "openinference"Standard GenAI span ingestion
Generic Python(fallback)adapter.name = "auto"Ingests canonical AgentTrace JSON

Overriding Detection with --adapter

If you are using multiple frameworks or want to specify an adapter explicitly, pass --adapter:

bash
agentdiff init --adapter crewai

3. CLI Flags & Options

bash
agentdiff init [OPTIONS]
FlagDefaultDescription
--scenario <name>defaultScenario name written into agentdiff.toml and workflow files.
--runs <int>3Number of sample runs configured for statistical baseline envelopes.
--adapter <name>(auto-detected)Override framework detection (langgraph, crewai, openai_agents, openinference, generic).
--with-approvefalseAlso generate .github/workflows/agentdiff-approve.yml for in-PR /agentdiff approve re-baselining.
--forcefalseOverwrite existing agentdiff.toml or workflow files if they already exist.

4. Generated Artifacts

1. agentdiff.toml (v0.5 Spec)

toml
[scenario.customer_support] mode = "statistical" sample_runs = 3 max_cost_increase_pct = 5.0 [scenario.customer_support.hard_invariants] fail_on_identical_loops = true max_tool_repeats = 3 [scenario.customer_support.tolerances] step_count_std_dev = 2.0 divergence_ceiling = 0.35

2. .github/workflows/agentdiff.yml

yaml
name: AgentDiff Gate on: pull_request: permissions: contents: read pull-requests: write jobs: gate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 with: python-version: "3.11" - name: Install dependencies run: | pip install agent-trajectory-diff - name: Record Candidate Run run: | agentdiff record my_agent:run \ --input '{"query": "sample query"}' \ --out traces/candidate.json - name: Run AgentDiff Gate uses: kerrshift/agentdiff/.github/actions/agentdiff-[email protected] with: baseline: baselines/customer_support.envelope.json candidate: traces/candidate.json pr: ${{ github.event.number }} github-token: ${{ secrets.GITHUB_TOKEN }}

3. .github/workflows/agentdiff-approve.yml (when --with-approve is used)

Writes the command listener workflow that reacts to /agentdiff approve comments by repository maintainers, authenticating with the hosted token.agentdiff.app identity service and flipping the Checks API result.


Next Steps