Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The **OCI GenAI Auth** Python library provides OCI request-signing helpers for t
- [Installation](#installation)
- [Using OCI IAM Auth](#using-oci-iam-auth)
- [Using API Key Auth](#using-api-key-auth)
- [Using AgentHub APIs](#using-agenthub-apis)
- [Using OCI Enterprise AI Agents APIs](#using-oci-enterprise-ai-agents-apis)
- [Examples](#examples)
- [Contributing](#contributing)
- [Security](#security)
Expand Down Expand Up @@ -58,17 +58,17 @@ client = OpenAI(
)
```

## Using AgentHub APIs
## Using OCI Enterprise AI Agents APIs

OCI AgentHub provides a unified API for interacting with models and agentic capabilities.
OCI Enterprise AI Agents provides a unified API for interacting with models and agentic capabilities.

- It is compatible with OpenAI's Responses API and the [Open Responses Spec](https://www.openresponses.org/specification), enabling developers to build agents with OpenAI SDK, OpenAI Agents SDK, LangChain, LangGraph, AI SDK, CrewAI, and more.
- It offers a uniform interface, auth, billing to access multiple model providers including OpenAI, Gemini, xAI, and GPT-OSS models hosted in OCI and your Dedicated AI Cluster.
- It provides built-in agentic primitives such as agent loop, reasoning, short-term memory, long-term memory, web search, file search, image generation, code execution, and more.

In addition to the compatible endpoint to Responses API, AgentHub also offers compatible endpoints to Files API, Vector Stores API, and Containers API.
In addition to the compatible endpoint to Responses API, OCI Enterprise AI Agents also offers compatible endpoints to Files API, Vector Stores API, and Containers API.

Explore [examples](https://github.com/oracle-samples/oci-genai-auth-python/tree/main/examples/agenthub) to get started.
Explore [examples](https://github.com/oracle-samples/oci-genai-auth-python/tree/main/examples/enterprise_ai_agents) to get started.

Note: OpenAI commercial models and image generation are only available to Oracle internal teams at this moment.

Expand Down
75 changes: 0 additions & 75 deletions examples/agenthub/README.md

This file was deleted.

75 changes: 75 additions & 0 deletions examples/enterprise_ai_agents/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# OCI Enterprise AI Agents Examples

This folder contains examples for OCI Enterprise AI Agents APIs using the OpenAI Python SDK.

## Prerequisites

1. Install dependencies:

```bash
pip install -e '.[dev]'
```

2. Configure shared values in `examples/enterprise_ai_agents/common.py`:
- `PROFILE_NAME`
- `COMPARTMENT_ID`
- `PROJECT_OCID`
- `REGION`

3. (Optional) You can override project at runtime:

```bash
export OCI_GENAI_PROJECT_ID=<your_project_ocid>
```

4. If running API-key based examples, set:

```bash
export OPENAI_API_KEY=<your_oci_genai_api_key>
```

## How to run

From repository root, run any example module with `python -m`.

Quickstarts:

```bash
python -m examples.enterprise_ai_agents.quickstart_responses_create_oci_iam
python -m examples.enterprise_ai_agents.quickstart_responses_create_api_key
```

Responses API examples:

```bash
python -m examples.enterprise_ai_agents.responses.create_response
python -m examples.enterprise_ai_agents.responses.streaming_text_delta
python -m examples.enterprise_ai_agents.responses.structured_output
python -m examples.enterprise_ai_agents.responses.use_gpt_model
python -m examples.enterprise_ai_agents.responses.use_google_gemini_model
```

Tools examples:

```bash
python -m examples.enterprise_ai_agents.tools.function_calling
python -m examples.enterprise_ai_agents.tools.web_search
python -m examples.enterprise_ai_agents.tools.code_interpreter
```

Other categories follow the same pattern:

```bash
python -m examples.enterprise_ai_agents.agents.basic_agents_example
python -m examples.enterprise_ai_agents.multiturn.responses_chaining
python -m examples.enterprise_ai_agents.memory.long_term_memory
python -m examples.enterprise_ai_agents.mcp.create_responses_mcp
python -m examples.enterprise_ai_agents.vector_stores.vector_stores_crud
python -m examples.enterprise_ai_agents.files.files_crud
python -m examples.enterprise_ai_agents.function.create_responses_fc
```

## Notes

- Most examples use IAM signing through `oci-genai-auth`.
- OCI Enterprise AI Agents examples use OpenAI-compatible `/openai/v1` endpoints and require a project OCID.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/


"""Demonstrates using OpenAI Agents SDK against the AgentHub endpoint."""
"""Demonstrates using OpenAI Agents SDK against the OCI Enterprise AI Agents endpoint."""

import asyncio
from agents import Agent, Runner, set_default_openai_client, set_tracing_disabled
from examples.agenthub import common
from examples.enterprise_ai_agents import common

set_default_openai_client(common.build_agenthub_async_client())
set_default_openai_client(common.build_enterprise_ai_agents_async_client())
set_tracing_disabled(True)

async def main():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2026 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

"""AgentHub example clients and configuration."""
"""OCI Enterprise AI Agents example clients and configuration."""

from __future__ import annotations

Expand All @@ -18,31 +18,31 @@
PROJECT_OCID = "<<ENTER_PROJECT_ID>>"
REGION = "us-chicago-1"

AGENTHUB_URL = f"https://inference.generativeai.{REGION}.oci.oraclecloud.com/openai/v1"
AGENTHUB_CP_URL = f"https://generativeai.{REGION}.oci.oraclecloud.com/20231130/openai/v1"
ENTERPRISE_AI_AGENTS_URL = f"https://inference.generativeai.{REGION}.oci.oraclecloud.com/openai/v1"
ENTERPRISE_AI_AGENTS_CP_URL = f"https://generativeai.{REGION}.oci.oraclecloud.com/20231130/openai/v1"


def build_agenthub_client() -> OpenAI:
def build_enterprise_ai_agents_client() -> OpenAI:
return OpenAI(
base_url=AGENTHUB_URL,
base_url=ENTERPRISE_AI_AGENTS_URL,
api_key="not-used",
project=os.getenv("OCI_GENAI_PROJECT_ID", PROJECT_OCID),
http_client=httpx.Client(auth=OciSessionAuth(profile_name=PROFILE_NAME)),
)


def build_agenthub_async_client() -> AsyncOpenAI:
def build_enterprise_ai_agents_async_client() -> AsyncOpenAI:
return AsyncOpenAI(
base_url=AGENTHUB_URL,
base_url=ENTERPRISE_AI_AGENTS_URL,
api_key="not-used",
project=os.getenv("OCI_GENAI_PROJECT_ID", PROJECT_OCID),
http_client=httpx.AsyncClient(auth=OciSessionAuth(profile_name=PROFILE_NAME)),
)


def build_agenthub_cp_client() -> OpenAI:
def build_enterprise_ai_agents_cp_client() -> OpenAI:
return OpenAI(
base_url=AGENTHUB_CP_URL,
base_url=ENTERPRISE_AI_AGENTS_CP_URL,
api_key="not-used",
http_client=httpx.Client(auth=OciSessionAuth(profile_name=PROFILE_NAME)),
project=os.getenv("OCI_GENAI_PROJECT_ID", PROJECT_OCID),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright (c) 2026 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

"""Demonstrates CRUD operations for conversation items in AgentHub."""
"""Demonstrates CRUD operations for conversation items in OCI Enterprise AI Agents."""

from examples.agenthub import common
from examples.enterprise_ai_agents import common


def main():
# Create an empty conversation
cp_client = common.build_agenthub_client()
cp_client = common.build_enterprise_ai_agents_client()
conversation = cp_client.conversations.create()
print("\nCreated conversation:", conversation)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright (c) 2026 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

"""Demonstrates CRUD operations for conversations in AgentHub."""
"""Demonstrates CRUD operations for conversations in OCI Enterprise AI Agents."""

from examples.agenthub import common
from examples.enterprise_ai_agents import common


def main():
client = common.build_agenthub_client()
client = common.build_enterprise_ai_agents_client()

# Create a conversation
conversation = client.conversations.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

from pathlib import Path

from examples.agenthub import common
from examples.enterprise_ai_agents import common


def main():
client = common.build_agenthub_client()
client = common.build_enterprise_ai_agents_client()
# List files in the project
files_list = client.files.list(order="asc")
for file in files_list.data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

from rich import print

from examples.agenthub import common
from examples.enterprise_ai_agents import common
from examples.fc_tools import fc_tools

MODEL = "xai.grok-4-1-fast-reasoning"


def main():
openai_client = common.build_agenthub_client()
openai_client = common.build_enterprise_ai_agents_client()
# parrel_call
response = openai_client.responses.create(
model=MODEL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
from openai.types.responses.response_input_param import FunctionCallOutput
from rich import print

from examples.agenthub import common
from examples.enterprise_ai_agents import common
from examples.fc_tools import execute_function_call, fc_tools

MODEL = "xai.grok-4-1-fast-reasoning"


def main():
openai_client = common.build_agenthub_client()
openai_client = common.build_enterprise_ai_agents_client()

# Creates first request
response = openai_client.responses.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

from rich import print

from examples.agenthub import common
from examples.enterprise_ai_agents import common

MODEL = "xai.grok-4-1-fast-reasoning"


def main():
openai_client = common.build_agenthub_client()
openai_client = common.build_enterprise_ai_agents_client()

tools = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

from rich import print

from examples.agenthub import common
from examples.enterprise_ai_agents import common

MODEL = "xai.grok-4-1-fast-reasoning"


def main():
openai_client = common.build_agenthub_client()
openai_client = common.build_enterprise_ai_agents_client()

tools = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

from rich import print

from examples.agenthub import common
from examples.enterprise_ai_agents import common

MODEL = "xai.grok-4-1-fast-reasoning"


def main():
openai_client = common.build_agenthub_client()
openai_client = common.build_enterprise_ai_agents_client()

tools = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

from rich import print

from examples.agenthub import common
from examples.enterprise_ai_agents import common

MODEL = "xai.grok-4-1-fast-reasoning"


def main():
openai_client = common.build_agenthub_client()
openai_client = common.build_enterprise_ai_agents_client()

tools = [
{
Expand Down
Loading
Loading