GebSecure Docs v0.1.0

Reference · SDKs

Python SDK

gebsecure — sync and asyncio clients, configuration, authentication, every method, errors, retries and tracing.

bash
pip install gebsecure          # Python ≥ 3.9; httpx, pydantic v2, cryptography

The package provides GebSecure (synchronous, thread-safe) and AsyncGebSecure (asyncio) with the same methods, pydantic v2 models generated from the API contract (py.typed, mypy --strict clean) and typed exceptions.

Configuration#

GebSecure(*, …) and AsyncGebSecure(*, …) take keyword arguments:

Argument Default Notes
api_key / auth GEBSECURE_API_KEY or GEBSECURE_CLIENT_SECRET exactly one
gateway_url GEBSECURE_GATEWAY_URL or https://gateway.gebsecure.com data plane
api_url GEBSECURE_API_URL or https://api.gebsecure.com control plane and token endpoint
token_url {api_url}/v1/auth/token
max_retries 3 0 disables retries (and automatic idempotency keys)
timeout 30.0 per attempt, seconds
base_delay / max_delay 0.5 / 8.0 backoff, seconds
max_retry_after 60.0 a longer Retry-After raises RateLimitError immediately
default_headers added to every request
http_client / transport a custom httpx client (proxies, mTLS) or transport
clock time source for tests

client.with_options(max_retries=0, timeout=5) returns a copy sharing the connection pool and auth. Every method accepts a request model, a mapping (wire or Python names) and/or keyword fields, plus traceparent= and idempotency_key=.

Authentication#

Provider Use
ApiKeyAuth("gsk_…") (or api_key=) API keys
ClientSecretAuth("gsa_…", scope=…) client-secret credentials
PrivateKeyJwtAuth("cred_…", key) private_key_jwt; PKCS#8 PEM, a private JWK or a cryptography key (Ed25519, P-256, RSA)
DelegationAuth("gsd_…", actor=…, scope=…) / client.with_delegation("gsd_…") RFC 8693 delegation
StaticTokenAuth(token) a token obtained elsewhere (e.g. from login)
Unauthenticated() only login / refresh_session; other calls raise ConfigurationError before sending

Tokens are cached and refreshed min(60 s, expires_in / 2) before expiry; a 401 drops the cached token and replays the request once. client.get_access_token() returns the current token for APIs the SDK does not wrap.

sdks/python/examples/private_key_jwt.py
"""Authenticate an agent with private_key_jwt: the private key never leaves the agent.

1. Generate a key pair and register the PUBLIC key as an agent credential
   (POST /v1/agents/{id}/credentials with {"type": "public_key", "publicJwk": ...}), which returns `cred_...`.
2. Run:  GEBSECURE_CREDENTIAL_ID=cred_... GEBSECURE_PRIVATE_KEY_FILE=agent-key.pem python examples/private_key_jwt.py
"""

from __future__ import annotations

import base64
import os
import sys

from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import ed25519

from gebsecure import GebSecure, PrivateKeyJwtAuth


def generate_key(path: str) -> None:
    key = ed25519.Ed25519PrivateKey.generate()
    pem = key.private_bytes(serialization.Encoding.PEM, serialization.PrivateFormat.PKCS8, serialization.NoEncryption())
    with open(path, "wb") as f:
        f.write(pem)
    pub = key.public_key().public_bytes(serialization.Encoding.Raw, serialization.PublicFormat.Raw)
    x = base64.urlsafe_b64encode(pub).rstrip(b"=").decode()
    print("register this public JWK:", {"kty": "OKP", "crv": "Ed25519", "x": x, "alg": "EdDSA"})


def main() -> None:
    key_file = os.environ.get("GEBSECURE_PRIVATE_KEY_FILE", "agent-key.pem")
    if not os.path.exists(key_file):
        generate_key(key_file)
        sys.exit("key generated; register the public key, then set GEBSECURE_CREDENTIAL_ID and re-run")

    with open(key_file, encoding="utf-8") as f:
        auth = PrivateKeyJwtAuth(
            os.environ["GEBSECURE_CREDENTIAL_ID"],
            f.read(),  # PKCS#8 PEM; a private JWK dict works too
            scope="authorize execute",
            # audience="https://api.gebsecure.com/v1/auth/token",  # only if it differs from the token URL
        )

    with GebSecure(auth=auth) as client:
        # The SDK signs a fresh 60 s assertion, exchanges it for an access token, caches it and refreshes it early.
        print(client.authorize(action="files:read", resource="s3://reports/q3.pdf").decision)


