Script
A script is a short program, saved in a text file, that does one task from start to finish every time you run it, the same way each time. It doesn't think or guess: it reads what you give it, does its steps and hands back a result or an error.
Select any words here to ask your Maestro about them.
If draft.md and storyboard.md exist but approved.txt doesn't, what does it print?
import os, syshere = os.listdir()# sys.exit prints and exits with 1if "draft.md" not in here: sys.exit("NO_DRAFT")if "storyboard.md" not in here: sys.exit("NO_STORYBOARD")if "approved.txt" not in here: sys.exit("NOT_APPROVED")print("READY")An agent decides; a script doesn't. That makes it cheap (running it costs nothing), fast (it takes milliseconds) and checkable (you can read it and test it). When a step in your workflow is always the same, turn it into a script and save the agent for what changes.
From the outside it's a file whose name ends in .py (Python) or .sh (the terminal). Inside, its lines run top to bottom: it reads what it's given (files, arguments), writes or prints one result, and ends with an exit code that says whether it worked: 0 if it did, any other number, with a message, if it didn't. You open it in VS Code and run it from the Terminal with python3 next.py. That exit code is what makes it a gate: a script that exits with 1 can stop a process; an instruction written in prose can't.
The one idea to keep: a script talks back. It can read the state of a folder and print one word or one line that tells you, or your agent, what to do next. That's the difference between a reminder written in a document and a gate. It's why the agent instructions file can say, on its first line: "run the context script and do what it prints."
How it's used
Before rendering a video
- $ python3 context.py fall-video
- PROJECT fall-videoIt found the project folder: the script did run.
- STATUS no status fileThe project skipped its setup and never wrote down its status.
- marked: NO_STATUSThe directive. No gate knew what to do with it, so none of them applied.
When to look closer
Script or agent?
Publish a video
- Check that draft.md, storyboard.md and approved.txt exist
- Read the draft and decide whether it makes sense
- Write the YouTube description
- Render with the usual settings
- Decide whether it goes out today
Which of these steps come out the same every time?
A script that speaks first
project/
- $ ls
- draft.md storyboard.md
- $ python3 next.py
- NOT_APPROVEDNext: ask for approval.
What does it print once approved.txt shows up?
Ask your Maestro about Script
It answers from the free course page closest to this word, the way it answers while you study.
You: What does "Script" mean, in plain words?
Your Maestro: I'll explain it with a case of yours: it sticks better than a definition. Where did you run into "Script": at work, in a course, in the news?
Asking about: Answers from the page "Absolute vs. relative path: where does a path start from?"
Only this browser keeps what you ask here. How it works
Learn more
Related terms
- AI agent
A program that pairs a language model with tools, such as terminal commands and files, to carry out a task in several steps: it reads its context, acts, looks at the result and repeats.
- Agent harness
The program that wraps a language model and makes it an agent: it gives the model tools, asks for your permission, keeps the session and decides what goes into its context.
- Agent instructions file
A text file in your project that the agent's harness loads at the start of every session, so the agent knows from the start what it always needs to know: rules, facts about the data and how to check its work.
- Terminal
A terminal is a window where you type commands for your computer instead of clicking. You type a line, press Enter, and the computer answers in text.