0:00
/
0:00

AIPACK Tutorial – From Hello World to HTML AI Optimizer Agent

Create your first my-agent.aip AI PACK agent from multi-input Hello World to an HTML AI Optimizer

In this tutorial, we are going to create our first AIPACK agent, my-agent.aip.

First, we’ll do a quick walkthrough of the prerequisites:

  • Install AIPACK (the aip command line) from https://aipack.ai

  • Start VSCode in a folder and set the desired AI Providers' API Keys

  • (optional) Install the optional VSCode AIPACK extension.

Here is the AIPACK-Lab folder for this project.

Then, we will do the hello world example, which has two main sections.

1) Hello World

In the hello world section of the tutorial, we will learn how to:

  • Create a simple my-agent.aip with hardcoded input (in the data # Data) and use debug print in the output (# Output) (without AI - good for debugging).

  • Activate the # Instruction section to send the request to AI.

  • Use multiple inputs from the command line with aip run -i ... -i ....

  • Change the model and use the -zero Gemini 2.5 suffix to control the thinking budget.

  • Append (aip.file.append) content to a single file for all concurrent inputs.

3) HTML Optimizer

Then, we will update the my-agent.aip tutorial to learn how we can AI optimize an HTML code documentation page using AIPACK slim HTML and markdown API, forwarding the slimmed markdown content to AI to get a small but semantically rich markdown file.

We will use the following AIPACK APIs:

  • aip.web.get to get the original HTML content.

  • aip.file.save_html_to_slim to slim the original HTML from 1.5MB to 57KB.

  • aip.file.save_html_to_md to save the slimmed HTML as markdown (10KB).

  • Craft a custom instruction to have gemini-flash-2.5-flash structure and reconstruct the code blocks.

  • aip.md.outer_md_block_or_raw to remove any encompassing markdown code block.

Check out all of the AIPACK Lua APIs Documentation for more information.

Feel free to subscribe to AIPACK Substack at news.aipack.com for more info and tutorials.