if __name__ == "__main__":
    main()

Usage#

sdks/python/examples/authorize_then_act.py
"""Authorize-then-act: ask GebSecure before performing a sensitive action yourself.

GEBSECURE_API_KEY=gsk_... python examples/authorize_then_act.py
"""

from __future__ import annotations

from gebsecure import GebSecure, PolicyDeniedError


def refund(charge_id: str, amount: int) -> str:
    return f"refunded {amount} on {charge_id}"  # your real side effect goes here


def main() -> None:
    with GebSecure() as client:  # credentials from GEBSECURE_API_KEY / GEBSECURE_CLIENT_SECRET
        # Quick boolean check.
        verdict = client.guard("refunds:create", "stripe:charge/ch_123", {"amount": 250, "currency": "USD"})
        if verdict.allowed:
            print(refund("ch_123", 250))
        else:
            print(f"not allowed: {verdict.decision.decision} - {verdict.decision.reason}")

        # Full decision with risk and explanation.
        decision = client.authorize(
            action="refunds:create",
            resource="stripe:charge/ch_999",
            context={"amount": 9000, "currency": "USD"},
        )
        print("decision:", decision.decision, "risk:", decision.risk.score, decision.risk.level)
        if decision.decision == "APPROVAL_REQUIRED" and decision.approval:
            print("approval requested:", decision.approval.url)
            approval = client.wait_for_approval(decision.approval.id, timeout=900, poll_interval=5)
            if approval.status == "approved":
                # Re-authorize with the approval id: the approval is consumed only for the identical action.
                again = client.authorize(
                    action="refunds:create",
                    resource="stripe:charge/ch_999",
                    context={"amount": 9000, "currency": "USD"},
                    approval_id=approval.id,
                )
                if again.decision == "ALLOW":
                    print(refund("ch_999", 9000))
        elif decision.decision == "DENY":
            raise PolicyDeniedError(decision.reason, status=403, code="policy_denied")


if __name__ == "__main__":
    main()
sdks/python/examples/inspect_and_trace.py
"""Inspect untrusted content, report the agent's own span and act inside the same trace.

GEBSECURE_CLIENT_SECRET=gsa_... GEBSECURE_ENVIRONMENT_ID=env_... python examples/inspect_and_trace.py <url>

The agent fetches a web page, lets GebSecure score it for prompt injection (and inbound DLP), "plans" with the
sanitized text, reports that planning step as a span, and authorizes its next action as a child of that span.
An operator then sees one trace with the agent span joined to the platform's authorization spans.
"""

from __future__ import annotations

import os
import secrets
import sys
import time
import urllib.request
from typing import Any, Dict

from gebsecure import GebSecure, build_span, traceparent_of


def fetch(url: str) -> str:
    with urllib.request.urlopen(url, timeout=10) as resp:
        data: bytes = resp.read(200_000)
        return data.decode("utf-8", errors="replace")


def plan(text: str) -> str:
    return f"summarize {len(text)} characters"  # your LLM call goes here


def main() -> None:
    url = sys.argv[1] if len(sys.argv) > 1 else "https://example.com"
    traceparent = f"00-{secrets.token_hex(16)}-{secrets.token_hex(8)}-01"
    env = os.environ.get("GEBSECURE_ENVIRONMENT_ID")
    extra: Dict[str, Any] = {"environment_id": env} if env else {}
    with GebSecure() as client:  # credentials from GEBSECURE_CLIENT_SECRET / GEBSECURE_API_KEY
        inspected = client.inspect(content=fetch(url), source="web", origin=url, traceparent=traceparent)
        print("injection:", inspected.injection.level, inspected.injection.score, "->", inspected.action)
        if inspected.action == "BLOCK" or not isinstance(inspected.content, str):
            print("content blocked; not handing it to the model")
            return

        started = time.time() * 1000
        step = plan(inspected.content)
        span = build_span(
            "llm.plan",
            started,
            time.time() * 1000,
            traceparent=traceparent,
            attributes={"step": step, "injection.level": str(inspected.injection.level)},
            status="ok",
        )
        print("spans:", client.report_spans([span]))

        decision = client.authorize(
            action="web:summaries.publish",
            resource=f"web:page/{url}",
            dry_run=True,
            traceparent=traceparent_of(span),
            **extra,
        )
        print("decision:", decision.decision, "- trace", span.trace_id)


