This article follows the official documentation. We haven’t tested this tool for a hands-on review.
When you give a coding agent shell access in Oracle Cloud Infrastructure (OCI), the agent can use the OCI Command Line Interface (CLI) to inspect cloud resources and return results. Oracle’s Python-based command-line tool lets the agent work with OCI services. The agent does not need a special integration. It runs oci commands with the credentials and permissions available in its environment.
For example, an agent can ask OCI to list compute instances in a compartment, then summarize their names and states. OCI returns the list without changing cloud resources. To set this up, install the CLI. Configure authentication outside the agent prompt, then give the credentials only the access the task needs.
What an agent can do
The CLI exposes commands for OCI services and returns JSON by default. An agent can use that output directly or narrow it with a JMESPath query, a short expression that selects specific fields from JSON. The OCI CLI documentation describes which OCI services the CLI supports and how it relates to the OCI software development kit (SDK) for Python.
Shell commands work well for tasks with a clear scope, such as checking instance states, finding resource identifiers, or reviewing configuration before a change. The CLI also has commands that create or update resources. The command determines what the agent asks OCI to do, and the credentials’ permissions determine which actions OCI allows.
Install and authenticate
Oracle supports the CLI on macOS, Windows, and Linux when you use a supported Python version. Use Oracle’s official installation instructions for the operating system and Python environment where the agent will run.
To configure a user profile, run:
oci setup config
The setup command walks you through creating a configuration file and a pair of API signing keys. OCI uses the private key to sign API requests, and you register the matching public key with your OCI user. That user also needs an OCI policy specifying which actions they may take. Oracle’s CLI overview describes these account, key, and permission requirements.
Keep the private key in a protected file that the agent’s shell environment can access. Do not paste the key or other credentials into the agent prompt. The CLI can use an existing profile, a set of saved connection settings. Before asking the agent to run a command, check that the profile points to the intended account and region.
List instances in a compartment
This example asks OCI for compute instances in one compartment and returns each instance’s name, lifecycle state, and OCID. An OCID is OCI’s unique identifier for a resource.
Set the placeholder to a real compartment OCID before running the command:
export COMPARTMENT_OCID='<compartment-ocid>'
oci compute instance list \
--compartment-id "$COMPARTMENT_OCID" \
--all \
--query 'data[].{name:"display-name",state:"lifecycle-state",id:id}'
The command asks OCI for a list without changing resources. --all tells the CLI to retrieve every page of results. --query selects the three named fields from the JSON response. The result is JSON, and the command does not create, stop, or modify instances. The OCI CLI command reference shows the CLI’s list-command style and options.
OCI returns only resources that the configured user can see in the selected region. The user’s policy must allow listing instances in the compartment. If the result is empty, check the compartment OCID, the region in the profile, and the user’s access before concluding that no instances exist.
A realistic agent prompt is: “Use the configured OCI CLI profile to list instances in this compartment using the read-only command. Summarize the returned names and lifecycle states. Do not run commands that create, update, or delete resources.”
Limits to account for
A coding agent has the authority of the credentials it uses with the CLI. If the profile grants broad permissions, the agent can run shell commands for a wider range of cloud actions, including write operations. For an inventory task, use credentials whose OCI policy allows the required reads but does not grant unrelated access.
Oracle documents the CLI as a command-line interface. It does not provide a built-in coding-agent connector. The agent needs shell access to the machine where the CLI and profile are configured. The selected profile, region, and OCI permissions determine which resources the agent sees, so its results may not include every resource in a tenancy.