Hello World Agent
AIPACK is a way to run agents, and in its simplest form, an agent is a multi-stage markdown file with the extension .aip
.
For example, let's build a very simple hello world agent that will greet us in 5 different languages.
NOTE: (optional) If you are using VSCode, feel free to install the AIPACK VSCode extension. It will ensure the correct file association.
Prerequisites
- Install AIPack
- Create a folder named
aip-demo-1/
(or any other name) - From the terminal in this folder, run
aip init
- This will initialize this folder (
aip-demo-1/
) as an AIPACK workspace with a.aipack/
folder.
- This will initialize this folder (
Level 1 - Hello John
In the folder aip-demo-1/
,
NOTE: If you use VSCode or another editor, a good approach is to open the
aip-demo-1/
folder in VSCode (or another editor/IDE) and then open the integrated terminal. This way, everything stays organized and connected.
Agent
Create a hello.aip
file with a single stage # Instruction:
# Instruction
Can you say "Hello World" in 5 different languages?
IMPORTANT: Make sure to set the ..._API_KEY in the terminal where you run the
aip run ...
command, as specified in the install instructions.
Run
Now, in the terminal
aip run hello.aip
Result
In the terminal, you should see something like this:
======= RUNNING: hello.aip
Agent path: hello.aip
Running agent command: hello.aip
from: hello.aip
with default model: mini (gpt-4.1-mini)
==== Running input: 0
-> Sending rendered instruction to gpt-4.1-mini ...
<- ai_response content received - gpt-4.1-mini-2025-04-14 | Duration: 1s 188ms | ~$0.0001 | Prompt Tokens: 21 (cached: 0) | Completion Tokens: 58 (reasoning: 0)
-> Agent Output:
Sure! Here is "Hello World" in five different languages:
1. English: Hello World
2. Spanish: Hola Mundo
3. French: Bonjour le monde
4. German: Hallo Welt
5. Japanese: こんにちは世界 (Konnichiwa Sekai)
==== DONE (input: 0)
======= COMPLETED: hello.aip
[ r ]: Replay [ a ]: Open Agent [ q ]: Quit
- After the
-> Agent Output:
we see the response. - We have a control bar that allows us to press
r
to replay orq
to quit. - You can change the prompt and press
r
to replay the agent.
Explanation
Here's what happened:
- The
hello.aip
is an agent file, which is a multi-stage markdown file. - In this agent, we only have one stage, which is the user instruction.
- When we ran
aip run hello.aip
,- AIPACK executed
hello.aip
, - Found a single stage
# Instruction
, - Rendered it, which in this case just resulted in the content of that section,
- Sent it to the AI model,
- And then, when the AI model responded, since there was no other stage, it printed the result in the terminal.
- AIPACK executed
NOTE: We do not have to include the
.aip
extension. So,aip run hello
would have run the same file.