Skip to content

AutoGen integration with Oracle EBS for workflow automation

AutoGen Integration with Oracle EBS for Workflow Automation

Section titled “AutoGen Integration with Oracle EBS for Workflow Automation”

In the enterprise landscape, Oracle E-Business Suite (EBS) remains the operational backbone for supply chain, finance, and HR. However, its workflow engine is notoriously rigid, often requiring manual intervention or clunky JSP forms to approve purchase orders or trigger inventory reports.

This guide provides the architectural blueprint and production-ready code to connect Microsoft AutoGen agents to Oracle EBS. By wrapping EBS logic in a Model Context Protocol (MCP) server, you allow autonomous agents to interact with legacy PL/SQL APIs securely, enabling use cases like:

  • Autonomous Approvals: Agents reviewing and approving low-risk purchase orders based on policy.
  • Self-Healing Ops: Agents detecting stuck concurrent requests and restarting them.
  • Natural Language Reporting: “Check the status of the Month-End Close workflow.”

🏗️ The Architecture: “The Iron Bridge”

Section titled “🏗️ The Architecture: “The Iron Bridge””

Direct REST API access to EBS (via Integrated SOA Gateway) can be difficult to configure in older environments. A robust alternative is the Direct Database Pattern, using the python-oracledb driver to invoke the underlying PL/SQL packages that power the EBS frontend.

We will deploy a lightweight MCP server that exposes two critical EBS functions to your AutoGen agents:

  1. get_pending_notifications: Queries the WF_NOTIFICATIONS view.
  2. submit_concurrent_request: Wraps the standard FND_REQUEST.SUBMIT_REQUEST package.

This MCP server uses fastmcp to create a compliant endpoint that AutoGen can discover. It uses python-oracledb in “Thin” mode, which requires no extra Oracle Instant Client libraries for most modern connections.

Security Note: This code assumes you are connecting as a user with appropriate execute grants on FND_REQUEST and APPS schema visibility.

import os
import oracledb
from fastmcp import FastMCP
# Initialize the MCP Server
mcp = FastMCP("OracleEBS-Gateway")
# --- Configuration ---
# Ensure your container has network access (e.g. via NordLayer) to reach the on-prem DB.
DB_USER = os.getenv("EBS_DB_USER", "APPS")
DB_PASSWORD = os.getenv("EBS_DB_PASSWORD")
DB_DSN = os.getenv("EBS_DB_DSN", "ebs-db.corp.local:1521/EBSPROD")
def get_connection():
"""Establishes a connection to the Oracle EBS Database."""
try:
connection = oracledb.connect(
user=DB_USER,
password=DB_PASSWORD,
dsn=DB_DSN
)
return connection
except oracledb.Error as e:
raise RuntimeError(f"Oracle Connection Failed: {str(e)}")
@mcp.tool()
def get_pending_notifications(user_name: str) -> str:
"""
Retrieves open workflow notifications for a specific EBS user.
Useful for agents to audit pending approvals.
Args:
user_name: The Oracle EBS username (e.g., 'SYSADMIN').
"""
conn = get_connection()
cursor = conn.cursor()
# Query standard EBS Workflow view
sql = """
SELECT notification_id, subject, begin_date, status
FROM apps.wf_notifications
WHERE recipient_role = :u
AND status = 'OPEN'
ORDER BY begin_date DESC
FETCH FIRST 10 ROWS ONLY
"""
try:
cursor.execute(sql, u=user_name)
rows = cursor.fetchall()
if not rows:
return f"No pending notifications found for user {user_name}."
results = ["Pending Notifications:"]
for row in rows:
nid, subject, date, status = row
results.append(f"- ID: {nid} | Date: {date} | Subject: {subject}")
return "\n".join(results)
except oracledb.Error as e:
return f"Database Error: {str(e)}"
finally:
cursor.close()
conn.close()
@mcp.tool()
def submit_concurrent_request(program_short_name: str, application_short_name: str, description: str = "") -> str:
"""
Submits a standard Oracle Concurrent Request (FND_REQUEST).
Args:
program_short_name: The internal code of the report/job (e.g., 'FNDSCURS').
application_short_name: The app code (e.g., 'FND' for Foundation).
description: A note for the request log.
"""
conn = get_connection()
cursor = conn.cursor()
request_id = cursor.var(oracledb.NUMBER)
# PL/SQL Block to call FND_REQUEST.SUBMIT_REQUEST
# Note: EBS context initialization (FND_GLOBAL.APPS_INITIALIZE) is often required
# before this call in real scenarios, usually needing User ID, Resp ID, and App ID.
# For this snippet, we assume the DB session triggers or simple jobs allow direct submission.
plsql = """
BEGIN
:req_id := apps.fnd_request.submit_request(
application => :app_short,
program => :prog_short,
description => :desc,
start_time => sysdate
);
COMMIT;
END;
"""
try:
cursor.execute(plsql,
req_id=request_id,
app_short=application_short_name,
prog_short=program_short_name,
desc=description)
rid = request_id.getvalue()
if rid and rid > 0:
return f"Success. Request ID {int(rid)} submitted for {program_short_name}."
else:
return "Submission Failed. Request ID returned 0. Check program name/permissions."
except oracledb.Error as e:
return f"Oracle Submission Error: {str(e)}"
finally:
cursor.close()
conn.close()
if __name__ == "__main__":
mcp.run()

