Skip to main content

No project description provided

Project description

Agency Python SDK

Python client SDK for the GTS Agency platform. Provides typed HTTP clients for datasets, datasources, ontologies, prompts, and rules APIs.

Installation

pip install gts-agency-python-sdk

For development:

pip install -e ".[dev]"

Configuration

The examples in this repository use the following environment variables for authentication and configuration:

  • AGENCY_AUTH_URL: The OAuth2 token endpoint URL.
  • AGENCY_API_URL: The base URL for the Agency API.
  • AGENCY_ORG_ID: The organization ID to use for requests.
  • AGENCY_CLIENT_ID: Your OAuth2 client ID.
  • AGENCY_CLIENT_SECRET: Your OAuth2 client secret.

Usage

from agency_sdk.client import AgencyClient, CredentialsSupplier

credentials = CredentialsSupplier(
    auth_base_url="https://auth.example.com",
    client_id="your-client-id",
    client_secret="your-client-secret",
)
client = AgencyClient(token_supplier=credentials, base_url="https://api.example.com")

Delegate Clients

Access each API domain through the facade:

  • client.dataset() — datasets CRUD, filesystem traversal, clone
  • client.datasource() — datasource and table introspection
  • client.ontology() — ontology export (JSON, Turtle, ISON) and entity-datasource mappings
  • client.prompts() — prompt CRUD via command pattern
  • client.rules() — rule listing, detail, execution, and execution history

Rules Example

from agency_sdk.delegates.rules_dto import ExecuteRequest

rules = client.rules()

# List rules
result = rules.list(organisation_id=2)
for rule in result.items:
    print(f"{rule.name} (status={rule.active_version_status})")

# Get rule detail
detail = rules.get(rule_id="rule-id", organisation_id=2)

# Execute a rule
response = rules.execute(
    rule_id="rule-id",
    request=ExecuteRequest(organisation=2, context={"key": "value"}, trace=True),
)
print(f"Result: {response.result}")

# List execution history
executions = rules.list_executions(rule_id="rule-id", organisation_id=2)

Examples

export AGENCY_AUTH_URL="http://localhost:8080/realms/agency/protocol/openid-connect/token"
export AGENCY_API_URL="http://localhost:13001"
export AGENCY_ORG_ID="2"
export AGENCY_CLIENT_ID="your-client-id"
export AGENCY_CLIENT_SECRET="your-client-secret"

python examples/quick_clone_dataset.py
python examples/quick_create_prompt.py
python examples/quick_export_ontology.py
python examples/quick_execute_rule.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gts_agency_python_sdk-0.0.1rc7.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gts_agency_python_sdk-0.0.1rc7-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file gts_agency_python_sdk-0.0.1rc7.tar.gz.

File metadata

  • Download URL: gts_agency_python_sdk-0.0.1rc7.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gts_agency_python_sdk-0.0.1rc7.tar.gz
Algorithm Hash digest
SHA256 e405b614770c4fc27cc50565e43c40b29007a23c02ccf90f30cd87ccd25e04b7
MD5 5adbe68bc0b9156ed3c712d59f3f83c2
BLAKE2b-256 3fa2a55a0b477e3f180e22b000601138623a11155fdf8f2a0caedb0a9dc9f957

See more details on using hashes here.

Provenance

The following attestation bundles were made for gts_agency_python_sdk-0.0.1rc7.tar.gz:

Publisher: publish.yaml on groundtruthsystems/gts-agency_python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gts_agency_python_sdk-0.0.1rc7-py3-none-any.whl.

File metadata

File hashes

Hashes for gts_agency_python_sdk-0.0.1rc7-py3-none-any.whl
Algorithm Hash digest
SHA256 1cfc1e1696bf758fa383ebddc20920c2eb25b0ba91337c622445d86f278f509c
MD5 16869b49753a9dfafefc10da727b2f28
BLAKE2b-256 bd61347adc142e8f045134ec20cb555ece33f96e92472e113d79d4ca79848b3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for gts_agency_python_sdk-0.0.1rc7-py3-none-any.whl:

Publisher: publish.yaml on groundtruthsystems/gts-agency_python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page