Details
# Oracle AI Data Platform — Workbench Engineer Agent
> **Run your entire AI data platform in English** — one agent for the whole Oracle AI Data Platform
> Workbench: discover, query, build, govern, and ship guarded AI, all in natural language.
> **Canonical home:** [`oracle-samples/oracle-aidp-samples/ai/claude-code-plugins/oracle-ai-data-platform-workbench-engineer-agent`](https://github.com/oracle-samples/oracle-aidp-samples/tree/main/ai/claude-code-plugins/oracle-ai-data-platform-workbench-engineer-agent).
> End users install via Anthropic's community marketplace (see [Install](#install)), which sources from this
> canonical Oracle-org location.
Operate the entire Oracle AI Data Platform (AIDP) Workbench in natural language — a **37-skill** agent
(not a single-engine orchestrator). It discovers your catalog into a grounding cache (FK/join hints +
per-column value dictionaries), turns plain English into accurate Apache Spark SQL, runs the full lakehouse SQL
lifecycle (CREATE/INSERT/UPDATE/DELETE/MERGE/OPTIMIZE/VACUUM/DESCRIBE HISTORY/time-travel), ingests files,
profiles data and sets quality rules, authors and repairs cron pipelines, provisions clusters
(Compute/AI Compute), and debugs jobs through the Spark UI — then keeps going where orchestrators
stop: governing the platform (roles + per-resource permissions, credential store, Delta Sharing, audit logs,
MLOps/MLflow) and shipping AI (Agent Flows across 13 node types **with guardrails**, Knowledge Base RAG,
high-code LangGraph/aidputils agents, reusable Tools). A semantic model + verified-query repository are
matched before free generation for accuracy. **Signature differentiators:** LLM-in-SQL via
`ai_generate('openai.gpt-5.4', '<prompt>')`, and cross-source federation in one Spark session.
**Engine precedence** (see [references/aidp-cli-map.md](./references/aidp-cli-map.md)): control-plane
operations prefer the official AIDP CLI when installed and fall back to `oci raw-request` against the same
AIDP REST API; interactive Spark-SQL / notebook cells run via the bundled `scripts/aidp_sql.py` helper.
> **Status:** **v0.5.0** — 37 skills across the AIDP data-engineering lifecycle (api_key **or** session-token auth). Endpoint + verification log:
> [references/rest-endpoint-map.md](./references/rest-endpoint-map.md); change history: [CHANGELOG](./CHANGELOG.md).
> **Additive to your Oracle stack** — complementary to Oracle FDI / OAC / OTBI / BIP, not a replacement.
## What it does
37 skills across the AIDP data-engineering lifecycle (each maps to an official AIDP CLI command group —
see [references/aidp-cli-map.md](./references/aidp-cli-map.md)):
| Area | Skills |
|---|---|
| **Foundation & setup** | `aidp-engineer-overview` (router), `aidp-engineer-bootstrap`, `aidp-workspace-admin`, `aidp-catalog-init` |
| **Discovery & analysis** | `aidp-analyzing-data`, `aidp-catalog-explore` |
| **Quality & observability** | `aidp-profiling-tables`, `aidp-data-quality`, `aidp-observability` |
| **Ingestion, tables & SQL** | `aidp-ingest-file-to-table`, `aidp-sql-ddl` (DDL/DML + Delta maintenance), `aidp-table-management` (catalog/schema/table/view lifecycle + external catalogs), `aidp-workspace-files`, `aidp-volumes` |
| **Pipelines & orchestration** | `aidp-pipelines`, `aidp-notebooks` |
| **Debugging & compute** | `aidp-cluster-ops`, `aidp-spark-debugging`, `aidp-spark-optimization` |
| **Reliability & semantics** | `aidp-semantic-model`, `aidp-verified-queries` |
| **Signature differentiators** | `aidp-federate`, `aidp-ai-sql` |
| **Agentic & AI** | `aidp-agent-flows` (+ all 13 node types, guardrails), `aidp-agent-highcode` (LangGraph/aidputils), `aidp-tools` (reusable tools), `aidp-knowledge-bases` (RAG) |
| **Governance** | `aidp-credentials`, `aidp-data-sharing`, `aidp-git`, `aidp-bundle`, `aidp-roles-access` (+ per-resource permissions, masking), `aidp-mlops`, `aidp-models-catalog`, `aidp-audit`, `aidp-user-settings` |
| **Migration** | `aidp-migration` |
---
## Install
> **Prerequisites (3) — no MCP required:**
> 1. The [`oci` CLI](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/cliconcepts.htm)
> configured with a **`DEFAULT` profile — either an api_key profile *or* an `oci session authenticate`
> session-token profile** (both are first-class). The one profile signs `oci raw-request` control-plane
> calls and drives `scripts/aidp_sql.py`: an api_key profile mints a short-lived UPST for the Spark
> WebSocket; a session-token profile reuses its token directly (no mint). `aidp_sql.py --session-profile`
> can still override the WebSocket token explicitly.
> 2. **Python 3.x** — the helper deps (`oci`, `requests`, `websocket-client`, `cryptography`; no `aidp_agent`)
> are **checked on your first session** by the bundled SessionStart hook, which prints the `pip install`
> command if any is missing (set `AIDP_PLUGIN_AUTOINSTALL=1` to let the hook run it). Install from the plugin dir (`claude plugin list` →
> `python -m pip install -r scripts/requirements.txt`, path relative to the plugin root, not your cwd).
> 3. That's it. There is **no AIDP MCP to install or register.** An MCP is an optional accelerator only.
From Anthropic's community plugin marketplace (recommended — sources from the canonical Oracle-org home):
```bash
claude plugin marketplace add anthropics/claude-plugins-community
claude plugin install oracle-ai-data-platform-workbench-engineer-agent
```
> The SessionStart hook checks the helper deps and prints the `pip install` command if any is missing
> (`AIDP_PLUGIN_AUTOINSTALL=1` lets it install them for you).
Then run the one-time bootstrap and catalog discovery:
```
/aidp-engineer-bootstrap # detects OCI DEFAULT profile + DataLake/workspace, verifies oci ✓ helper ✓ cluster ✓
/aidp-catalog-init # one-time catalog discovery → .aidp/catalog.md grounding file
```
Now ask in natural language — e.g. *"profile store_sales", "what are the top 10 items by net sales?",
"build a daily job that refreshes the supplier-spend mart", "share the gold schema with a recipient"*.
### Running interactive Spark-SQL (the bundled helper)
Control-plane skills need no extra setup — they shell out to `oci raw-request`. Interactive Spark-SQL
and notebook cells use the bundled helper, which speaks the Jupyter v5.3 WebSocket protocol that plain
HTTP `oci raw-request` can't:
```bash
python "$PLUGIN_DIR/scripts/aidp_sql.py" \
--region us-ashburn-1 --datalake <DATALAKE_OCID> --workspace <WS_ID> \
--cluster <CLUSTER_KEY> --code "spark.sql('SELECT 1').show()" \
[--profile DEFAULT] [--session-profile AIDP_SESSION] [--timeout 180]
```
It auto-creates a scratch notebook and authenticates per `--profile`: an **api_key** profile mints a
short-lived UPST; a **session-token** profile reuses its token directly (no mint). It prints JSON:
`{"status", "execution_count", "outputs", "spark_job_ids", ...}`. Exit code `0` on success, `1` on cell error.
### Optional MCP accelerator
If an AIDP MCP server is already configured in your Claude Code setup, skills may opportunistically use
its tools — but the plugin never assumes one exists and works fully without it. Nothing in install or
bootstrap registers an MCP.
---
## How it works
### Layered architecture — who calls what
```
DATA ENGINEER → natural language in Claude Code
│
▼
PLUGIN: oracle-ai-data-platform-workbench-engineer-agent (37 skills)
┌ aidp-engineer-overview (ROUTER) — routes by intent ─────────────┐
│ discovery │ analysis │ quality │ pipelines │ governance │ … │
└─────────────────────────────────────────────────────────────────┘
GROUNDING CACHE .aidp/ : catalog.md (tables/cols/FKs/value-dicts) ·
semantic.md (logical names/metrics/joins) ·
verified-queries.md (validated Q→SQL pairs)
│ EXECUTION RULE: SQL → aidp_sql.py ; everything else → oci raw-request
┌────┴───────────────┐ ┌───────────────────────────┐
▼ │ ▼ │
oci raw-request │ scripts/aidp_sql.py │
(CONTROL PLANE, REST): │ (INTERACTIVE SPARK-SQL): │
catalogs · schemas · │ spark.sql(...) / notebook cells │
tables · clusters · │ over Jupyter v5.3 WebSocket; │
jobs · volumes · │ api_key→UPST or session reused │
files · roles · │ → JSON {status,outputs, │
credentials · sharing ·│ spark_job_ids,…} │
git · bundle · mlops · │ │
models · agent-flows │ │
(Preview/LA flagged) │ │
└─────────┬──────────┘ └─────────────┬─────────────┘
│ OCI auth: DEFAULT profile — api_key (→UPST) or session-token (reused directly)
└───────────────────────┬───────────────────┘
▼
ORACLE AI DATA PLATFORM REST API (20240831 · dataLakes · <DATALAKE_OCID>):
Spark cluster · catalogs/tables · Jobs · Delta Sharing · Git · Bundles ·
MLOps · Agent Flows
[ optional accelerator: an AIDP MCP server, if one is already configured ]
```
### One-time setup (install + 2 commands)
```
claude plugin marketplace add anthropics/claude-plugins-community
claude plugin install oracle-ai-data-platform-workbench-engineer-agent
│
▼ first session: SessionStart hook checks helper deps (oci/requests/websocket-client/cryptography) and prints the install command
▼ /aidp-engineer-bootstrap → reads ~/.oci/config (DEFAULT), lists DataLakes/workspaces;
│ verifies oci ✓ aidp_sql.py ✓ cluster ✓
▼ /aidp-catalog-init → writes .aidp/catalog.md (one-time grounding)
▼ READY → ask in natural language
```
### Per-request runtime (core loop + reliability)
```
NL request → [ROUTER] classify intent → select skill
│
├─ data question (NL→SQL)?
│ └─ match verified-queries.md? yes→reuse validated SQL
│ no→ground from catalog.md + semantic.md (names/FKs/value-dicts)
│ → python "$PLUGIN_DIR/scripts/aidp_sql.py" --cluster … --code "spark.sql(…)"
│ (api_key→UPST or session-token reused; auto scratch notebook)
│ → show result → cache new verified pair/mappings
│
└─ control-plane op (catalog/clusters/jobs/ingest/volumes/files/
credentials/sharing/git/bundle/agent-flows/roles/mlops/models)?
→ oci raw-request (20240831 · dataLakes · <DATALAKE_OCID>)
└─ auth ladder: DEFAULT(api_key) ─401/403→ refresh AIDP_SESSION
→ retry w/ security_token ; flag Preview/LA status
│
└─ on failure → inline troubleshooting: workspace-first, refresh token,
ensure cluster running, verify version/prefix (20240831/dataLakes)
```
---
## Design principles
- **Grounding-first** — match a *validated* question→SQL pair (verified-query repository) and ground in the
semantic model + value dictionaries **before** free SQL generation. This is the accuracy lever that
curated NL-to-SQL systems rely on.
- **One engine, many sources** — `aidp-federate` reads heterogeneous sources (via the spark-connectors
plugin) into one Spark session and joins them.
- **`ai_generate()` in SQL** — LLM calls inline in Spark SQL (`aidp-ai-sql`).
- **Self-contained two-engine model** — control-plane ops via `oci raw-request`, interactive Spark-SQL via
the bundled `scripts/aidp_sql.py` helper. No AIDP MCP or `ai-data-engineer-agent` repo required; an MCP,
if present, is an optional accelerator only.
- **No fabrication** — Preview/LA endpoints, the `ai_generate` signature, and federation semantics are
flagged for live verification; nothing is asserted as confirmed without a recorded live result.
## License
[MIT](./LICENSE) © 2026 Oracle and/or its affiliates
## skills/aidp-agent-flows/SKILL.md
---
name: aidp-agent-flows
description: Discover, author, deploy, and run AIDP agent flows. Use when the user wants to list/inspect agent flows, or create/update/deploy/run a flow, manage sessions/guardrails, attach compute, or attach a remote MCP server to a flow (an MCP_TOOL node — AIDP's "Native MCP Client Support" LA feature, where the flow connects OUT to OAC/ADW/OIC/any MCP-compatible service). Everything runs over the Limited-Availability AgentFlows REST API via `oci raw-request`; verify live first. (An `aidp` MCP `list_agent_flows`, if configured, is an optional read accelerator only.)
---
# `aidp-agent-flows` — agent flow lifecycle
Discover, author, deploy, and run agent flows through the AIDP REST `AgentFlows` API via
`oci raw-request`. No MCP and no `ai-data-engineer-agent` repo are required.
> **CLI gap (no invented commands):** the official `aidp` CLI v1.0.0 has **no** agent-flow group (the
> Python SDK ships `agent_flow` models only). Agent-flow CRUD / deploy / run / sessions / guardrails all
> stay on the **REST API (LA `20240831`, may be unprovisioned)**. Do not assume an `aidp agent-flow`
> command exists — see [references/aidp-cli-map.md](../../references/aidp-cli-map.md).
> **LA + verify-first (no-fabrication):** AgentFlows is **Limited Availability** on `20240831` (not in the
> GA `aiwap/` docs but still active). **Path is workspace-scoped:** `…/dataLakes/<ocid>/workspaces/<ws>/agentFlows`
> returned **200** live (2026-06-10, the test tenancy); the *lake-level* `…/dataLakes/<ocid>/agentFlows` (no
> workspace) **404s** — that earlier 404 was the wrong path, not necessarily missing provisioning. Still
> confirm the route with a live read before any write (provisioning can vary by tenancy), and record results
> in `references/rest-endpoint-map.md`. Frame the whole lifecycle as LA, not GA.
## When to use
- "List/show agent flows" (read). "Create/update/deploy/run a flow", "manage flow sessions/guardrails",
"attach compute to a flow" (write).
- "Connect my flow/agent to a remote MCP server / OAC MCP / ADW Select AI MCP / an MCP tool" → add an
`MCP_TOOL` node (see the Native MCP Client Support section below).
## Auth + base URL
Use the auth ladder and base URL in [references/oci-raw-request.md](../../references/oci-raw-request.md):
`https://aidp.<region>.oci.oraclecloud.com/20240831/dataLakes/<dataLakeOcid>/…`, `--profile DEFAULT`
(api_key); on 401/403/"Security Token" refresh `AIDP_SESSION` and retry with `--auth security_token`.
## Read / discover (REST — primary)
- `GET …/workspaces/<ws>/agentFlows` — enumerate flows (**workspace-scoped**; live **200** on the test tenancy
2026-06-10). `GET …/workspaces/<ws>/agentFlows/<key>` — flow detail for authoring.
- A **404** usually means you dropped the `…/workspaces/<ws>/` segment (the lake-level `…/agentFlows`
doesn't exist) — re-check the path first; if the workspace-scoped path also 404s, AgentFlows isn't
provisioned in this tenancy (see note above) — surface that rather than assuming the flow is missing.
- *Optional accelerator:* if an `aidp` MCP happens to be configured, `list_agent_flows` is a convenience
read over the same control-plane. It is **not required** and not the primary path.
## Write (REST, LA `20240831`, via `oci raw-request`)
All flow/session paths are **workspace-scoped** (`…/dataLakes/<ocid>/workspaces/<ws>/…`); guardrails are lake-scoped.
- `…/workspaces/<ws>/agentFlows` (create / get / update / delete); `…/agentFlows/<key>/permissions`,
`…/agentFlows/<key>/sessionMetrics`. Validate the definition before deploy.
- **Deploy is a workspace action:** `POST …/workspaces/<ws>/actions/deployAgentFlow` (and
`…/actions/redeployAgentFlow`) — async (`202` + operation key); attach AI compute in the body.
- `…/workspaces/<ws>/agentFlowSessions` (create / run sessions); `…/agentFlowSessions/<key>/chatHistory`,
`…/agentFlowSessions/<key>/traces/<traceKey>`.
- `…/agentFlowGuardrails` — **lake-scoped** (`…/dataLakes/<ocid>/agentFlowGuardrails`, not under a workspace).
## Attach a remote MCP server to a flow — Native MCP Client Support (LA)
AIDP's LA **Native MCP Client Support** lets a flow call **out** to a remote MCP server (OAC `/api/mcp`,
ADW Select AI MCP, OIC, or any MCP-compatible service) by adding an **`MCP_TOOL` node** to the flow.
AIDP is the **client** here — it does **not** host an MCP server (all standalone `/mcp` endpoints 404).
This is distinct from the optional **local-stdio `aidp` MCP** that can back this plugin's skills
(see [references/mcp-tool-map.md](../../references/mcp-tool-map.md)) — different thing, different direction.
> **Verified live 2026-06-10:** `GET …/workspaces/<ws>/agentFlows` → **200** on the the test tenancy tenancy
> (IAD). That `agentFlows` collection is the surface that holds `MCP_TOOL` nodes; there is no separate
> `/mcp` path. Provisioning still varies by tenancy (a prior env returned 404 — see the LA note above), so
> read first.
**`MCP_TOOL` node shape** (official SDK `CreateMcpToolNodeDetails` → wire JSON; lives in the flow's node graph):
```json
{
"type": "MCP_TOOL",
"name": "oac-mcp",
"description": "Read KPIs from OAC via MCP",
"positionX": 0, "positionY": 0,
"toolConfig": {
"endpoint": "https://<oac-host>/api/mcp",
"auth": { "authType": "OAUTH" },
"allowedTools": [
{ "instruction": "use for KPI lookups", "argOverrides": {}, "tool": { "__": "McpToolObject from the fetch step" } }
],
"customHeaders": {}
},
"toolKey": null, "inputSchema": {}, "configuration": {}
}
```
- **`toolConfig.endpoint`** — the remote MCP URL to connect to *(verified field)*.
- **`toolConfig.auth.authType`** ∈ **`NO_AUTH` · `BEARER_TOKEN` · `OAUTH` · `OCI_RESOURCE_PRINCIPAL`**
*(verified enum)*. For `BEARER_TOKEN`, carry the token via `customHeaders`
(`{"Authorization":"Bearer <…>"}`) or the matching auth subtype — **confirm the exact per-auth credential
fields against the live API / SDK auth subtype before authoring; never inline a secret into a committed file**
(prefer the credential store — see `aidp-credentials`).
- **`toolConfig.allowedTools[]`** — restrict which remote tools the flow may call:
`{ instruction, argOverrides, tool }` *(verified shape)*.
- **`toolConfig.customHeaders`** — extra request headers (`dict[str,str]`).
**Introspect + test the remote MCP first** (bind real tool names, not guesses):
- **Fetch the MCP's objects** — `FetchMcpObjectsDetails { agentFlowId, type ("Tool"|"prompt"|"resource"),
mcpTool, limit, page, paramValues }` → lists the tools/prompts/resources the remote MCP exposes; use the
returned `McpToolObject`s to populate `allowedTools`.
- **Test connection / a tool** — `TestMcpConnection` / `TestMcpExternalTool { testType, externalToolName,
paramValues }` before deploy.
**Author it** (REST via `oci raw-request`, LA `20240831`): create/update the flow with the `MCP_TOOL` node in
its node list at `…/workspaces/<ws>/agentFlows[/<key>]`, `validate`, then deploy per the Workflow below.
Persist the node payload to `.aidp/payloads/` and confirm first.
> **Verify-first (no-fabrication):** the `toolConfig` / `auth` / `allowedTools` field **names** above are
> from the official SDK models (`CreateMcpToolNodeDetails`, `McpToolConfiguration`, `Auth`,
> `AllowedToolDetails`) — confirmed. The full flow node-graph wrapper and the per-`authType` credential
> fields should be confirmed by round-tripping an existing flow (`GET …/agentFlows/<key>`) before a first
> write, and recorded in `rest-endpoint-map.md`.
## Publish a flow as an A2A agent (agent card) — outbound discovery (LA)
A2A publishing exposes a **deployed** flow as an agent that **external** agents can discover and call. This is
the **outbound-publishing** direction and is distinct from the two MCP/agent directions above:
| Mechanism | Direction | Role |
|---|---|---|
| `EXTERNAL_AGENT` node | **inbound** — your flow calls another agent | flow is the caller |
| `MCP_TOOL` node | **outbound** — your flow connects out to a remote MCP server | flow is an MCP **client** |
| **Agent card (A2A)** | **outbound publishing** — external agents discover + call your flow | flow is the **published agent** |
**Set it on the flow body**, not as a node: the create/update flow body carries a top-level
`agentCardConfig` field (wire `agentCardConfig`, type `AgentCardConfigDetail` — confirmed on
`create_agent_flow_details.py:99`, `update_agent_flow_details.py:97`, and read back on `agent_flow.py:186`).
**`AgentCardConfigDetail`** (verified wire fields — `agent_card_config_detail.py:60-68`):
```json
{
"agentCardConfig": {
"name": "supplier-spend-agent",
"description": "Answers supplier-spend questions over the gold lakehouse",
"version": "1.0.0",
"documentationUrl": "https://…",
"capabilities": { "isStreaming": true },
"provider": { "organization": "Oracle", "url": "https://…" },
"skills": [
{ "id": "spend_lookup", "name": "Supplier spend lookup",
"description": "Returns spend by supplier", "tags": ["finance"], "examples": ["top 10 suppliers by spend"] }
]
}
}
```
| Field | Wire | Type / shape |
|---|---|---|
| `name` *(required)* | `name` | str — human-readable agent name |
| `description` | `description` | str |
| `skills[]` | `skills` | `AgentCardSkillDetail { id*, name*, description, tags[], examples[] }` (`agent_card_skill_detail.py:50-56`) |
| `capabilities` | `capabilities` | `AgentCardCapabilitiesDetail { isStreaming }` bool (`agent_card_capabilities_detail.py:30-32`) |
| `version` | `version` | str |
| `provider` | `provider` | `AgentProvider { organization, url }` (`agent_provider.py:35-38`) |
| `documentationUrl` | `documentationUrl` | str |
**Preview the generated card before publishing** — the SDK exposes a preview action:
`PreviewAgentFlowAgentCardDetails { agentCardConfigDetails: AgentCardConfigDetail }` →
`AgentCardPreviewResponse { agentCardJson }` (a JSON-string A2A AgentCard)
(`preview_agent_flow_agent_card_details.py:30-34`, `agent_card_preview_response.py:30-32`). Use this to inspect the
exact A2A card the platform will publish before committing the flow update.
**Author it** (REST via `oci raw-request`, LA `20240831`): set `agentCardConfig` on the create/update flow body at
`…/workspaces/<ws>/agentFlows[/<key>]`, then deploy per the Workflow below (a card describes a **deployed** flow).
Persist the body to `.aidp/payloads/` and confirm first.
> **CLI gap + verify-first (no-fabrication):** the `agentCardConfig` field and all child field **names/types** above
> are from the SDK models cited inline — confirmed. There is **no** `aidp` CLI agent-card command (the v1.0.0 CLI
> README has no agent-card/a2a verb). The exact create/update **wrapper** (whether `agentCardConfig` rides inside
> `CreateAgentFlowDetails`/`UpdateAgentFlowDetails` as shown vs. a dedicated publish action) and the **route** that
> serves the published card to external agents are **verify-first** — confirm against a live
> `GET …/workspaces/<ws>/agentFlows/<key>` round-trip and record in `rest-endpoint-map.md` before a first write.
## Node types
A flow is a node graph; the 13 node types (START / AGENT / SUPERVISOR_AGENT / NESTED_AGENT_FLOW /
EXTERNAL_AGENT / HUMAN_IN_THE_LOOP / GUARDRAILS / SQL_TOOL / PROMPT_TOOL / RAG_TOOL / MCP_TOOL / HTTP_TOOL /
CUSTOM_TOOL) and their config shapes are enumerated in
[references/agent-flow-nodes.md](../../references/agent-flow-nodes.md). A tool node can inline its `toolConfig`
or reference a reusable standalone Tool by `toolKey` (`aidp-tools`).
## Author guardrails (safety policies) — LA
Guardrails are **lake-scoped** (`…/dataLakes/<ocid>/agentFlowGuardrails`, **live 200** 2026-06-10) and attach
to a flow as a `GUARDRAILS` node.
> **Defaults already there:** every fresh DataLake auto-provisions **5 default guardrail policies**, so a
> `GET …/agentFlowGuardrails` on a new instance returns 5 items (not 0). The defaults (verified 2026-06-12):
> | `policyType` | `scope` | `action` |
> |---|---|---|
> | `CONTENT_MODERATION` | `USER_REQUEST` | `BLOCK` |
> | `CONTENT_MODERATION` | `AGENT_RESPONSE` | `BLOCK` |
> | `PROMPT_ATTACKS_PREVENTION` | `USER_REQUEST` | `BLOCK` |
> | `PII_DETECTION` | `AGENT_RESPONSE` | `INFORM` |
> | `PII_DETECTION` | `USER_REQUEST` | `INFORM` |
> These are a security-first baseline — don't mistake them for leftover/test data, and account for them when
> diffing or round-tripping guardrails.
A `SafetyPolicy` (verified enums):
```json
{ "policyType": "PII_DETECTION", "policyName": "block_pii", "policyDescription": "…",
"scope": "BOTH", "action": "BLOCK", "threshold": 0.8 }
```
- `policyType` ∈ `CONTENT_MODERATION` · `PROMPT_ATTACKS_PREVENTION` · `PII_DETECTION` · `DENIED_TOPICS` ·
`WORD_FILTERS` · `CONTEXTUAL_GROUNDING` · `CUSTOM_POLICY`
- `scope` ∈ `USER_REQUEST` · `AGENT_RESPONSE` · `BOTH` · `action` ∈ `BLOCK` · `INFORM` · `MASK` · `threshold` float
**Per-`policyType` config (subtype models extend the base `SafetyPolicy`)** — each subtype carries the base
six fields above **plus** the extra child fields below. The 5 subtype models are `ContentModerationPolicy`,
`PromptAttacksPreventionPolicy`, `PiiDetectionPolicy`, `DeniedTopicsPolicy`, `WordFiltersPolicy` (`CONTEXTUAL_GROUNDING`
and `CUSTOM_POLICY` are base-only — no extra fields confirmed in the SDK):
| `policyType` (subtype model) | Extra wire fields | Element shape (child model) |
|---|---|---|
| `CONTENT_MODERATION` (`ContentModerationPolicy`) | `categories[]` | `ContentModerationCategoryConfig { category, isEnabled, threshold, action }` — `category` ∈ `HATE_SPEECH`·`HARASSMENT`·`VIOLENCE`·`SEXUAL`·`DEROGATORY`·`TOXIC`; `action` ∈ `BLOCK`·`INFORM`·`MASK` |
| `PROMPT_ATTACKS_PREVENTION` (`PromptAttacksPreventionPolicy`) | *(none — base fields only)* | — |
| `PII_DETECTION` (`PiiDetectionPolicy`) | `piiCategories[]`, `customPiiRules[]` | `PiiCategory { category, isEnabled, action, threshold }` — `category` ∈ `PERSON`·`ADDRESS`·`TELEPHONE_NUMBER`·`EMAIL`; `action` ∈ `BLOCK`·`INFORM`·`MASK`. `CustomPiiRule { name, pattern, prefix, suffix, isCaseSensitive, maxDistance, priority }` |
| `DENIED_TOPICS` (`DeniedTopicsPolicy`) | `topics[]` | `DeniedTopic { name, definition, examples[] }` |
| `WORD_FILTERS` (`WordFiltersPolicy`) | `words[]`, `regexPatterns[]` | both `list[str]` |
Example PII policy with a custom rule (base fields + child fields):
```json
{ "policyType": "PII_DETECTION", "policyName": "mask_pii", "scope": "BOTH", "action": "MASK", "threshold": 0.8,
"piiCategories": [ { "category": "EMAIL", "isEnabled": true, "action": "MASK", "threshold": 0.7 } ],
"customPiiRules": [ { "name": "emp_id", "pattern": "EMP-\\d{6}", "isCaseSensitive": false, "priority": 1 } ] }
```
Field **names/enums** above are from the SDK subtype + child models (`content_moderation_policy.py:64-71`,
`content_moderation_category_config.py:83-88`, `prompt_attacks_prevention_policy.py:59-66`,
`pii_detection_policy.py:69-78`, `pii_category.py:75-80`, `custom_pii_rule.py:60-68`, `denied_topics_policy.py:64-72`,
`denied_topic.py:40-44`, `word_filters_policy.py:69-78`) — confirmed. The discriminator/wrapper used to POST these
to `…/agentFlowGuardrails` (and whether subtypes nest under a `policies[]` array) should be confirmed by
round-tripping a live `GET …/agentFlowGuardrails` before a first write, and recorded in `rest-endpoint-map.md`.
High-code agents pass the same policies via `OCIAIConf(guardrails_config=…)` (`aidp-agent-highcode`).
## Workflow
1. **Discover** with `GET …/workspaces/<ws>/agentFlows`; **verify** the route with this read before any write
(handle the LA 404 — check the workspace segment first). For a specific flow, `GET …/workspaces/<ws>/agentFlows/<key>`.
2. **Author**: create/update the flow definition; `validate` before deploy.
3. **Deploy**: create a deployment, attach AI compute; deploy is async (`202` + operation key) — poll to
terminal via `aidp-observability` / the async-ops endpoint per `oci-raw-request.md`.
4. **Run/monitor**: create a session, run it, read traces / chat history.
5. Confirm before deploy/delete (deployment consumes compute).
## Guardrails
- Deploy/delete are heavy/outward — confirm first. Don't print any embedded secrets in a flow definition.
- No-fabrication: don't present an `agentFlows` endpoint as confirmed until a live 2xx (or documented 4xx)
is recorded in `rest-endpoint-map.md`.
- For mutating ops (create / update / delete / deploy / run a flow or session), persist the request body to
`.aidp/payloads/` and confirm first — see [references/payloads.md](../../references/payloads.md).
## References
- [references/aidp-cli-map.md](../../references/aidp-cli-map.md) — official `aidp` CLI v1.0.0 has no agent-flow group
- [references/oci-raw-request.md](../../references/oci-raw-request.md) · [references/rest-endpoint-map.md](../../references/rest-endpoint-map.md) · [references/no-mcp-rest-map.md](../../references/no-mcp-rest-map.md)
- [references/payloads.md](../../references/payloads.md) — persist + confirm request bodies for mutating ops
## skills/aidp-agent-highcode/SKILL.md
---
name: aidp-agent-highcode
description: Build AIDP agents in high-code Python with aidputils + LangGraph (the code-first alternative to the low-code agent-flow canvas). Use when the user wants to write an agent in Python, use LangGraph / create_react_agent / StateGraph, call aidputils (OCIAIConf, AIDPToolConf, init_oci_llm, create_langgraph_tool), build a custom or multi-agent supervisor flow in code, or asks "how do I code an AIDP agent". For the low-code/REST node-graph path use aidp-agent-flows.
---
# `aidp-agent-highcode` — code-first AIDP agents (aidputils + LangGraph)
The GA high-code path: write a Python agent class using **`aidputils`** (pre-installed in AI Compute;
**not** `pip`-installable locally; legacy name `aidp_flowutils`) on top of **LangGraph 1.x**. You author the
`.py` in the workspace (`aidp-workspace-files` / `aidp-notebooks`) and run it on AI Compute. Grounded in
AIDP_High_Code_Complete_Reference.md §4–12, §22.
## When to use
- "Write/code an AIDP agent", LangGraph, `create_react_agent`, `StateGraph`, custom tool logic, multi-agent
supervisor in code, or anything `aidputils`.
- NOT the drag-and-drop / REST node graph → `aidp-agent-flows`. NOT building the RAG corpus → `aidp-knowledge-bases`.
## Imports (current `aidputils`; legacy `aidp_flowutils` still works)
```python
from aidputils.agents.toolkit.tool_helper import create_langgraph_tool
from aidputils.agents.toolkit.agent_helper import init_oci_llm, pre_invoke_setup
from aidputils.agents.toolkit.configs import AIDPToolConf, OCIAIConf, ModelArgs
from langgraph.prebuilt import create_react_agent
from langgraph.graph import StateGraph, MessagesState, START, END
from langchain_core.messages import HumanMessage
```
## The agent class contract (REQUIRED)
Every agent MUST implement `__init__` / `setup()` / `async invoke()`:
```python
class MyAgent:
def __init__(self) -> None:
self.agent = None # or self.graph = None
def setup(self) -> None: # sync, called once: build LLM + tools + agent
llm = init_oci_llm(OCIAIConf(
model_provider="generic", model_id="xai.grok-4",
compartment_id="ocid1.compartment.oc1..…",
endpoint="https://inference.generativeai.us-ashburn-1.oci.oraclecloud.com",
model_args=ModelArgs(temperature=0.7, max_tokens=4096),
guardrails_config={"policies": []}, auth_type="SECURITY_TOKEN", auth_profile="DEFAULT"))
# an empty policy list means no guardrails; add policies before production use
tool = create_langgraph_tool(AIDPToolConf(
name="summarizer", description="Summarize text",
tool_class="PromptTool", # or "SQLTool" / "RAGTool"
conf={...}, params=[{"name":"text","type":"string","description":"…"}]).model_dump())
self.agent = create_react_agent(llm, [tool]) # single-agent; StateGraph for multi-agent
async def invoke(self, user_query: str, **kwargs):
config = pre_invoke_setup(**kwargs) # MUST be first line of every invoke
message = {"messages": [dict(HumanMessage(content=user_query))]}
return await self.agent.ainvoke(input=message, config=config)
```
Rules (HC ref §5): `setup()` is **synchronous**, runs once; `invoke()` is **async**, per query;
**`pre_invoke_setup(**kwargs)` must be the first call in `invoke()`**; input is always
`{"messages": [dict(HumanMessage(content=…))]}`.
## Building blocks
| Piece | API | Notes |
|---|---|---|
| LLM | `OCIAIConf(model_provider, model_id, compartment_id, endpoint, model_args, guardrails_config, auth_type, auth_profile)` → `init_oci_llm()` | Models: `xai.grok-4` (default), `xai.grok-4-fast-reasoning`, `cohere.command-r-08-2024` |
| Tools | `AIDPToolConf(name, description, tool_class, conf, params)` → `create_langgraph_tool(.model_dump())` | `tool_class` ∈ `PromptTool` / `SQLTool` / `RAGTool` (RAGTool needs a KB → `aidp-knowledge-bases`) |
| Single agent | `create_react_agent(llm, tools)` | LangGraph prebuilt |
| Multi-agent | `StateGraph(MessagesState)` + supervisor (HC ref §10) | nodes + `START`/`END` edges |
| Observability | `AIDPObservability` (HC ref §12) | tracing |
## Deploy
Place the agent `.py` in the workspace and designate the **entry file** + dependency files (HC ref §22),
then run/deploy on **AI Compute** (Preview — see `aidp-cluster-ops`). Deployment + sessions can also be
managed via the agent-flow deploy action (`aidp-agent-flows`).
> **Live-verified 2026-06-10 on de-agent — correction:** the agent-flow deploy action is gated and has a
> required-field contract. (1) The ENTIRE `agentFlows` write surface (create included) is gated on the
> DataLake's `aiFeatureStatus=Ready` — on a fresh datalake, create returns **409 IncorrectState
> `AiFeatureStatus=None`** ("try again later") until the Enable-AI-Feature workflow completes; this is a
> platform-provisioning state, not a body defect. (2) `POST …/actions/deployAgentFlow` requires a
> **`deploymentType`** enum (the `agentFlowKey` alone → 400 "deploymentType must not be null"); the valid value
> is NOT `AI_COMPUTE`/`SERVERLESS`/`DEDICATED`/`ON_DEMAND`/`QUICK_START`/`STANDARD`/`DEFAULT` (all 400 "Invalid
> DeploymentType") — pull the real enum from the SDK `DeploymentType`/`Deployment` models before deploying.
## Guardrails
- `aidputils` only exists inside AI Compute — examples are authored/edited via `aidp-workspace-files`, not run
locally. Don't claim a local `pip install aidputils`.
- Don't fabricate `model_id`s/endpoints — list live via `aidp-models-catalog`. Attach safety policies via
`guardrails_config` (enums in `aidp-agent-flows` guardrails section).
## References
- [aidp-agent-flows](../aidp-agent-flows/SKILL.md) (low-code/REST path + guardrail enums) · [aidp-knowledge-bases](../aidp-knowledge-bases/SKILL.md) (RAGTool corpus) · [aidp-tools](../aidp-tools/SKILL.md) (standalone tools) · [aidp-workspace-files](../aidp-workspace-files/SKILL.md) (author the .py) · [aidp-models-catalog](../aidp-models-catalog/SKILL.md)
## skills/aidp-ai-sql/SKILL.md
---
name: aidp-ai-sql
description: Run LLM functions inside Spark SQL on AIDP via ai_generate(). Use when the user wants to summarize/classify/extract/enrich rows with an LLM directly in SQL, generate narratives over aggregated results, or do grounded RAG-style analysis in the lakehouse. Signature is model-first; available models must be confirmed live before relying on it.
---
# `aidp-ai-sql` — LLM-in-SQL with `ai_generate()`
Call an LLM directly inside Spark SQL on AIDP — summarize, classify, extract, or narrate over lakehouse
data without leaving SQL. A signature differentiator: most competitor agents can't do this inline.
This is a **SQL-helper** skill. Interactive Spark SQL runs through the bundled helper
`scripts/aidp_sql.py` (it mints a UPST from the api_key DEFAULT profile, auto-creates a scratch notebook,
and returns JSON). No aidp MCP and no AIDP_SESSION required.
## When to use
- "Summarize / classify / extract / enrich these rows with AI in SQL."
- Generate a grounded narrative over an aggregate (e.g. a finance summary over a spend rollup).
## Signature (model FIRST)
```sql
ai_generate('<model>', '<prompt>')
```
e.g. `ai_generate('openai.gpt-5.4', 'Summarize this supplier spend: ...')`.
**LIVE-VERIFIED** model-first `(model, prompt)` signature with `openai.gpt-5.4`, `openai.gpt-4o`, and
`xai.grok-4`.
> **Verify before relying on it (no-fabrication):** confirm the exact signature and the **available model
> names** live on the target cluster before treating this as guaranteed — run a trivial
> `SELECT ai_generate('<model>', 'hello')` cell first (see smoke test below). Model availability varies
> by environment. If a model name fails, list/ask for the correct one rather than guessing.
>
> **Don't gate on the `/models` REST catalog.** `ai_generate` resolves the model at the Spark engine level,
> so it can work even when `aidp-models-catalog`'s `GET /models?modelType=GENERATIVE_AI` returns an empty
> list. The smoke test (not the catalog endpoint) is the source of truth for whether `ai_generate` works.
## How to run a cell
```bash
python "$PLUGIN_DIR/scripts/aidp_sql.py" \
--region <region> --datalake <DATALAKE_OCID> --workspace <ws> --cluster <cluster-key> \
--code "<python/spark code>"
```
Returns JSON: `{"status":"ok|error","outputs":[...],"spark_job_ids":[...]}`. Exit 0 on success, 1 on
cell error. See [scripts/aidp_sql.py](../../scripts/aidp_sql.py) for full flags (`--profile`,
`--session-profile`, `--notebook`, `--timeout`).
### Smoke test (do this first)
```bash
python "$PLUGIN_DIR/scripts/aidp_sql.py" --region <region> --datalake <ocid> --workspace <ws> --cluster <key> \
--code "spark.sql(\"SELECT ai_generate('openai.gpt-5.4', 'hello')\").show(truncate=False)"
```
## Workflow (grounded RAG pattern)
1. Ensure cluster RUNNING (cluster-ops via `oci raw-request`; see `references/no-mcp-rest-map.md`).
2. **Ground first:** aggregate/select the rows you want the LLM to reason over (small, relevant set).
3. Embed that grounded context into the prompt and call `ai_generate('<model>', '<grounded prompt>')`.
For per-row enrichment, call it as a column expression over a bounded set.
4. Present the generated text alongside the underlying data so the user can verify it.
Pass the cell to `--code`:
```python
ctx = spark.sql("SELECT ... FROM gold.supplier_spend ...").toPandas().to_string()
res = spark.sql(f"SELECT ai_generate('openai.gpt-5.4', 'As a finance analyst, summarize: {ctx}') AS summary")
res.show(truncate=False)
```
## Reliability rules
- Always ground the prompt in real query output — don't ask the model to recall data it can't see.
- Bound row counts for per-row `ai_generate` (cost + latency).
- Show the data behind any AI narrative; never present generated numbers as ground truth without the SQL.
## References
- [scripts/aidp_sql.py](../../scripts/aidp_sql.py) — the SQL/notebook-cell executor (bundled helper)
- [references/oci-raw-request.md](../../references/oci-raw-request.md) — REST control-plane (clusters, auth)
- [references/no-mcp-rest-map.md](../../references/no-mcp-rest-map.md) · pairs with `aidp-analyzing-data`
## skills/aidp-analyzing-data/SKILL.md
---
name: aidp-analyzing-data
description: Answer business questions over the AIDP lakehouse with Spark SQL. Use when the user asks a data question ("how many…", "top N…", "show me…", "trend of…", "revenue by…") or wants to run ad-hoc Spark SQL. Grounds in .aidp/catalog.md + .aidp/semantic.md and reuses validated verified queries before generating SQL, then executes via the bundled aidp_sql.py helper.
---
# `aidp-analyzing-data` — natural language → Spark SQL
Answer business questions by grounding in the catalog/semantic model, reusing ve