if __name__ == "__main__":
    main()

See the Python quickstart and the Python example application for execution, approvals and provisioning.

Errors#

All errors derive from GebSecureError and expose status, code, detail, request_id, trace_id and details. Extracted from sdks/python/src/gebsecure/errors.py:

Error Description
GebSecureError Base class of every SDK error.
APIError An error response from the GebSecure API (RFC 9457 problem+json). Also used for unknown codes.
AuthenticationError 401 unauthenticated: missing, invalid, expired or revoked credentials.
PermissionDeniedError 403 forbidden: the principal lacks a permission or scope.
PolicyDeniedError 403 policy_denied: a policy denied the action.
ApprovalRequiredError 403 approval_required: the action requires human approval.
ValidationError 400 bad_request / 422 validation_failed. details usually contains issues.
RateLimitError 429 rate_limited / quota_exceeded. retry_after is in seconds when the server sent it.
NotFoundError 404 not_found.
ConflictError 409 conflict / 412 precondition_failed.
UpstreamError 502 upstream_error.
GatewayTimeoutError 504 timeout or a client-side timeout (status 0).
UnavailableError 503 unavailable.
InternalError 500 internal or an unknown 5xx.
APIConnectionError The request could not be delivered (DNS, connection refused/reset, TLS). Status 0.
ApprovalTimeoutError wait_for_approval gave up before the approval was resolved.
ApprovalNotGrantedError execute_with_approval: the approval ended in a state other than approved.
SimulationFailedError run_simulation(fail_on_mismatch=True): the run failed or errored and the server answered 422 with the full run, available as :attr:run (a typed SimulationRun).
ConfigurationError Invalid or missing SDK configuration, e.g. an authenticated call on an Unauthenticated client. Raised before any request is sent.

Invalid request input raises ValueError naming the fields without echoing values (request bodies can carry secrets).

Retries#

429 responses are always retried, honouring Retry-After. Network errors, timeouts and 502/503/504 are retried only for idempotent requests: GETs, PUTs and DELETEs (except update_policy), token requests, dry_run authorizations and DLP scans, span reports, persist=False simulations, evaluation-only calls, cancellations, executions with an idempotency key, and any call made with idempotency_key=. When retries are enabled, execute generates an idempotencyKey (sdk-<uuid>) and reuses it for every attempt. Backoff is 0.5 s × 2ⁿ capped at 8 s with equal jitter. In AsyncGebSecure, cancelling the task aborts the in-flight request, a backoff sleep or an approval poll.

Tracing#

Every call sends a W3C traceparent; pass traceparent= to continue your trace. build_span(name, start, end, traceparent=…) (start/end in epoch milliseconds or datetime) builds an agent span, traceparent_of(span) makes later calls its children, and client.report_spans([...]) sends them.

Methods#

80 public methods of GebSecure / AsyncGebSecure, extracted from the SDK source at build time.

Client#

with_options#

python
with_options(**overrides: Any) -> GebSecure

A copy with different options (max_retries, timeout...) sharing the HTTP client and auth.

Source: sdks/python/src/gebsecure/_sync.py:221

with_delegation#

python
with_delegation(subject_token: str, *, scope: Optional[str] = None) -> GebSecure

A client with the same configuration acting under a delegation token (gsd_..., RFC 8693 token exchange). This client's credentials are the actor (the delegate agent's own identity).

Source: sdks/python/src/gebsecure/_sync.py:230

get_access_token#

python
get_access_token() -> str

A valid access token (cached/refreshed), e.g. to call GebSecure APIs the SDK does not wrap.

Source: sdks/python/src/gebsecure/_sync.py:240

close#

python
close() -> None

No description in the source.

Source: sdks/python/src/gebsecure/_sync.py:247

Decisions#

authorize#

