Skip to main content

Python SDK for the General Augment admin and integration APIs.

Project description

General Augment Python SDK

Backend SDK for General Augment app integrations. Use it from trusted server code. Project-scoped keys are for app traffic such as Responses and memory calls. Admin and setup helpers require a management/admin-capable key and send it as X-Admin-Key.

During private beta, package publishing may not be available in every package index. If installing the package fails, use the repository package path for local tests or raw HTTP examples in the public docs until scripts/package-registry-readiness.py reports the expected package version as published.

pip install general-augment-sdk
import os

from genaug import (
    GeneralAugmentClient,
    __version__,
    response_output_text,
    response_structured_output,
)

client = GeneralAugmentClient(
    api_key=os.environ["GENAUG_API_KEY"],
    base_url=os.getenv("GENAUG_API_BASE_URL", "https://api.generalaugment.com"),
)

print(f"General Augment SDK {__version__}")

Responses

response = client.create_response(
    {
        "model": "balanced",
        "user": "app-user-123",
        "input": "Reply with a concise onboarding summary.",
        "metadata": {"feature": "onboarding"},
    },
    idempotency_key="onboarding-turn-1",
    request_id="req_app_123",
)

print(response_output_text(response))

Structured output:

structured_response = client.create_response(
    {
        "model": "balanced",
        "user": "app-user-123",
        "input": "Extract the user's preference: window seat.",
        "text": {
            "format": {
                "type": "json_schema",
                "name": "preference",
                "strict": True,
                "schema": {
                    "type": "object",
                    "required": ["seat"],
                    "properties": {"seat": {"type": "string"}},
                    "additionalProperties": False,
                },
            }
        },
    }
)

preference = response_structured_output(structured_response)

Streaming:

for event in client.stream_response(
    {
        "model": "balanced",
        "user": "app-user-123",
        "input": "Draft a two sentence welcome message.",
    }
):
    if event["event"] == "response.output_text.delta":
        print(event["data"].get("delta", ""), end="")

Memory

stored = client.store_memory(
    {
        "user_id": "app-user-123",
        "fact": "User prefers window seats",
        "fact_type": "preference",
        "importance_score": 0.9,
        "idempotency_key": "memory-window-seat-1",
    }
)

client.search_memory({"user_id": "app-user-123", "query": "seat preference"})
client.memory_profile("app-user-123")
client.delete_memory(str(stored["memory_id"]), user_id="app-user-123")
client.purge_user_memory("app-user-123")

Usage

usage = client.usage("project_123", start_date="2026-04-01", end_date="2026-04-24")
print(usage["totals"])

Error Handling

from genaug import GeneralAugmentAPIError

try:
    client.create_response({"model": "balanced", "input": "Hello"})
except GeneralAugmentAPIError as exc:
    if exc.reason == "rate_limit_exceeded":
        print(f"Retry after {exc.retry_after} seconds")
    print(exc.request_id, exc.trace_id, exc.detail)

GeneralAugmentAPIError preserves the HTTP status, stable reason/code when the API returns one, Retry-After, X-RateLimit-*, request/trace IDs, and the decoded JSON body. Existing code that only reads status_code or detail keeps working.

Local Tests

Run the local mock server and point the SDK at it:

uv run --project packages/cli genaug mock --host 127.0.0.1 --port 8787 --quiet
export GENAUG_API_BASE_URL="http://127.0.0.1:8787"
export GENAUG_API_KEY="local-test"
PYTHONPATH=src python examples/contract_test.py

The contract example covers a Responses turn plus memory store/search against the same deterministic routes used by app backend CI.

Other Helpers

The SDK also includes create_project_from_config, register_openapi_tools, link_user, usage, and test_agent for admin and integration workflows.

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

general_augment_sdk-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

general_augment_sdk-0.1.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file general_augment_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: general_augment_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for general_augment_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0e71f6a3e5a2d8a429fc770aa66df7c42305ff63c9d9a47365c30231a5d12196
MD5 815449a32d6b0d9286ec56eee17a2829
BLAKE2b-256 1b621c5d1021e77ef94fc782bd22776fa6411fd787101f89570c25cf9fad598b

See more details on using hashes here.

File details

Details for the file general_augment_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: general_augment_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for general_augment_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0176a10758ab3891e4b6df6522c4b57da53af655e836987c955f08d74761d75
MD5 17327867e19fcf6074c8e25f01275958
BLAKE2b-256 ece876965bbfc000da882f8e55c5acd6e8487ebbb07332bb5e7a94ff25738843

See more details on using hashes here.

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