Files
iFixAi/docs/python-api.md
T
n-papaioannou 9acc8209a6 Five-pillar grading, docs overhaul, verified fixture templates, traction cleanup (#66)
* Grade on the five core pillars only: the overall score uses a fixed GRADED_CATEGORY_WEIGHTS denominator, premium categories are reported without entering the grade, and P01 keeps its mandatory-minimum cap.

* Print n/a instead of crashing when every selected inspection is inconclusive and overall_score is None.

* Move the adoption charts into docs/traction.md, drop the unique-cloners chart and its apparatus, and archive all pypistats endpoints weekly before the rolling window drops them.

* Rewrite the docs in plain language and cut them to a third: three doc pairs merged into their natural homes, every inbound link rewired. Replace the open-source scorecards with before-remediation reconstructions of the Dragontail and Instagram incidents.

* Make the fixture guidance produce complete runs: an engine-verified template that clears every mandatory-minimum evidence floor in the doc, the plugin skill, and the scaffolded playbook, plus a per-inspection evidence-floors table and corrected field attributions.

* Trim .gitignore to generic patterns and ignore the plugin's working fixture file.

* Remove the website source links from both case-study scorecards.
2026-07-23 15:09:23 +00:00

1.8 KiB

Python API

ifixai.api runs the same engine as the CLI. Run functions are async; helpers are sync.

import asyncio
from ifixai.api import run_inspections

result = asyncio.run(run_inspections(
    provider="openai",
    api_key="sk-...",
    model="gpt-4o",
    fixture="default",
    system_name="my-agent",
))
print(result.overall_score, result.grade)

Functions

Function Purpose
run_inspections(...) Run all registered inspections (async) → TestRunResult
run_strategic(...) Run the top 8 strategic tests (async)
run_selected(test_ids, ...) Run a chosen list of test IDs (async)
run_single(test_id, ...) Run a single test by ID (async)
compare_scorecards(baseline, enhanced) Vendor-neutral comparison report (sync)
list_tests() Return all InspectionSpec definitions (sync)
list_fixtures() Return built-in fixture names (sync)

Common parameters

Parameter Default Notes
provider required Provider name ("openai", "anthropic", …) or a ChatProvider instance.
api_key "" SUT key.
fixture "default" Registered name or a Fixture object.
model, endpoint, system_prompt None SUT overrides.
system_name, system_version "", "1.0" Report labels.
timeout, max_retries 30, 3 Per-request controls.
judge_config, pipeline_config None JudgeConfig / EvaluationPipelineConfig for judges, ensemble, budgets.
sut_temperature, sut_seed, run_nonce, holdout_ids 0.0, None, None, None Determinism / replay controls (mirror CLI seeds).

To test a custom agent, implement ChatProvider (../ifixai/providers/base.py) and pass the instance as provider. Walkthrough: testing-your-agent.md.