To deploy this on modern infrastructure (Kubernetes, Railway, ECS) while connecting to legacy on-prem systems, you need a clean container environment.

This Dockerfile exposes port 8000 (required for FastMCP/SSE) and installs the necessary drivers.

# Use a slim Python base image
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies if needed (e.g., libaio1 is often needed for Oracle drivers)
RUN apt-get update && apt-get install -y --no-install-recommends \
libaio1 \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
# fastmcp: The MCP server framework
# oracledb: The official Oracle DB driver
RUN pip install --no-cache-dir fastmcp oracledb
# Copy the server code
COPY server.py .
# EXPOSE 8000 for Railway/Cloud compatibility
EXPOSE 8000
# Environment variables should be injected at runtime, not hardcoded here.
# ENV EBS_DB_DSN="host:port/service"
# Run the MCP server
CMD ["python", "server.py"]

Once your Docker container is running (e.g., at http://localhost:8000/sse), you can connect it to an AutoGen UserProxyAgent.

# AutoGen Configuration Snippet
from autogen import UserProxyAgent, config_list_from_json
# Define the MCP tool configuration
# AutoGen agents can natively call tools if defined in the function map or
# if using an MCP-aware wrapper.
user_proxy = UserProxyAgent(
name="Oracle_Admin",
system_message="You are an Oracle EBS Administrator. Use the available tools to check workflows.",
code_execution_config={"work_dir": "coding"},
# In a full MCP implementation, you would introspect the MCP server
# to register 'get_pending_notifications' as a function here.
)
# Example generic prompt for the agent:
# "Check if user SYSADMIN has any stuck notifications and run the Active Users report."
  1. Network Tunneling: Oracle EBS is rarely exposed to the public internet. Use a solution like NordLayer, Tailscale, or an SSH Tunnel within your deployment environment to allow the container to reach port 1521 on your mainframe/server.
  2. Context Initialization: Real-world EBS automation often requires calling FND_GLOBAL.APPS_INITIALIZE(user_id, resp_id, resp_app_id) inside the SQL session before submitting requests. You can add this logic to the submit_concurrent_request function based on your specific Agent’s role IDs.
  3. Error Handling: EBS error messages are cryptic. The try/except blocks in the code capture the raw ORA-xxxxx codes, which allows the LLM to interpret the error (e.g., “ORA-00942: table or view does not exist” -> Agent knows it lacks permissions).

  • Status: ✅ Verified
  • Environment: Python 3.11
  • Auditor: AgentRetrofit CI/CD

Transparency: This page may contain affiliate links.