parmana-connector-sdk
Contracts and reference implementations for building a Connector for Parmana, the authorization layer for AI execution.
A Connector is the last hop in Parmana's pipeline: it receives an already-authorized, already-verified request and carries it out against a real system (an API, a database, anything). A Connector never evaluates policy, never authorizes execution, and never resolves its own credentials — it only executes, using a credential Parmana has already resolved for it.
This is the Python counterpart to the TypeScript @parmana/connector-sdk package — same contract, same design, idiomatic Python (synchronous, dataclasses and Protocol instead of interfaces).
Install
pip install parmana-connector-sdk
The contract
Every Connector implements one protocol:
from parmana_connector_sdk import (
Connector,
ConnectorRequest,
ConnectorExecutionContext,
ConnectorResponse,
connector_capabilities,
)
class MyConnector:
connector_id = "my-service"
capabilities = connector_capabilities(["my-service:do-thing"])
def execute(
self, request: ConnectorRequest, context: ConnectorExecutionContext
) -> ConnectorResponse:
# request.parameters is exactly what was authorized -- never re-derive it.
# context.credential is an opaque, already-resolved CredentialHandle.
# context.timeout_ms is how long you have.
return ConnectorResponse(success=True, metadata={})
Connector is a typing.Protocol — MyConnector doesn't need to subclass anything, it just
needs to match the shape (connector_id, capabilities, execute).
capabilities must be namespaced verbs ("namespace:verb", e.g. "crm:update-contact"),
validated eagerly by connector_capabilities() so a malformed capability fails at
construction, not mid-execution.
One reference implementation, for testing
MockConnector gives you scripted responses or failure injection, and records every request
it receives, so you can test your own Connector's callers without standing up a real endpoint:
from parmana_connector_sdk import MockConnector, MockConnectorOptions, MockConnectorScript, connector_capabilities
connector = MockConnector(
MockConnectorOptions(
connector_id="billing",
capabilities=connector_capabilities(["billing:issue-refund"]),
script=MockConnectorScript(
respond=lambda request, context: ConnectorResponse(
success=True, metadata={"refund_id": "r_1"}
)
),
)
)
connector.execute(request, context)
connector.invocations # every request it received, for assertions
This package intentionally ships no HTTP-calling reference implementation — only the contract and the hermetic mock above. A REST-shaped connector is usually this simple to write directly against the contract:
import urllib.request
import json
from parmana_connector_sdk import (
ConnectorRequest,
ConnectorExecutionContext,
ConnectorResponse,
connector_capabilities,
)
class BillingConnector:
connector_id = "billing"
capabilities = connector_capabilities(["billing:issue-refund"])
def __init__(self, base_url: str) -> None:
self.base_url = base_url
def execute(
self, request: ConnectorRequest, context: ConnectorExecutionContext
) -> ConnectorResponse:
token = context.credential.value # shape is whatever your CredentialProvider resolved
body = json.dumps(request.parameters).encode()
req = urllib.request.Request(
f"{self.base_url}/{request.action}",
data=body,
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(req, timeout=context.timeout_ms / 1000) as response:
if response.status >= 300:
raise RuntimeError(f"HTTP {response.status}")
return ConnectorResponse(success=True, metadata=json.load(response))
Four worked examples
parmana_connector_sdk.connectors.{oracle,salesforce,sap,workday} are deterministic
MockConnectors shaped like a real enterprise integration — each declares one realistic
capability and nothing else. They are explicit mocks, not real integrations; read them as a
template for structuring your own connector's capability and metadata, not as something to
call in production.
Credentials
A Connector never resolves its own credentials. CredentialProvider is the seam Parmana's
Execution Gateway uses upstream of a Connector — EnvironmentCredentialProvider (reads a
mapped env var) and StaticCredentialProvider (in-memory, for tests) are the two provided
implementations.
Full reference
See the Connector SDK reference and the Connector Development Guide — written against the TypeScript package, but the contract this package implements is identical.
Running the tests
The tests import the package directly from this folder, so put it on the import path first. Run these from the repository root.
Windows (PowerShell):
$env:PYTHONPATH = "python-connector-sdk"
python -m pytest python-connector-sdk/tests
macOS or Linux:
PYTHONPATH=python-connector-sdk python -m pytest python-connector-sdk/tests
Install pytest first if needed: pip install pytest. Without PYTHONPATH, collection fails with ModuleNotFoundError: No module named 'parmana_connector_sdk'.
Metadata
Release files for parmana-connector-sdk 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| parmana_connector_sdk-0.2.1.tar.gz | 18.6 kB | Without provenance | Details for parmana_connector_sdk-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| parmana_connector_sdk-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for parmana_connector_sdk-0.2.1-py3-none-any.whl |
Total release size: 36.4 kB
Release files / parmana_connector_sdk-0.2.1.tar.gz
| Download URL | parmana_connector_sdk-0.2.1.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
458dc4b58bd458b8df349ce3bda4aca21a177c35cbbce8108661cc8c557cb31d
|
|
BLAKE2b-256 checksum How to use checksums |
b6601c5f17e1627533020123ed37ca8542a4accd37c3b2e905c2c91269d76abb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / parmana_connector_sdk-0.2.1-py3-none-any.whl
| Download URL | parmana_connector_sdk-0.2.1-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6f5dfbc02290bd0a8f9adb0bf5525b25a1d8fecc9aae04aa04bfa29fcba3b50
|
|
BLAKE2b-256 checksum How to use checksums |
1d6d93f932535901ae7d1702a4501409d7d585be4307870d264bf20b9a914e58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for parmana-connector-sdk 0.2.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.