Skip to main content

Oracle Database Agent SDK

Build AI agents and workflows on Oracle Database — from Python.

Define agent behavior, choose tools, and connect steps through a simple Python API. Oracle Database runs the agent steps and tool calls through your application's connection.

Why this SDK? · Quickstart · Examples · Documentation · Contributing


💡 Why Oracle Database Agent SDK?

  • Build agents in Python. Choose a model, define instructions and input/output fields, then run the agent from your application.
  • Compose workflows with built-in patterns. Run steps in sequence or in parallel, select a branch, or repeat work in a bounded loop.
  • Execute workflows inside Oracle Database. Let the database run your workflow, using existing PL/SQL procedures as tools to retrieve information and perform database operations.

How workflows execute

Define agents and workflows in Python. The SDK uses AgentSpec to describe agents and workflow steps for execution in Oracle Database through your application's connection.

Call execute() to run the entire workflow in Oracle Database. See the API reference for execution details.


🚀 Quickstart: Build an AI Agent with Python

Requirements

  • Python: 3.10–3.14.
  • Oracle Database: access to DBMS_AI_AGENT.EXECUTE_IMMEDIATE and permission to run agent workflows. Ask your database administrator to confirm availability.
  • LLM access: a database-supported provider and model, an endpoint reachable from the database, and a database-managed credential when required.

Installation

Create a virtual environment and install the SDK from PyPI:

python -m venv .venv
source .venv/bin/activate
python -m pip install oracle-db-agent-sdk

Import the package as oracle_db_agent_sdk.

To install from source instead, run this command from the root of a local checkout with the virtual environment activated:

python -m pip install .

Build and run your first agent

This example uses OpenAI and an existing database credential named OPENAI_CREDENTIAL. See configuration and credential setup to prepare the credential or use another provider.

Replace the connection placeholders with your database settings:

import oracledb

from oracle_db_agent_sdk import agent, execute, llm_config

support_llm = llm_config(
    provider="openai",
    model_id="gpt-5.4",
    url="https://api.openai.com/v1/chat/completions",
    credential_name="OPENAI_CREDENTIAL",
)

support_agent = agent(
    name="customer_support",
    llm=support_llm,
    instruction="Answer the customer's question: {{question}}",
    inputs={"question": "string"},
    outputs={"answer": "string"},
)

connection = oracledb.connect(
    user="<db_user>",
    password="<db_password>",
    dsn="<host>:<port>/<service_name>",
)
try:
    result = execute(
        connection=connection,
        workflow=support_agent,
        inputs={"question": "What details should I include in a support request?"},
    )
    print("Database response:", result)
finally:
    connection.close()

The script prints the full database response. execute() preserves the database response structure, so check it before accessing fields. See result types and inspecting the result.

Read the full quickstart →


🧩 See what you can build

Choose a task to explore in the examples below.

Order support

Look up an order with a PL/SQL procedure, then use an LLM to turn its status into a customer-facing explanation. This workflow chains a tool call and a model response.

View the order-support example →

Independent claim reviews

Compose separate medical, policy, and fraud review prompts as parallel branches. Each branch uses the inputs it needs and contributes an assessment to the workflow's results.

View the claim-review example →

Support-ticket routing

Classify a ticket and route it to a billing, security, or technical support branch. A general-support fallback handles unmatched classifications.

View the ticket-routing example →

Document review

Refine a draft through repeated reviews, carrying the draft and completion flag between steps. Reviews run in the database. The loop raises an error if review is still incomplete at its iteration limit.

View the loop example → · Learn about loops →


📚 Documentation


🤝 Contributing

See CONTRIBUTING.md for development setup and contribution guidance.

Security

Follow Oracle's security reporting instructions to report a vulnerability privately.

License and notices

See LICENSE.txt for the SDK license, THIRD_PARTY_LICENSE.txt for third-party licenses, and NOTICE.txt for notices.

Metadata

Release files for oracle-db-agent-sdk 1.0.0

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

Source distribution (sdist)

Source distribution for oracle-db-agent-sdk 1.0.0
File Size Uploaded Provenance Actions
oracle_db_agent_sdk-1.0.0.tar.gz 101.4 kB Without provenance Details for oracle_db_agent_sdk-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oracle-db-agent-sdk 1.0.0
File Interpreter ABI Platform Actions
oracle_db_agent_sdk-1.0.0-py3-none-any.whl Python 3 none any Details for oracle_db_agent_sdk-1.0.0-py3-none-any.whl

Total release size: 160.3 kB

Release files / oracle_db_agent_sdk-1.0.0.tar.gz

Download URL oracle_db_agent_sdk-1.0.0.tar.gz
Size 101.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2b040f08751af0514dba0ac49208ca9322895178535b7ae7ce3168077c475509
BLAKE2b-256 checksum
How to use checksums
53749ffb52752184a8070a6a91c7029eb32e663d9449042e9110490079162767
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / oracle_db_agent_sdk-1.0.0-py3-none-any.whl

Download URL oracle_db_agent_sdk-1.0.0-py3-none-any.whl
Size 58.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6e856da65875d525a20eef11ed270ab0275f1a110ca770c8a43b0b4b17f632b
BLAKE2b-256 checksum
How to use checksums
ceef6a53c129e324ecd34d19aff197891ea15dc60b5c559ef5b636170c77999d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Security for oracle-db-agent-sdk 1.0.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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