Skip to main content

Basement Gateway Python Library

pypi

🇧🇷 Leia em português

The official library for the Basement Gateway.

Basement is AI-native application management services (AMS) for SAP. The Basement Gateway is the one address where the knowledge and the tools of an SAP operation are reached: the documents, files, skills and tasks the organization keeps in Basement, and the services it already works in, such as Jira and GLPI.

AI agents connect to the Gateway through MCP. This library is for the programs your team writes: a job, an internal tool, an integration with another system. With a key of its own, a program can:

  • Find what the team already knows. Search and read documents and files: how an error was resolved, what a custom (Z) program does, what the runbook says.
  • Keep knowledge where the next person will look. Create and edit documents, files and skills. Earlier versions of a document stay available.
  • Hand work to people. Open a task for someone to review, and follow it until it is done.
  • Work in the ITSM the team already uses. Read a ticket, reply to it and change its status in Jira, GLPI and other connected services.

A person chooses what each key can read, write and use, and every call is in the activity log. It is made for the people who keep SAP running (support analysts, functional and ABAP consultants) and for the developers who build their tools.

Table of Contents

Documentation

API reference documentation is available here.

Installation

pip install basement-gateway

Reference

A full reference for this library is available here.

Português

🇧🇷 Este README em português: README.pt-BR.md. A documentação completa em português está em docs.basement.chat/pt-br.

Usage

Instantiate and use the client with the following:

from basement_gateway import BasementGateway

client = BasementGateway(
    api_key="<token>",
)

client.docs.list()

Environments

This SDK allows you to configure different environments for API requests.

from basement_gateway import BasementGateway
from basement_gateway.environment import BasementGatewayEnvironment

client = BasementGateway(
    environment=BasementGatewayEnvironment.PRODUCTION,
)

Async Client

The SDK also exports an async client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use httpx.AsyncClient() instead of httpx.Client() (e.g. for the httpx_client parameter of this client).

import asyncio

from basement_gateway import AsyncBasementGateway

client = AsyncBasementGateway(
    api_key="<token>",
)


async def main() -> None:
    await client.docs.list()


asyncio.run(main())

Exception Handling

When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error will be thrown.

from basement_gateway.core.api_error import ApiError

try:
    client.docs.list()
except ApiError as e:
    print(e.status_code)
    print(e.body)

Advanced

Access Raw Response Data

The SDK provides access to raw response data, including headers, through the .with_raw_response property. The .with_raw_response property returns a "raw" client that can be used to access the .headers and .data attributes.

from basement_gateway import BasementGateway

client = BasementGateway(...)
response = client.docs.with_raw_response.list()
print(response.headers)  # access the response headers
print(response.status_code)  # access the response status code
print(response.data)  # access the underlying object

Retries

The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).

Which status codes are retried depends on the retryStatusCodes generator configuration:

legacy (current default): retries on

  • 408 (Timeout)
  • 409 (Conflict)
  • 429 (Too Many Requests)
  • 5XX (All server errors, including 500)

recommended: retries on

  • 408 (Timeout)
  • 409 (Conflict)
  • 429 (Too Many Requests)
  • 502 (Bad Gateway)
  • 503 (Service Unavailable)
  • 504 (Gateway Timeout)

Use the max_retries request option to configure this behavior.

client.docs.list(request_options={
    "max_retries": 1
})

Timeouts

The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.

from basement_gateway import BasementGateway

client = BasementGateway(..., timeout=20.0)

# Override timeout for a specific method
client.docs.list(request_options={
    "timeout": 1
})

Custom Client

You can override the httpx client to customize it for your use-case. Some common use-cases include support for proxies and transports.

import httpx
from basement_gateway import BasementGateway

client = BasementGateway(
    ...,
    httpx_client=httpx.Client(
        proxy="http://my.test.proxy.example.com",
        transport=httpx.HTTPTransport(local_address="0.0.0.0"),
    ),
)

Contributing

While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!

Metadata

Release files for basement-gateway 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for basement-gateway 0.1.1
File Size Uploaded
basement_gateway-0.1.1.tar.gz 74.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for basement-gateway 0.1.1
File Interpreter ABI Platform
basement_gateway-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 205.5 kB

Release files / basement_gateway-0.1.1.tar.gz

Download URL basement_gateway-0.1.1.tar.gz
Size 74.3 kB
Tags Source
SHA-256 checksum
How to use checksums
52abdd6b797fd43cccd11df32e9fb546d21bbe0251e367d5e2d87d2101a6e4e3
BLAKE2b-256 checksum
How to use checksums
ed7d1361412a7daa5acdd845eda84d5c7d65a359273605822bb24beda80cc91e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / basement_gateway-0.1.1-py3-none-any.whl

Download URL basement_gateway-0.1.1-py3-none-any.whl
Size 131.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b71bca91c6b8c8d16ab1771000df8782b7688d7165a4d4a081f0c608b0950e4c
BLAKE2b-256 checksum
How to use checksums
e6b78d1b2d88b2bdce1172a8d21d7d204c9e47bef21ae082fde2db732bdfcb9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page