Select AI for Python
Select AI for Python enables you to ask questions of your database data using natural language (text-to-SQL), get generative AI responses using your trusted content (retrieval augmented generation), generate synthetic data using large language models, and other features – all from Python. With the general availability of Select AI Python, Python developers have access to the functionality of Select AI on Oracle Autonomous Database.
Select AI for Python enables you to leverage the broader Python ecosystem in combination with generative AI and database functionality - bridging the gap between the DBMS_CLOUD_AI PL/SQL package and Python's rich ecosystem. It provides intuitive objects and methods for AI model interaction.
Table of Contents
- Installation
- Documentation
- Getting Started
- Command Line Interface
- Samples
- Help
- Contributing
- Security
- License
Installation
Install the Python package:
python3 -m pip install select_ai
Install the optional command line interface:
python3 -m pip install 'select_ai[cli]'
The cli extra installs the command line interface. Install the separate
a2a extra to enable the A2A server and worker commands:
python3 -m pip install 'select_ai[a2a]'
Without the A2A dependencies, the other select-ai commands remain available;
invoking select-ai a2a or an A2A server or worker command prints the A2A
installation instructions.
Documentation
See Select AI for Python documentation, the complete first-query walkthrough, and 1.5.0 release notes.
Getting Started
import select_ai
user = "<your_select_ai_user>"
password = "<your_select_ai_password>"
dsn = "<your_select_ai_db_connect_string>"
select_ai.connect(user=user, password=password, dsn=dsn)
profile = select_ai.Profile(profile_name="oci_ai_profile")
# run_sql returns a pandas dataframe
df = profile.run_sql(prompt="How many promotions?")
print(df.columns)
print(df)
Async Example
import asyncio
import select_ai
user = "<your_select_ai_user>"
password = "<your_select_ai_password>"
dsn = "<your_select_ai_db_connect_string>"
# This example shows how to asynchronously run sql
async def main():
await select_ai.async_connect(user=user, password=password, dsn=dsn)
async_profile = await select_ai.AsyncProfile(
profile_name="async_oci_ai_profile",
)
# run_sql returns a pandas df
df = await async_profile.run_sql("How many promotions?")
print(df)
asyncio.run(main())
Command Line Interface
The optional select-ai command provides interactive chat, SQL, profile
management, and A2A server tools for Select AI:
Chat
select-ai chat --profile OCI_AI_PROFILE
A2A Server
Expose one Oracle Database AI agent team as an A2A JSON-RPC HTTP server:
select-ai a2a serve --team SALES_ANALYST --port 8000
The command obtains database connection settings from its options or the
SELECT_AI_* environment variables. Its Agent Card is available at
/.well-known/agent-card.json, and its JSON-RPC endpoint is
/a2a/jsonrpc/. Set --public-url when the server is behind a proxy or load
balancer so that clients receive its externally reachable URL.
For Autonomous Database mTLS, also set SELECT_AI_WALLET_LOCATION to the
directory containing the unzipped wallet and set SELECT_AI_WALLET_PASSWORD.
The CLI passes both values to the Select AI SDK as wallet_location and
wallet_password.
For a database using a server certificate signed by a private CA, pass the PEM
certificate file with --database-tls-ca-file or set
SELECT_AI_DATABASE_TLS_CA_FILE. The CLI reads the certificate from the file.
The server accepts both A2A 1.x and the A2A v0.3 JSON-RPC streaming protocol for compatibility with Gemini Enterprise.
See the A2A user guide for dynamic sessions, the A2UI connection flow, persistent task state, task polling and cancellation, wallet configuration, and Google Cloud deployment modes.
Generate the A2A v0.3 Agent Card to paste into Gemini Enterprise after the service has a public URL:
select-ai a2a agent-card \
--team ORACLE_AI_DATABASE_AGENT \
--public-url https://YOUR-SERVICE.run.app
Cloud Run
Deploy the A2A server to Cloud Run using the instructions in gcloud/README.md.
Samples
For in-depth examples, see the /samples directory.
Help
Questions can be asked in GitHub Discussions.
Problem reports can be raised in GitHub Issues.
Contributing
This project welcomes contributions from the community. Before submitting a pull request, please review our contribution guide
Security
Please consult the security guide for our responsible security vulnerability disclosure process
License
Copyright (c) 2025, 2026 Oracle and/or its affiliates.
Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/.
Metadata
Release files for select-ai 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| select_ai-1.5.0.tar.gz | 231.0 kB | With provenance | Details for select_ai-1.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| select_ai-1.5.0-py3-none-any.whl | Python 3 | none | any | Details for select_ai-1.5.0-py3-none-any.whl |
Total release size: 345.7 kB
Release files / select_ai-1.5.0.tar.gz
| Download URL | select_ai-1.5.0.tar.gz |
|---|---|
| Size | 231.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f56da73a637b95daaa7c30504fc8133a1e667932ceb9287500f70b3cb5ec1f1
|
|
BLAKE2b-256 checksum How to use checksums |
1526a806e8463e21b72312c7c8e1749b84f194112f09b1698f08398ea9cdd884
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 26, 2026.
Transparency logRelease files / select_ai-1.5.0-py3-none-any.whl
| Download URL | select_ai-1.5.0-py3-none-any.whl |
|---|---|
| Size | 114.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f67614d91689a9a6064bc4bc5e08e260d3ff0ad3f14d0b241f3e2bad6fb69339
|
|
BLAKE2b-256 checksum How to use checksums |
244eeed65e5f5221b46145169d08bca1143697c88ffaa340d46a3eea9a9d0257
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 26, 2026.
Transparency logSecurity for select-ai 1.5.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for select_ai-1.5.0.tar.gz
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 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.