You open hello.py and see print("Hello"). Where is Python in this scene: in the file name, in the word print, or in the program that runs the file?
These are three different things. Python is the language whose rules are used to write the instruction in the file. The interpreter is a separate program that reads and executes that instruction.
Understanding this difference helps you run a first program safely and explain what happens when Python code executes. You will first separate five basic concepts, then give an AI agent a tightly bounded exercise and verify the result yourself.
Five ideas that are easy to mix up
Python is a programming language. It defines how to express values, conditions, repetition, functions, and other instructions.
The Python interpreter is a program installed on a computer. When you give it a file, it reads and executes the code. The launch command depends on the system and installation. It may be python, python3, or py, so first check which command is available and which Python version it starts.
A script is an ordinary text file, commonly ending in .py. It is not another copy of Python; it only contains instructions for the interpreter.
A package is an organized collection of Python modules under a shared name. A module is a file of code that another program can use. The standard library already comes with Python, while third-party packages are installed separately when needed.
A virtual environment is a separate directory containing a Python installation and additional packages for a particular project. Different projects can use separate environments with the package versions they require. This prevents one project’s conflicting requirements from affecting another project.
What happens when the file runs
Suppose hello.py contains one line:
print("Hello")
You start the interpreter and pass it the file path. The interpreter executes the print call, and Hello is sent to the program’s standard output. During an ordinary terminal run without output redirection, the terminal displays that text.
This example deliberately needs no packages, network access, or project setup. That keeps the central idea visible: the file contains code with instructions, while the interpreter executes them.
How to involve an AI agent safely
An agent can help separate concepts, inspect whether an interpreter is available, and carry out a small agreed plan. For this exercise, it only needs to show the Python version, create one file in a new empty directory, and run it.
Terminal access is not unlimited permission. The agent does not need access to your home directory, existing repositories, secrets, package installation, or administrator rights. If Python is missing, stop and make a separate installation plan instead of allowing the agent to modify the system on its own.
The agent’s statement that something “works” is not evidence. Read the created file, repeat the command yourself, and compare the actual output with the expected text.
What Python is used for
Python is a general-purpose language. People use it for small automation scripts, web services, data-processing tools, tests, and many other kinds of programs. Its standard library and third-party packages provide ready-made tools for different tasks.
After learning about the language, interpreter, files, and packages, you can choose the next subject according to the problem you want to solve. For the first run, however, one file and an available interpreter are enough; no additional tool is required.
What to remember
Python is a language, not a file or editor. An interpreter executes code from a script. Packages organize modules with reusable capabilities, while a virtual environment gives a project a separate Python installation and set of packages.
When working with an agent, inspect facts first, agree on a short plan, restrict allowed paths and actions, and verify the result yourself.
Official sources:
Run one program while keeping control of the agent
Move from explanation to evidence in six stages. All file actions stay inside a new disposable directory; system Python, existing projects, packages, and secrets remain unchanged.
Completed steps:0 / 0
I do not have a Python project yetCreate one tiny script in a new empty directory without installing packages.
Separate the language, interpreter, and file
Explain three different roles before running commands.
Boundaries, checks, and agent brief
Understand first
- Python is a language, the interpreter is a program, and a .py file is text containing instructions.
Safe context for the agent
- The five-concepts section of this article.
Allowed
- Explain terms and ask checking questions without device access.
Not allowed
- Run commands, create files, or treat the agent's answer as proof of understanding.
Stop when
- You cannot yet explain the difference between Python and a Python file in your own words.
How to verify
- Close the agent answer and repeat the explanation yourself.
Goal: Explain three different roles before running commands. Safe context for the agent: - The five-concepts section of this article. Allowed: - Explain terms and ask checking questions without device access. Not allowed: - Run commands, create files, or treat the agent's answer as proof of understanding. Stop when: - You cannot yet explain the difference between Python and a Python file in your own words. Expected artifact: Your sentence stating what reads which file and what result should appear. How to verify: - Close the agent answer and repeat the explanation yourself.
Find the available interpreter without changing anything
Establish only whether Python exists and which command starts it.
Boundaries, checks, and agent brief
Understand first
- python, python3, and py may refer to different installations.
Safe context for the agent
- The operating system and a new empty learning directory.
Allowed
- Show the Python version and list only the learning directory.
Not allowed
- Install or update Python; read other directories, .env files, keys, or credential stores.
Stop when
- Python is absent, the command is ambiguous, the directory is not empty, or administrator rights are required.
How to verify
- Repeat the version command yourself and check the path.
Goal: Establish only whether Python exists and which command starts it. Safe context for the agent: - The operating system and a new empty learning directory. Allowed: - Show the Python version and list only the learning directory. Not allowed: - Install or update Python; read other directories, .env files, keys, or credential stores. Stop when: - Python is absent, the command is ambiguous, the directory is not empty, or administrator rights are required. Expected artifact: The exact command, observed version, and path to the empty directory. How to verify: - Repeat the version command yourself and check the path.
Agree on two lines and one check
Fix the file contents, run command, and expected output before writing.
Boundaries, checks, and agent brief
Understand first
- The program prints known text, so its result is testable.
Safe context for the agent
- The verified Python command, directory path, and agreed phrase.
Allowed
- Propose a hello.py file with one print call and the exact run command.
Not allowed
- Add packages, network calls, random data, other files, or cleanup commands.
Stop when
- The plan leaves the directory or does not state the exact expected output.
How to verify
- Read the plan and check that every action is necessary for the single result.
Goal: Fix the file contents, run command, and expected output before writing. Safe context for the agent: - The verified Python command, directory path, and agreed phrase. Allowed: - Propose a hello.py file with one print call and the exact run command. Not allowed: - Add packages, network calls, random data, other files, or cleanup commands. Stop when: - The plan leaves the directory or does not state the exact expected output. Expected artifact: A short plan naming the file, contents, command, and expected line. How to verify: - Read the plan and check that every action is necessary for the single result.
Create only the agreed file
Write hello.py and execute it once in the learning directory.
Boundaries, checks, and agent brief
Understand first
- The agent has no permission for related installations or fixes.
Safe context for the agent
- The approved plan and absolute learning-directory path.
Allowed
- Create hello.py in the approved directory, show all its contents, and run the approved command.
Not allowed
- Modify system Python, install packages, touch other paths, use the network, access secrets, or elevate privileges.
Stop when
- A command or file differs from the plan, a password is requested, or another path would be touched.
How to verify
- Compare hello.py with the plan before judging the output.
Goal: Write hello.py and execute it once in the learning directory. Safe context for the agent: - The approved plan and absolute learning-directory path. Allowed: - Create hello.py in the approved directory, show all its contents, and run the approved command. Not allowed: - Modify system Python, install packages, touch other paths, use the network, access secrets, or elevate privileges. Stop when: - A command or file differs from the plan, a password is requested, or another path would be touched. Expected artifact: One file you have read and the command's actual output. How to verify: - Compare hello.py with the plan before judging the output.
Repeat the run yourself
Confirm the result independently of the agent's claim.
Boundaries, checks, and agent brief
Understand first
- Evidence is repeatable output plus bounded file changes, not a 'done' message.
Safe context for the agent
- hello.py, the expected text, and the run command.
Allowed
- Run the script again and list files in the learning directory.
Not allowed
- Fix code during verification or add files.
Stop when
- Output differs, the exit is unsuccessful, or an unexplained file appears.
How to verify
- Run the command yourself and compare its output with the agreed line.
Goal: Confirm the result independently of the agent's claim. Safe context for the agent: - hello.py, the expected text, and the run command. Allowed: - Run the script again and list files in the learning directory. Not allowed: - Fix code during verification or add files. Stop when: - Output differs, the exit is unsuccessful, or an unexplained file appears. Expected artifact: Your record of the output, exit result, and file list. How to verify: - Run the command yourself and compare its output with the agreed line.
Explain what was executed
Keep the mental model, not only a working file.
Boundaries, checks, and agent brief
Understand first
- The interpreter read the print instruction from the script and sent text to standard output.
Safe context for the agent
- The file, command, and verified result.
Allowed
- After your answer, identify one inaccuracy with a file or documentation reference.
Not allowed
- Write the explanation for you or expand the example.
Stop when
- You cannot name the roles of the file, interpreter, and print.
How to verify
- Mentally change the print text, predict the new output, and only then compare answers.
Goal: Keep the mental model, not only a working file. Safe context for the agent: - The file, command, and verified result. Allowed: - After your answer, identify one inaccuracy with a file or documentation reference. Not allowed: - Write the explanation for you or expand the example. Stop when: - You cannot name the roles of the file, interpreter, and print. Expected artifact: Your three-sentence explanation without an agent-written answer. How to verify: - Mentally change the print text, predict the new output, and only then compare answers.