SDK and API Reference

cognify-sdk v2 Python reference. All methods are available after import cognify following initialization.

cognify.init()

Initialize a Cognify tracking session. Must be called before any other SDK method.

ParameterTypeRequiredDescription
workspacestrrequiredYour Cognify workspace slug.
api_keystrrequiredAPI key from workspace settings.
run_namestroptionalHuman-readable name for this run. Auto-generated if omitted.
tagslist[str]optionalTags for filtering and grouping runs.
projectstroptionalProject name within workspace.

Returns: CognifyRun object.

cognify.dataset()

Register and version a dataset for the current run.

ParameterTypeRequiredDescription
namestrrequiredDataset identifier.
sourceDataset | str | PathrequiredHuggingFace Dataset, file path, or S3/GCS URI.
splitstroptionalDataset split name (e.g. "train", "eval").
versionstroptionalManual version override. Auto-increments if omitted.

Returns: DatasetVersion with fields version_id, sha256, record_count, timestamp.

cognify.run()

Log hyperparameters for the current run. Call once before training starts.

cognify.run(
    config={
        "learning_rate": 2e-5,
        "batch_size": 16,
        "epochs": 3,
        "model_base": "meta-llama/Llama-3-8B"
    }
)

cognify.checkpoint()

Manually log a checkpoint. In most cases, framework auto-hooks handle this automatically.

ParameterTypeRequiredDescription
stepintrequiredTraining step number.
pathstr | PathoptionalPath to checkpoint files (for metadata hash).
metricsdictoptionalMetrics dict, e.g. {"loss": 0.234}.

cognify.eval()

Log evaluation results for a checkpoint or the final model.

cognify.eval(
    benchmark="safety_classification",
    results={
        "accuracy": 0.942,
        "f1": 0.934,
        "policy_threshold_met": True
    },
    checkpoint_step=None  # None = final model
)

cognify.export_audit()

Export a compliance package for a completed run.

ParameterTypeRequiredDescription
run_name or run_idstrrequiredIdentify the run to export.
formatslist[str]optionalExport formats. Options: "pdf", "json", "xlsx". Default: ["pdf"].
templatestroptionalAudit template: "standard", "eu_ai_act", "custom".
output_dirstr | PathoptionalOutput directory. Defaults to ./cognify_exports.

REST API endpoints

Base URL: https://api.fyntuneq.com/v2. All endpoints require Authorization: Bearer <api_key>.

MethodEndpointDescription
GET/runsList runs in workspace.
GET/runs/{run_id}Get run details including lineage graph.
POST/runs/{run_id}/exportTrigger audit package export.
GET/datasets/{dataset_id}/versionsList all versions of a dataset.
GET/runs/{run_id}/lineageGet lineage graph as JSON.
POST/runs/{run_id}/approveSubmit compliance approval (compliance reviewer role required).
DELETE/runs/{run_id}Delete a run (soft delete only; audit records are immutable).