TheFocus.AI TheFocus.AI

Index

TUTOR WITH THEFOCUS.AI

Agent Integration

Copy this prompt into Claude, ChatGPT, or any external AI assistant. It points the assistant to the course instructions and links it to your student profile to track your progress and customize observations.

Please tutor me in this lesson using the following context. First, read the instructions at: https://courses.thefocus.ai/llms.txt My Student ID is: <none> The lesson markdown source is at: https://courses.thefocus.ai/run-ai-locally/03-automation/index.md

You are not enrolled yet. Enroll to generate a Student ID to track lesson completions and store learning notes.

03 — Automation

Now we shift from manually running prompts to building an automated pipeline. By the end of this section, you’ll have a system that:

  1. Reads a prompt from a file
  2. Runs it through Ollama
  3. Extracts any generated code
  4. Runs the code and captures the results
  5. Feeds errors back to improve the prompt

This is the “agentic loop” — an AI system that can improve itself.

What We’ll Build

ToolWhat It Does
Prompt RunnerBash script that runs a prompt through Ollama
Self-Improving LoopFeeds errors back into the prompt for the next run
File CombinerMerges prompt, code, and test output into a single message for re-prompting
Code ExtractorPulls code blocks out of Ollama responses and saves them as runnable files

The Architecture

prompt.txt ──► [Ollama] ──► ollama-output.md

                          [Code Extractor]

                    ┌─────────────┼─────────────┐
                    ▼             ▼             ▼
              reasoning.md   response.md     code/

                                        [Test Runner]

                                        test-output.md

                          ┌────────────────────┘

                    [File Combiner]

                    error + prompt + test-output ──► [Ollama] ──► better code

This is the full loop. Let’s build it piece by piece.

Note: In the original walkthrough, the author built this iteratively — the first version used a simple bash script, then the model evolved it into something more sophisticated. The files we reference below are the final, working versions of each tool.

06 — Prompt Runner →