python
authorize(request: RequestLike[AuthorizeRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> AuthorizeResult

POST /v1/authorize. DENY / APPROVAL_REQUIRED are returned, not raised. — POST {gateway}/v1/authorize

Source: sdks/python/src/gebsecure/_sync.py:318

authorize_batch#

python
authorize_batch(request: RequestLike[AuthorizeBatchRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> AuthorizeBatchResult

POST /v1/authorize/batch (1-100 requests; results in order, per-entry error). — POST {gateway}/v1/authorize/batch

Source: sdks/python/src/gebsecure/_sync.py:341

guard#

python
guard(action: str, resource: str, context: Optional[Mapping[str, Any]] = None, *, traceparent: Optional[str] = None, **fields: Any) -> GuardResult

Authorizes and returns GuardResult(allowed=decision == ALLOW, decision=...); never raises on DENY.

Source: sdks/python/src/gebsecure/_sync.py:362

Execution#

execute#

python
execute(request: RequestLike[ExecuteRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> ExecuteResult

POST /v1/execute. Returns the ExecuteResult for succeeded / awaiting_approval / running / denied / failed; raises only for problem+json errors. An idempotency key is generated when retries are enabled. — POST {gateway}/v1/execute

Source: sdks/python/src/gebsecure/_sync.py:376

get_execution#

python
get_execution(execution_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> Execution

GET /v1/executions/{id} with step logs. — GET {gateway}/v1/executions/{id}

Source: sdks/python/src/gebsecure/_sync.py:400

cancel_execution#

python
cancel_execution(execution_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> CancelExecutionResult

POST /v1/executions/{id}/cancel. — POST {gateway}/v1/executions/{id}/cancel

Source: sdks/python/src/gebsecure/_sync.py:415

Approvals#

get_approval#

python
get_approval(approval_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> Approval

GET {gateway}/v1/approvals/{id} (agent-facing status). — GET {gateway}/v1/approvals/{id}

Source: sdks/python/src/gebsecure/_sync.py:428

wait_for_approval#

python
wait_for_approval(approval_id: str, *, timeout: float = 600.0, poll_interval: float = 2.0, traceparent: Optional[str] = None) -> Approval

Polls until the approval leaves pending; returns it (approved, rejected, expired, ...). Every poll carries traceparent's trace id when given.

Source: sdks/python/src/gebsecure/_sync.py:443

execute_with_approval#

python
execute_with_approval(request: RequestLike[ExecuteRequest] = None, *, timeout: float = 600.0, poll_interval: float = 2.0, traceparent: Optional[str] = None, **fields: Any) -> ExecuteResult

Executes; if approval is required, waits for it and then follows the execution until it is terminal.

Source: sdks/python/src/gebsecure/_sync.py:466

Control plane#

list_agents#

python
list_agents(params: RequestLike[ListAgentsParams] = None, **fields: Any) -> AgentPage

GET /v1/agents. — GET {api}/v1/agents

Source: sdks/python/src/gebsecure/_sync.py:514

get_agent#

python
get_agent(agent_id: str) -> Agent

GET /v1/agents/{id}. — GET {api}/v1/agents/{id}

Source: sdks/python/src/gebsecure/_sync.py:519

list_policies#

python
list_policies(params: RequestLike[ListPoliciesParams] = None, **fields: Any) -> PolicyList

GET /v1/policies. — GET {api}/v1/policies

Source: sdks/python/src/gebsecure/_sync.py:523

list_approvals#

python
list_approvals(params: RequestLike[ListApprovalsParams] = None, **fields: Any) -> ApprovalPage

GET /v1/approvals (inbox=True for approvals you can act on). — GET {api}/v1/approvals

Source: sdks/python/src/gebsecure/_sync.py:528

create_delegation#

python
create_delegation(request: RequestLike[CreateDelegationRequest] = None, **fields: Any) -> Delegation

POST /v1/delegations. The returned token (gsd_...) is shown once. — POST {api}/v1/delegations

Source: sdks/python/src/gebsecure/_sync.py:533

Runtime: inspection, DLP, agent spans, simulation#

inspect#

python
inspect(request: RequestLike[InspectRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> InspectResult

POST {gateway}/v1/inspect: prompt-injection score/level/action, sanitized content and inbound DLP for untrusted content (web page, email, RAG chunk, tool output). Hand result.content (None when blocked) to the model instead of the original. Not retried on 5xx/network errors (records detections). — POST {gateway}/v1/inspect

Source: sdks/python/src/gebsecure/_sync.py:539

dlp_scan#

python
dlp_scan(request: RequestLike[DlpScanRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> DlpScanResult

POST {gateway}/v1/dlp/scan. Retried like a read only when dry_run=True. — POST {gateway}/v1/dlp/scan

Source: sdks/python/src/gebsecure/_sync.py:552

report_spans#

python
report_spans(spans: Union[Sequence[Union[AgentSpan, Mapping[str, Any]]], ReportSpansRequest], *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> ReportSpansResult

POST {gateway}/v1/traces/spans: reports agent-side spans (see :func:build_span) into the shared trace. Safe to retry: the server ignores a repeated (traceId, spanId). — POST {gateway}/v1/traces/spans

Source: sdks/python/src/gebsecure/_sync.py:563

run_simulation#

python
run_simulation(request: RequestLike[SimulationRunRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> SimulationRun

POST {api}/v1/simulations/run (nothing is executed). — POST {api}/v1/simulations/run

Source: sdks/python/src/gebsecure/_sync.py:574

Session auth (users)#

login#

python
login(request: RequestLike[LoginRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> LoginResult

POST {api}/v1/auth/login without credentials (works on an :class:Unauthenticated client); the refresh token is returned in the body (refreshTokenDelivery=body). — POST {api}/v1/auth/login

Source: sdks/python/src/gebsecure/_sync.py:589

refresh_session#

python
refresh_session(refresh_token: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> SessionTokens

POST {api}/v1/auth/refresh. The refresh token rotates: persist the returned one. Never retried (except 429), even with an idempotency key. — POST {api}/v1/auth/refresh

Source: sdks/python/src/gebsecure/_sync.py:601

logout#

python
logout(*, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> None

POST {api}/v1/auth/logout: revokes the current user session. — POST {api}/v1/auth/logout

Source: sdks/python/src/gebsecure/_sync.py:612

me#

python
me(*, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> Me

GET {api}/v1/auth/me: the principal, its organizations and effective permissions. — GET {api}/v1/auth/me

Source: sdks/python/src/gebsecure/_sync.py:621

Policies#

get_policy#

python
get_policy(policy_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> PolicyDetail

GET /v1/policies/{id} with versions, latest version and tests. — GET {api}/v1/policies/{id}

Source: sdks/python/src/gebsecure/_sync.py:631

create_policy#

python
create_policy(request: RequestLike[CreatePolicyRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> PolicyVersionResult

POST /v1/policies (draft version 1 from GSL source or a template). — POST {api}/v1/policies

Source: sdks/python/src/gebsecure/_sync.py:641

update_policy#

python
update_policy(policy_id: str, request: RequestLike[UpdatePolicyRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> PolicyVersionResult

PUT /v1/policies/{id}: saves a new version. — PUT {api}/v1/policies/{id}

Source: sdks/python/src/gebsecure/_sync.py:652

delete_policy#

python
delete_policy(policy_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> None

DELETE /v1/policies/{id}: archives the policy. — DELETE {api}/v1/policies/{id}

Source: sdks/python/src/gebsecure/_sync.py:667

validate_policy#

python
validate_policy(source: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> PolicyValidation

POST /v1/policies/validate: validates, lints and formats GSL source. — POST {api}/v1/policies/validate

Source: sdks/python/src/gebsecure/_sync.py:677

get_policy_version#

python
get_policy_version(policy_id: str, version_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> PolicyVersion

GET /v1/policies/{id}/versions/{versionId}. — GET {api}/v1/policies/{id}/versions/{versionId}

Source: sdks/python/src/gebsecure/_sync.py:687

diff_policy_versions#

python
diff_policy_versions(policy_id: str, from_version: str, to_version: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> PolicyDiff

GET /v1/policies/{id}/diff?from=&to=: semantic and unified diff. — GET {api}/v1/policies/{id}/diff

Source: sdks/python/src/gebsecure/_sync.py:698

list_policy_deployments#

python
list_policy_deployments(policy_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> PolicyDeploymentList

GET /v1/policies/{id}/deployments. — GET {api}/v1/policies/{id}/deployments

Source: sdks/python/src/gebsecure/_sync.py:712

deploy_policy#

python
deploy_policy(policy_id: str, request: RequestLike[DeployPolicyRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> PolicyDeployResult

POST /v1/policies/{id}/deploy (default: latest version). A blocked deploy (failing tests or conflicts, HTTP 412 with the deploy report) is returned with deployed=False, not raised. — POST {api}/v1/policies/{id}/deploy

Source: sdks/python/src/gebsecure/_sync.py:722

rollback_policy#

python
rollback_policy(policy_id: str, request: RequestLike[RollbackPolicyRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> PolicyRollbackResult

POST /v1/policies/{id}/rollback (default: the previously deployed version). — POST {api}/v1/policies/{id}/rollback

Source: sdks/python/src/gebsecure/_sync.py:735

add_policy_test#

python
add_policy_test(policy_id: str, request: RequestLike[PolicyTestCase] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> PolicyTest

POST /v1/policies/{id}/tests. — POST {api}/v1/policies/{id}/tests

Source: sdks/python/src/gebsecure/_sync.py:747

replace_policy_tests#

python
replace_policy_tests(policy_id: str, tests: Sequence[Union[PolicyTestCase, Mapping[str, Any]]], *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> PolicyTestList

PUT /v1/policies/{id}/tests: replaces the whole test suite atomically. — PUT {api}/v1/policies/{id}/tests

Source: sdks/python/src/gebsecure/_sync.py:759

delete_policy_test#

python
delete_policy_test(policy_id: str, test_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> None

DELETE /v1/policies/{id}/tests/{testId}. — DELETE {api}/v1/policies/{id}/tests/{testId}

Source: sdks/python/src/gebsecure/_sync.py:770

run_policy_tests#

python
run_policy_tests(policy_id: str, version_id: Optional[str] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> PolicyTestRun

POST /v1/policies/{id}/tests/run against a version (default: latest). — POST {api}/v1/policies/{id}/tests/run

Source: sdks/python/src/gebsecure/_sync.py:781

simulate_policies#

python
simulate_policies(request: RequestLike[PolicySimulateRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> PolicySimulation

POST /v1/policies/simulate: deployed vs candidate policies. — POST {api}/v1/policies/simulate

Source: sdks/python/src/gebsecure/_sync.py:792

Agents & credentials#

create_agent#

python
create_agent(request: RequestLike[RegisterAgentRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> RegisteredAgent

POST /v1/agents. — POST {api}/v1/agents

Source: sdks/python/src/gebsecure/_sync.py:804

update_agent#

python
update_agent(agent_id: str, request: RequestLike[UpdateAgentRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> Agent

PATCH /v1/agents/{id}. — PATCH {api}/v1/agents/{id}

Source: sdks/python/src/gebsecure/_sync.py:818

set_agent_status#

python
set_agent_status(agent_id: str, request: RequestLike[AgentStatusRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> Agent

POST /v1/agents/{id}/status: activate, suspend, disable or quarantine. — POST {api}/v1/agents/{id}/status

Source: sdks/python/src/gebsecure/_sync.py:830

delete_agent#

python
delete_agent(agent_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> None

DELETE /v1/agents/{id}. — DELETE {api}/v1/agents/{id}

Source: sdks/python/src/gebsecure/_sync.py:842

list_agent_credentials#

python
list_agent_credentials(agent_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> AgentCredentialList

GET /v1/agents/{id}/credentials (metadata, never secrets). — GET {api}/v1/agents/{id}/credentials

Source: sdks/python/src/gebsecure/_sync.py:852

create_agent_credential#

python
create_agent_credential(agent_id: str, request: RequestLike[CreateCredentialRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> IssuedCredential

POST /v1/agents/{id}/credentials; the client secret is returned once. — POST {api}/v1/agents/{id}/credentials

Source: sdks/python/src/gebsecure/_sync.py:862

rotate_credential#

python
rotate_credential(credential_id: str, request: RequestLike[RotateCredentialRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> RotatedCredential

POST /v1/credentials/{id}/rotate; the previous credential works until previous.grace_until. — POST {api}/v1/credentials/{id}/rotate

Source: sdks/python/src/gebsecure/_sync.py:874

revoke_credential#

python
revoke_credential(credential_id: str, reason: Optional[str] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> AgentCredential

POST /v1/credentials/{id}/revoke (idempotent). — POST {api}/v1/credentials/{id}/revoke

Source: sdks/python/src/gebsecure/_sync.py:886

Secrets (values are write-only)#

create_secret#

python
create_secret(request: RequestLike[CreateSecretRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> CreatedSecret

POST /v1/secrets. The value is never returned by the API and never logged by the SDK. — POST {api}/v1/secrets

Source: sdks/python/src/gebsecure/_sync.py:898

list_secrets#

python
list_secrets(params: RequestLike[ListSecretsParams] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> SecretList

GET /v1/secrets (metadata and masks). — GET {api}/v1/secrets

Source: sdks/python/src/gebsecure/_sync.py:909

get_secret#

python
get_secret(secret_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> Secret

GET /v1/secrets/{id}: metadata and version history, never the value. — GET {api}/v1/secrets/{id}

Source: sdks/python/src/gebsecure/_sync.py:920

update_secret#

python
update_secret(secret_id: str, request: RequestLike[UpdateSecretRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> Secret

PATCH /v1/secrets/{id}. — PATCH {api}/v1/secrets/{id}

Source: sdks/python/src/gebsecure/_sync.py:930

rotate_secret#

python
rotate_secret(secret_id: str, request: RequestLike[RotateSecretRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> RotatedSecret

POST /v1/secrets/{id}/rotate (a new value, or generate). — POST {api}/v1/secrets/{id}/rotate

Source: sdks/python/src/gebsecure/_sync.py:942

revoke_secret#

python
revoke_secret(secret_id: str, request: RequestLike[RevokeSecretRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> RevokeSecretResult

POST /v1/secrets/{id}/revoke (one version, or the whole secret). — POST {api}/v1/secrets/{id}/revoke

Source: sdks/python/src/gebsecure/_sync.py:954

delete_secret#

python
delete_secret(secret_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> None

DELETE /v1/secrets/{id}. — DELETE {api}/v1/secrets/{id}

Source: sdks/python/src/gebsecure/_sync.py:966

Connectors & connections#

list_connectors#

python
list_connectors(*, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> ConnectorList

GET /v1/connectors: the connector catalog. — GET {api}/v1/connectors

Source: sdks/python/src/gebsecure/_sync.py:977

get_connector#

python
get_connector(key: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> Connector

GET /v1/connectors/{key}. — GET {api}/v1/connectors/{key}

Source: sdks/python/src/gebsecure/_sync.py:986

list_connections#

python
list_connections(params: RequestLike[ListConnectionsParams] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> ConnectionList

GET /v1/connections. — GET {api}/v1/connections

Source: sdks/python/src/gebsecure/_sync.py:996

get_connection#

python
get_connection(connection_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> Connection

GET /v1/connections/{id}. — GET {api}/v1/connections/{id}

Source: sdks/python/src/gebsecure/_sync.py:1007

create_connection#

python
create_connection(request: RequestLike[CreateConnectionRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> Connection

POST /v1/connections: installs a connector into a project. — POST {api}/v1/connections

Source: sdks/python/src/gebsecure/_sync.py:1017

update_connection#

python
update_connection(connection_id: str, request: RequestLike[UpdateConnectionRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> Connection

PATCH /v1/connections/{id}. — PATCH {api}/v1/connections/{id}

Source: sdks/python/src/gebsecure/_sync.py:1028

delete_connection#

python
delete_connection(connection_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> None

DELETE /v1/connections/{id}. — DELETE {api}/v1/connections/{id}

Source: sdks/python/src/gebsecure/_sync.py:1040

check_connection_health#

python
check_connection_health(connection_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> ConnectionHealth

POST /v1/connections/{id}/health. — POST {api}/v1/connections/{id}/health

Source: sdks/python/src/gebsecure/_sync.py:1050

start_connection_oauth#

python
start_connection_oauth(connection_id: str, request: RequestLike[OAuthStartRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> OAuthStartResult

POST /v1/connections/{id}/oauth/start (authorization code + PKCE). — POST {api}/v1/connections/{id}/oauth/start

Source: sdks/python/src/gebsecure/_sync.py:1060

complete_connection_oauth#

python
complete_connection_oauth(request: RequestLike[OAuthCallbackRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> OAuthInstallResult

POST /v1/connections/oauth/callback with the redirect's state and code. — POST {api}/v1/connections/oauth/callback

Source: sdks/python/src/gebsecure/_sync.py:1075

install_client_credentials#

python
install_client_credentials(connection_id: str, request: RequestLike[ClientCredentialsInstallRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> OAuthInstallResult

POST /v1/connections/{id}/oauth/client-credentials (machine-to-machine). — POST {api}/v1/connections/{id}/oauth/client-credentials

Source: sdks/python/src/gebsecure/_sync.py:1086

install_jwt_bearer#

python
install_jwt_bearer(connection_id: str, request: RequestLike[JwtBearerInstallRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> OAuthInstallResult

POST /v1/connections/{id}/oauth/jwt-bearer (RFC 7523, e.g. a Google service account). — POST {api}/v1/connections/{id}/oauth/jwt-bearer

Source: sdks/python/src/gebsecure/_sync.py:1100

Audit#

search_audit#

python
search_audit(params: RequestLike[AuditSearchParams] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> AuditPage

GET /v1/audit/events (newest first); with after_seq, tails the events after that sequence number (oldest first). — GET {api}/v1/audit/events

Source: sdks/python/src/gebsecure/_sync.py:1113

get_audit_event#

python
get_audit_event(event_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> AuditEvent

GET /v1/audit/events/{id}. — GET {api}/v1/audit/events/{id}

Source: sdks/python/src/gebsecure/_sync.py:1125

export_audit#

python
export_audit(params: RequestLike[AuditExportParams] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> str

GET /v1/audit/export: the raw body (ndjson by default, csv or json). — GET {api}/v1/audit/export

Source: sdks/python/src/gebsecure/_sync.py:1135

verify_audit#

python
verify_audit(request: RequestLike[VerifyAuditRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> AuditVerification

POST /v1/audit/verify: audit hash-chain integrity. — POST {api}/v1/audit/verify

Source: sdks/python/src/gebsecure/_sync.py:1146

Approvals (reviewers)#

get_approval_details#

python
get_approval_details(approval_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> Approval

GET {api}/v1/approvals/{id}: the full record (steps, decisions, comments, history, can_decide). — GET {api}/v1/approvals/{id}

Source: sdks/python/src/gebsecure/_sync.py:1158

decide_approval#

python
decide_approval(approval_id: str, request: RequestLike[DecideApprovalRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> ApprovalDecisionResult

POST /v1/approvals/{id}/decision; snapshot_hash must be the hash of the snapshot the reviewer saw. — POST {api}/v1/approvals/{id}/decision

Source: sdks/python/src/gebsecure/_sync.py:1168

Alerts#

list_alerts#

python
list_alerts(params: RequestLike[ListAlertsParams] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> AlertPage

GET /v1/alerts. — GET {api}/v1/alerts

Source: sdks/python/src/gebsecure/_sync.py:1180

get_alert#

python
get_alert(alert_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> Alert

GET /v1/alerts/{id} with investigation context. — GET {api}/v1/alerts/{id}

Source: sdks/python/src/gebsecure/_sync.py:1191

update_alert#

python
update_alert(alert_id: str, request: RequestLike[UpdateAlertRequest] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> Alert

PATCH /v1/alerts/{id}: acknowledge, assign, annotate, resolve or dismiss. — PATCH {api}/v1/alerts/{id}

Source: sdks/python/src/gebsecure/_sync.py:1201

Traces & session replay#

search_traces#

python
search_traces(params: RequestLike[TraceSearchParams] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> TraceSearchResult

GET /v1/traces. — GET {api}/v1/traces

Source: sdks/python/src/gebsecure/_sync.py:1213

get_trace#

python
get_trace(trace_id: str, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None) -> Trace

GET /v1/traces/{traceId}: platform and agent spans, correlated records, timeline. — GET {api}/v1/traces/{traceId}

Source: sdks/python/src/gebsecure/_sync.py:1224

replay_session#

python
replay_session(principal_id: str, params: RequestLike[ReplayParams] = None, *, traceparent: Optional[str] = None, idempotency_key: Optional[str] = None, **fields: Any) -> SessionReplay

GET /v1/replay/{principalId}: everything a principal did in a window. — GET {api}/v1/replay/{principalId}

Source: sdks/python/src/gebsecure/_sync.py:1234

AsyncGebSecure has the same methods as coroutines.