Skip to main content

Mankinds Mankinds SDK

PyPI version License: MIT Documentation Status

Official Python SDK for the public Mankinds AI evaluation lifecycle API.


What It Exposes

The SDK exposes the public /api/v1 lifecycle API:

  • Systems - create, list, get, update and archive AI systems.
  • Connections - create target connections, test them and set defaults.
  • Datasets - generate, import, get, update and validate datasets.
  • Test plans - generate and read system test plans.
  • Evaluations - run, list, get, cancel and explicitly wait for evaluations.
  • Jobs - poll asynchronous operations.
  • Agents and gates - trigger CI runs and enforce quality gates.
  • Evidence, findings and remediation - retrieve evidence packs, findings and remediation items.

It does not expose Mankinds administration routes, webapp internals, OAuth flows, Copilot, ontology internals, users, roles or organization settings.

Installation

pip install "mankinds-sdk>=2.0.0"

Quickstart

import os
from mankinds_sdk import MankindsClient

client = MankindsClient(api_key=os.environ["MANKINDS_API_KEY"])

system = client.systems.create({
    "name": "Support Assistant",
    "description": "Customer support assistant for billing and account questions.",
})

connection = client.connections.create(system["id"], {
    "connector_type": "custom_api",
    "url": "https://api.example.com/chat",
    "method": "POST",
    "body": {"message": "{{input}}"},
    "input_path": "message",
    "output_path": "reply",
})

dataset_job = client.datasets.generate(system["id"], {"scenario_count": 20})
client.jobs.wait(dataset_job["id"])
client.datasets.validate(system["id"])

run = client.evaluations.run({
    "system_id": system["id"],
    "profile": "required",
    "connection_id": connection["id"],
})

evaluation = client.evaluations.wait(run["evaluation_id"])
print(evaluation.get("summary"))

Client

client = MankindsClient(api_key, base_url=None, timeout=120)
Parameter Type Required Default Description
api_key str Yes - API key sent as X-API-Key.
base_url str No https://app.mankinds.io Custom API base URL.
timeout int No 120 Request timeout in seconds.

Use client.whoami() to inspect the authenticated organization, actor and scopes.

Endpoint Configuration

Create AI target connections with client.connections.create(system_id, config).

client.connections.create(system["id"], {
    "connector_type": "custom_api",
    "url": "https://api.example.com/chat",
    "method": "POST",
    "headers": {"Authorization": "Bearer ..."},
    "body": {"message": "{{input}}"},
    "input_path": "message",
    "output_path": "reply",
})

Common fields:

Field Type Description
connector_type str Target connector type, for example custom_api.
url str Target endpoint URL.
method str HTTP method. Defaults to POST server-side.
headers dict Headers sent to the target endpoint.
body dict Request body template.
input_path str Path where Mankinds injects the test input.
output_path str Path where Mankinds reads the AI response.
streaming dict SSE streaming configuration.
multiturn dict Multi-turn conversation configuration.
session dict Dynamic auth/session token configuration.

Datasets

job = client.datasets.generate(system["id"], {"scenario_count": 20})
dataset = client.jobs.wait(job["id"])

imported = client.datasets.import_(system["id"], [
    {
        "input": "Where is my order?",
        "expected_outputs": ["I can help you track your order."],
    },
])

client.datasets.validate(system["id"])

Evaluations

Evaluation start is asynchronous. Waiting is explicit.

run = client.evaluations.run({
    "system_id": system["id"],
    "connection_id": connection["id"],
    "profile": "required",
    "mode": "offline",
})

evaluation = client.evaluations.wait(
    run["evaluation_id"],
    timeout_ms=30 * 60 * 1000,
    interval_ms=5000,
)

CI Quality Gates

Use agents for CI checks. Configure a gate once, trigger a CI run, then wait for the gate result. If the gate fails, the SDK raises GateFailedError.

import os
from mankinds_sdk import GateFailedError

agents = client.agents.list({"system_id": system["id"]})
agent = agents[0]

client.gates.update(agent["id"], {
    "overall_score_min": 0.85,
    "max_failed_criteria": 0,
})

run = client.agents.run(agent["id"], {
    "trigger_source": "ci",
    "metadata": {
        "commit_sha": os.environ.get("GITHUB_SHA"),
        "pr_number": os.environ.get("PR_NUMBER"),
    },
})

try:
    client.agents.wait_for_gate(agent["id"], run["id"])
except GateFailedError as exc:
    print(exc.gate)
    raise

Namespaces

Namespace Methods
client.systems create, list, get, update, archive
client.connections create, list, test, set_default
client.datasets generate, import_, get, update, validate
client.test_plans generate, list, get
client.evaluations run, get, list, cancel, wait
client.jobs get, wait
client.agents list, get, run, get_run, wait_for_gate
client.gates get, update
client.evidence get_pack
client.findings list
client.remediation list

Errors

The SDK maps API failures to typed errors where possible:

  • CredentialsError
  • AuthenticationError
  • ScopeDeniedError
  • ValidationError
  • NotFoundError
  • RateLimitError
  • ServerError
  • JobFailedError
  • PollTimeoutError
  • GateFailedError

Scopes

API keys are scoped. The organization is derived from the key; do not send organization_id.

Common scopes:

  • systems:read, systems:write
  • connections:read, connections:write
  • datasets:read, datasets:write
  • test_plans:read, test_plans:write
  • evaluations:read, evaluations:run, evaluations:cancel
  • agents:read, agents:run
  • gates:read, gates:write
  • evidence:read
  • findings:read, remediation:read

Documentation

See the full SDK and REST API documentation at docs.mankinds.io.

License

MIT

Metadata

Release files for mankinds-sdk 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mankinds-sdk 2.0.1
File Size Uploaded Provenance Actions
mankinds_sdk-2.0.1.tar.gz 11.6 kB Without provenance Details for mankinds_sdk-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mankinds-sdk 2.0.1
File Interpreter ABI Platform Actions
mankinds_sdk-2.0.1-py3-none-any.whl Python 3 none any Details for mankinds_sdk-2.0.1-py3-none-any.whl

Total release size: 21.3 kB

Release files / mankinds_sdk-2.0.1.tar.gz

Download URL mankinds_sdk-2.0.1.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b067ca31d6b22dae66ee1bc670b0d45bd3663a4dfdc777b6a48ced9e7936766b
BLAKE2b-256 checksum
How to use checksums
3bd86848952395ce50f79b46082619cfecf541feac711ad1de7d63b8d55800db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / mankinds_sdk-2.0.1-py3-none-any.whl

Download URL mankinds_sdk-2.0.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
825856b48641ff08401b657d409ecd2d86e17931685b454e94c79faa2fec1c72
BLAKE2b-256 checksum
How to use checksums
8a82d6d278cd9a2412fa776121bdb0bb1d52841a4fce67de00625fcddbd4d42b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for mankinds-sdk 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page