First, unlearn one habit
You don't have to click, type, or run everything yourself. Stop being your own hands.
The agent has tools โ it can read files, write code, run commands, and fetch web pages on your computer. You just describe what you want. "I need to open the file, read it, then write a script..." โ "Analyze this dataset and plot it."
What the agent can do for you
๐ Read & search filesopen files, grep your data, inspect folders
e.g. "what keys are in this npz?"
โ๏ธ Write & edit codecreate scripts, fix bugs, refactor
e.g. "write a training script"
โถ๏ธ Run commandsexecute python, install packages, test
e.g. "run it and show me the output"
๐ผ Show you resultsopen figures, explain plots
e.g. "show me the histogram"
๐ Fetch web pagescheck docs, download data
e.g. "get the download link"
๐ฌ Iterate with youtake feedback, redo work
e.g. "make it faster" / "I expected X"
How it works โ the loop
Two loops, one idea. Left: how you work with the agent. Right: the geophysical inversion you already know. They are the same loop.
โ AI agent workflow
โบ
YOU โ write the prompt
the model parameters
the model parameters
โผ the agent works
AGENT
plans โ calls tools โ runs
plans โ calls tools โ runs
โผ result
RESULT
code ยท figures ยท numbers
code ยท figures ยท numbers
โผ you check
YOU judge
is this what I wanted?
is this what I wanted?
bad โ feedback
good โ done โ
โก Geophysical inversion
โบ
model parameters m
= your prompt
= your prompt
โผ forward modeling
dpred = G(m)
= the agent
= the agent
โผ predicted data
dpred
= agent's result
= agent's result
โผ compare with observed
misfit โdobs โ dpredโ
= you, the loss function
= you, the loss function
misfit โ update m
converged โ done โ
You are the loss function. The agent is the forward model. It proposes, you evaluate (loss), and your feedback updates the "model" โ the prompt โ until the result converges.
Try it
Run these two prompts one after another, inside opencode:
Create a file hello.py that prints "Hello from my AI agent!" and the current date. Then run it and show me the output.
Create a folder called exploration. Write a script that generates 1000 random numbers, plots a histogram, and saves it as exploration/histogram.png. Run it and show me the figure.
Handy keys & commands
| Key / command | What it does |
|---|---|
| Type your prompt, then Enter | The agent starts working (watch it call tools!) |
Esc | Interrupt the agent (it runs too long / wrong direction) |
@filename | Attach a file to your prompt ("look at @data.npz") |
/models | Switch the model |
/help | List all commands |
/undo | Revert the last change it made |
Prompt tip: context (what the data is) + task (what to do) + constraints (format, limits). Precise prompts give precise code โ you will see this in Steps 4โ5.