Define an Agent

This page explains how to define an Agent, resolve its component references, write its instructions, and understand its execution boundaries. For the execution model and advantages, see Agents.

Agent Fields

Field Requirement Description
component_type Required Identifies this component as an Agent.
id Required Uniquely identifies the Agent for symbolic references.
name Required Provides a human-readable component name.
llm_config Required Identifies the supported LLM configuration used for model invocations.
system_prompt Required Defines the Agent’s role, task, and behavioral instructions.
inputs Optional Declares the named, typed values accepted by the Agent.
outputs Optional Declares the named, typed values produced by the Agent.
tools Optional References individual tools available during model-and-tool rounds.
toolboxes Optional References collections of tools available to the Agent, where supported.
human_in_the_loop Optional Configures supported human participation during execution.
$referenced_components Optional Contains component definitions resolved by symbolic references.

Order-Support Agent Definition

The following Agent answers order questions using one LLM configuration and two tools:

Tool Input Result
lookup_order order_id Current order status and delivery information.
check_return_eligibility order_id Return eligibility and the applicable return window.

The Agent accepts a customer request and returns a response:

Direction Name Type
Input request string
Output response string

Create the Example Tools

Connect as APP_SCHEMA and run the following script to create the synthetic procedures referenced by the Agent. These procedures return demonstration values and do not query an orders table.

CREATE OR REPLACE PACKAGE ORDER_TOOLS AS
  PROCEDURE LOOKUP_ORDER(
    order_id           IN  VARCHAR2,
    order_status       OUT VARCHAR2,
    estimated_delivery OUT VARCHAR2
  );

  PROCEDURE CHECK_RETURN_ELIGIBILITY(
    order_id           IN  VARCHAR2,
    return_eligible    OUT BOOLEAN,
    return_window_days OUT NUMBER
  );
END ORDER_TOOLS;
/

CREATE OR REPLACE PACKAGE BODY ORDER_TOOLS AS
  PROCEDURE LOOKUP_ORDER(
    order_id           IN  VARCHAR2,
    order_status       OUT VARCHAR2,
    estimated_delivery OUT VARCHAR2
  ) IS
  BEGIN
    order_status := 'OUT_FOR_DELIVERY';
    estimated_delivery := '2026-11-12';
  END LOOKUP_ORDER;

  PROCEDURE CHECK_RETURN_ELIGIBILITY(
    order_id           IN  VARCHAR2,
    return_eligible    OUT BOOLEAN,
    return_window_days OUT NUMBER
  ) IS
  BEGIN
    return_eligible := TRUE;
    return_window_days := 30;
  END CHECK_RETURN_ELIGIBILITY;
END ORDER_TOOLS;
/

Agent Definiton

The following Agent references the procedures in APP_SCHEMA.ORDER_TOOLS.

{
  "component_type": "Agent",
  "agentspec_version": "26.1.0",
  "id": "order-support-agent",
  "name": "order_support_agent",
  "inputs": [
    {
      "title": "request",
      "type": "string"
    }
  ],
  "outputs": [
    {
      "title": "response",
      "type": "string"
    }
  ],
  "llm_config": {
    "component_type": "DbmsVectorChainLlmConfig",
    "id": "application-llm-config",
    "name": "application_llm_config",
    "provider": "openai",
    "url": "https://api.openai.com/v1/chat/completions",
    "model": "gpt-4.1-mini",
    "credential_name": "AI_PROVIDER_CREDENTIAL"
  },
  "system_prompt": "Answer order-support questions using the tools available to you. Do not infer order status or return eligibility without using the applicable tool. Request: {{request}}",
  "tools": [
    {
      "$component_ref": "lookup-orders-tool"
    },
    {
      "$component_ref": "check-return-eligibility-tool"
    }
  ],
  "$referenced_components": {
    "lookup-orders-tool": {
      "component_type": "BuiltinTool",
      "id": "lookup-orders-tool",
      "name": "lookup_order",
      "description": "Return the current status and estimated delivery date for an order.",
      "inputs": [
        {
          "title": "order_id",
          "type": "string"
        }
      ],
      "outputs": [
        {
          "title": "order_status",
          "type": "string"
        },
        {
          "title": "estimated_delivery",
          "type": "string"
        }
      ],
      "executor_name": "Oracle In-DB Agent Executor",
      "tool_type": "plsql_exec",
      "configuration": {
        "schema_name": "APP_SCHEMA",
        "package_name": "ORDER_TOOLS",
        "procedure_name": "LOOKUP_ORDER"
      }
    },
    "check-return-eligibility-tool": {
      "component_type": "BuiltinTool",
      "id": "check-return-eligibility-tool",
      "name": "check_return_eligibility",
      "description": "Determine whether an order is eligible for return and provide the return window.",
      "inputs": [
        {
          "title": "order_id",
          "type": "string"
        }
      ],
      "outputs": [
        {
          "title": "return_eligible",
          "type": "boolean"
        },
        {
          "title": "return_window_days",
          "type": "integer"
        }
      ],
      "executor_name": "Oracle In-DB Agent Executor",
      "tool_type": "plsql_exec",
      "configuration": {
        "schema_name": "APP_SCHEMA",
        "package_name": "ORDER_TOOLS",
        "procedure_name": "CHECK_RETURN_ELIGIBILITY"
      }
    }
  }
}

This definition includes the Agent and every component referenced directly by it. The LLM configuration and tools remain separate component definitions, but they are contained in the Agent’s $referenced_components collection.

For each symbolic reference, the $component_ref value, the $referenced_components key, and the referenced component’s id match exactly. For example, all three values for the order-lookup tool are lookup-orders-tool.

The script above creates the PL/SQL procedures referenced by this Agent. Before running the Agent, configure model access and replace the example provider, URL, model, and credential name with values supported by your environment. This example does not include the calls to register and execute the Agent.

Write Agent Instructions

The system_prompt field defines the Agent’s task and behavioral instructions. It can contain literal instructions and template variables that reference named Agent inputs. A variable such as {{request}} resolves to the value of the Agent input whose title is request.

The example system prompt defines the Agent’s task and describes when factual order information requires a tool:

Answer order-support questions using the tools available to you. Do not infer order status or return eligibility without using the applicable tool.

These instructions establish that:

The prompt can incorporate the Agent’s request input explicitly:

Answer the following order-support request using the tools available to you: {{request}}

Do not infer order status or return eligibility without using the applicable tool.

Template variable names are case-sensitive and must match the corresponding Agent input titles.

Instructions guide model behavior but do not authorize the underlying operations. Oracle AI Database Agent Engine still validates Tool calls and enforces the privileges, credentials, and network controls that apply to each Tool.

How the Order-Support Agent Executes

For example, the caller supplies:

Where is order 7812, and can I return it when it arrives?

One possible execution is:

Description of the illustration AgentComponent-Page-3_1.png

During this execution:

  1. The runtime invokes the model with the Agent instructions, customer request, and descriptions of the two available tools.

  2. The model returns a call to lookup_order.

  3. The runtime resolves the tool, validates order_id, and the Agent invokes the tool.

  4. The order status and delivery date are added to the context for the next model invocation.

  5. The model returns a call to check_return_eligibility.

  6. After validating and invoking the second tool, the runtime adds the eligibility result to the context.

  7. The next model invocation produces the final response, which is mapped to Agent.response.

This sequence is specific to the supplied request. Another request might require one tool, several tool calls, or no tool call.

Runtime Validation and Execution Boundaries

The model determines whether to return a final response or produce a tool call, but the runtime controls what can be executed:

Model output does not grant additional privileges, introduce executable operations, or bypass a tool’s input and output contracts.