> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hypercubic.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# The AI agent

> The first AI agent that understands mainframe. Hopper turns plain English into action across ISPF, JCL, JES, and CICS, reading source, submitting jobs, decoding VSAM records, and writing changes. All from chat.

## The agentic loop

When you give the agent a task, it works through three phases: **gather context**, **take action**, and **verify results**. The agent uses tools throughout: reading a COBOL member, submitting a job, pulling spool, and so on.

The loop adapts to what you ask. A copybook question might end after the first read. A failed batch job cycles through all three phases until you and the agent agree the fix is right. A larger refactor can involve dozens of reads before a single write.

You can interrupt at any point. Type a correction, attach a reference, or ask the agent to try something else; it picks up the new direction on the next turn.

The loop runs on two components: a [model](#model) that reasons and [tools](#tools) that act.

### Model

The agent uses a large language model to read your code and plan changes. It handles COBOL, JCL, REXX, and CLIST, traces how programs and datasets connect, and works out what to edit for the task you described.

Configure the model under **API Key** in the left navigation. See [the quickstart](/quickstart) for currently supported providers.

### Tools

Tools are how the agent does work on the mainframe. It can read members, submit JCL, decode VSAM records, drive the terminal, and interact with CICS. Each tool call returns information the agent uses on the next turn.

The built-in tools fall into six categories.

| Category      | What the agent can do                                                   |
| ------------- | ----------------------------------------------------------------------- |
| **Datasets**  | List, read, write, and allocate sequential datasets, PDSes, and members |
| **Jobs**      | Submit JCL, wait for completion, read spool, classify failures          |
| **Terminal**  | Drive the TN3270 session, read screens, send keystrokes and AID keys    |
| **CICS**      | Sign on, run transactions, install resources, run CEDA defines          |
| **COBOL**     | Compile and run, parse copybooks, decode VSAM records                   |
| **Data taps** | Snapshot VSAM data into a queryable local copy, then run SQL            |

These are the same operations the dataset, job, and terminal panels expose, accessed through chat instead of clicks.

The agent picks tools based on your prompt and what it learns along the way. When you say "fix the failed BILLPROC job," it might:

1. Pull the spool from the failed run
2. Identify the abend code and offending step
3. Read the COBOL source for that step
4. Read the input dataset's first few records
5. Edit the source to handle the bad data
6. Resubmit and watch the job complete

Each tool call gives the agent new information that informs the next step.

## What the agent can access

When you connect to a mainframe, the agent gains access to:

* **Your TSO session.** The same TN3270 session you see in the terminal panel.
* **Your datasets.** Anything your TSO ID has read or write permission for.
* **The JES queue.** Jobs you submit, plus any jobs visible to your owner ID.
* **CICS resources.** If your site runs CICS and you've configured signon credentials.
* **Attached references.** Datasets, members, jobs, and screens you attach with `@` or by clicking from the panels.
* **Conversation history.** Recent turns from the current chat, summarized as the conversation grows.

Because the agent shares your session, it can chain work across subsystems in one turn: pull the spool, read the COBOL source, edit the program, recompile, re-run.

## Conversations

The chat panel holds one conversation at a time. Recent turns stay in the agent's working context as you go.

### Attach references explicitly

The agent treats attached references as ground truth. Three ways to attach:

* **From the datasets panel.** Open a member or PS dataset in the preview, then click the **@** button in the preview header. The reference is added to your next message as `@ACME01.SOURCE.COBOL(CBACT01C)`.
* **From the jobs panel.** Click the **@** button on any row to attach the job as `@JOB04197`.
* **Paste.** Paste a screen, JCL block, spool excerpt, or error message directly into the chat input.

## Approvals

The agent pauses before any action that mutates state on the mainframe.

* **Read-only actions** (list, read, query, view spool) run instantly with no approval.
* **Mutating actions** (write a member, submit a job, install a CICS resource, write a VSAM record) pause for your approval first.

Approve and the action runs. Reject and the agent sees the rejection on the next turn; it usually asks a clarifying question, proposes a smaller change, or stops. See [Tools](/core-concepts/tools) for the full safety model.

## Work effectively with the agent

### It's a conversation

You don't need a perfect prompt. Start with what you want, then refine.

```text theme={null}
What changed in BILLPROC last quarter?
```

```text theme={null}
Show me the diff for the change that touched COMMISSION-CALC.
```

When the first attempt isn't right, type a follow-up. The agent picks up from where you left off.

### Be specific with dataset names

Vague prompts work, but you'll spend more time steering. Specific prompts succeed faster.

Instead of:

```text theme={null}
Look at the master file and tell me what's in it.
```

Try:

```text theme={null}
Read 5 records from ACME01.DATA.MASTER decoded with copybook
ACME01.SOURCE.COPYLIB(CUSTREC). Then summarize the field distribution.
```

### Plan before you act

For larger changes, ask the agent to outline the steps first.

```text theme={null}
Walk me through what BILLPROC does. Don't change anything yet.
Then propose three options for adding the high-value audit trail.
```

Review the plan, refine it through conversation, then run each step.

## What's next

<CardGroup cols={1}>
  <Card title="Tools" icon="shield-check" href="/core-concepts/tools">
    The safety model in detail.
  </Card>
</CardGroup>
