Skip to main content

Python SDK for General Augment, the agent backend for your app.

Project description

General Augment Python SDK

General Augment is the agent backend for your app. This is the 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.

Agent-readable docs: https://docs.generalaugment.com/llms.txt. SDK reference: https://docs.generalaugment.com/sdk/reference/ or the Markdown export at https://docs.generalaugment.com/markdown/sdk/reference.md.

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 python -m platform_cli.local_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.2.0.tar.gz (84.0 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.2.0-py3-none-any.whl (91.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: general_augment_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 84.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for general_augment_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c24c5825f250691745aa44dfacc50aa9f2af61ff40d49c35383f0381d0987ba7
MD5 621450bf6339683afa198f3fa2e8ba85
BLAKE2b-256 8df99857250c138b0ca803330922e9649aedad1bd4d6be15469c44adab6126dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for general_augment_sdk-0.2.0.tar.gz:

Publisher: package-release.yml on LunarVentures/general-augment-platform

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

File details

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

File metadata

File hashes

Hashes for general_augment_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e0222733c6a8804f9bcf8e7a1405f846e521baa8ff87a7ece4fcb08e17a105a
MD5 4c6f01e5f6f5d7649810ef47801e3e8a
BLAKE2b-256 876911f6c0b108bf7f421eae463462e717c446130d431ec01cbd596c2dfd6443

See more details on using hashes here.

Provenance

The following attestation bundles were made for general_augment_sdk-0.2.0-py3-none-any.whl:

Publisher: package-release.yml on LunarVentures/general-augment-platform

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