Chapter 3. Getting started with Kaoto
In this quickstart guide, you’ll build a Camel route that automatically summarizes text files using a local AI model. The route will monitor a folder for new text files, send their content to Ollama (running the Granite AI model), and output concise summaries.
3.1. Prerequisites Copy linkLink copied to clipboard!
Before starting, ensure you have:
- VS Code installed on your system - Follow the installation guide
- Kaoto VS Code extension - See the installation guide for setup instructions
- Ollama installed and running - Follow the Ollama installation guide to set it up
-
Granite 4 model pulled in Ollama - Run
ollama pull granite4:tiny-hin your terminal (Granite 4 on Ollama))
3.2. Creating first Camel Route Copy linkLink copied to clipboard!
3.2.2. Creating a new Camel Route Copy linkLink copied to clipboard!
In the Kaoto perspective, click Camel File in the Integrations section.
Choose Camel Route as the route type.
Choose between
YAML DSLorXML DSLas the route type.
Provide a name for the new route.
A basic timer-based route will be created automatically.
3.2.3. Running the Camel Route Copy linkLink copied to clipboard!
Click the Run: Workspace button in the Integrations panel.
The route will start executing, check the terminal output - you should see Hello Camel from route1 printed every second.
To stop the route, you can click on the Terminate button.
3.3. Adding AI Summarization Copy linkLink copied to clipboard!
This section describes how to add AI Summarization to your Camel Route using Kaoto. For this route, use Apache Camel 4.18 (or newer), make sure to select that version in the Runtime selector when creating your route.
For starters, instead of automatically producing empty messages with the timer component, use a file component for reading text files from a directory and place the text to summarize.
3.3.1. Adding the file component Copy linkLink copied to clipboard!
Hover over the timer node and click the replace button.
In the component selection dialog, search for file and select the File component.
You’ll end up having something like this, notice how hovering over the exclamation mark tells you that the
directoryNameconfiguration is missing!
Click on the file component, and fill the
directoryNamefield with./input.
Click on the All toggle, and search for the
noopproperty and enable it.
Search for the
idempotentproperty and enable it.
Hover over the
setBodynode and click the delete button.
Switch to the File explorer.
Create a new folder called
inputwith astory.txtfile inside where you’ll be writing the text to summarize.
NoteFor a text example, visit the wonderful Project Gutenberg and use a paragraph from the Alice’s Adventures in Wonderland, book by Lewis Carroll.
You can also use the following text:
First, she dreamed of little Alice herself, and once again the tiny hands were clasped upon her knee, and the bright eager eyes were looking up into hers—she could hear the very tones of her voice, and see that queer little toss of her head to keep back the wandering hair that would always get into her eyes—and still as she listened, or seemed to listen, the whole place around her became alive with the strange creatures of her little sister’s dream.
The long grass rustled at her feet as the White Rabbit hurried by—the frightened Mouse splashed his way through the neighbouring pool—she could hear the rattle of the teacups as the March Hare and his friends shared their never-ending meal, and the shrill voice of the Queen ordering off her unfortunate guests to execution—once more the pig-baby was sneezing on the Duchess’s knee, while plates and dishes crashed around it—once more the shriek of the Gryphon, the squeaking of the Lizard’s slate-pencil, and the choking of the suppressed guinea-pigs, filled the air, mixed up with the distant sobs of the miserable Mock Turtle.
Navigate back to the Kaoto perspective and run the route, you should get a similar output like this. Notice how you see the text as the route output.
Stop the route now. In the next step, add the
OpenAIcomponent to perform the summary.
3.3.2. Adding the OpenAI component Copy linkLink copied to clipboard!
For the summary process, use the OpenAI component to leverage our local Ollama instance with the Granite model.
Hover in the edge between the
fileandlogcomponents, and click on the Add step button.
In the component catalog, search for openai and select the
OpenAIcomponent.
Click on the newly added
OpenAIcomponent and select the All view to configure the following options:
Property Value Operation
chat-completion
API Key
OLLAMA-LOCAL-KEYBase URL
Model
granite4:tiny-hSystem Message
Summarize this text into a couple of short sentences and give it a funny twist
NoteTo run Ollama locally, an API Key is not really needed. You can fill this field with any string, or the actual
OLLAMA-LOCAL-KEYstring.After editing the option, click on the Modified toggle to see what has changed in the route configuration.
NoteFor the next step, make sure to run
ollama run granite4:tiny-hin your terminal beforehand.Time of truth, run the route and see the summary. If everything went well, you should get a similar output like this:
2026-03-26 13:09:37.293 INFO 592754 --- [ file://./input] demo.camel.yaml:19 : Once upon a time in Wonderland, Alice dreamt that her childhood fascination turned into a reality where she met her favorite characters from "Alice in Wonderland," but this time it’s all around her, filling her ears and eyes! Oh, and let’s not forget about the sneezing pig-baby and execution-ordered rabbit. Truly an unforgettable experience!
(Note: This is a lighthearted re-imagining of the original text.)