This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-jbang-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new 833f4d1  ai/agent-tools - a local model answers the customers with two 
route tools, and the Camel TUI follows each agent run (#140)
833f4d1 is described below

commit 833f4d1c7404377f0f863f263104fd3122358730
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Nov 20 22:33:36 2026 +0100

    ai/agent-tools - a local model answers the customers with two route tools, 
and the Camel TUI follows each agent run (#140)
    
    A new example on the ai rung, after mcp-server, whose two shop tools it
    reuses: camel-openai on Ollama (granite4:3b) gets the routes tagged shop as
    tools, runs the tool calls the model asks for and hands the results back
    until the model answers. With camel run --observe and
    camel.aiObservability.level=full, the Camel TUI shows each agent run: the
    model and tool calls, the tokens and the conversation (CAMEL-27135).
    
    Needs Camel 4.24; the test needs a local model, so CI skips it. The
    openai-pii-redaction and docling-langchain4j-rag examples move one place 
down
    the ai rung. The README has two screenshots of an agent run in the Camel 
TUI.
    
    Signed-off-by: Claus Ibsen <[email protected]>
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_016Y4dDi5iQNgtHrDdz2NpwF
---
 README.md                                       |   3 +-
 ai/README.md                                    |   3 +-
 ai/agent-tools/README.md                        | 130 ++++++++++++++++++++++++
 ai/agent-tools/agent-tools-tui-agent-run.png    | Bin 0 -> 427470 bytes
 ai/agent-tools/agent-tools-tui-conversation.png | Bin 0 -> 244045 bytes
 ai/agent-tools/agent-tools.camel.yaml           | 116 +++++++++++++++++++++
 ai/agent-tools/application.properties           |  27 +++++
 ai/agent-tools/metadata.json                    |  45 ++++++++
 ai/agent-tools/orders/order-1001.json           |   2 +
 ai/agent-tools/orders/order-1002.json           |   2 +
 ai/agent-tools/orders/order-1003.json           |   2 +
 ai/agent-tools/questions/question-1.txt         |   1 +
 ai/agent-tools/questions/question-2.txt         |   1 +
 ai/agent-tools/questions/question-3.txt         |   1 +
 ai/agent-tools/stock.json                       |   5 +
 ai/agent-tools/test/agent-tools.citrus.it.yaml  |  63 ++++++++++++
 ai/docling-langchain4j-rag/metadata.json        |   2 +-
 ai/openai-pii-redaction/metadata.json           |   2 +-
 camel-jbang-example-catalog.json                |  63 +++++++++++-
 generate-catalog.sh                             |   2 +-
 20 files changed, 463 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index ef18d00..42e4f57 100644
--- a/README.md
+++ b/README.md
@@ -126,13 +126,14 @@ An OpenAPI contract served and called, and an API 
protected by Keycloak.
 
 ### [AI](ai/)
 
-A local model writing text, routes exposed as MCP tools, RAG over documents, 
PII redaction.
+A local model writing text, routes exposed as MCP tools, an agent calling 
route tools, RAG over documents, PII redaction.
 
 | Example | What you will see | Needs |
 |---|---|---|
 | [LangChain4j chat](ai/langchain4j-chat/) | A local Ollama model started with 
camel infra writes the shipping notification for each of the three orders; the 
chat model is configured by provider on the endpoint, the prompt comes from the 
order, and the log shows the reply with its token counts. | `camel infra run 
ollama`, a local model: `ollama pull granite4:3b` |
 | [Ticket classifier](ai/ticket-classifier/) | A local model reads each of 
three support tickets and names its category, shipping, billing or account; the 
route checks the answer and files the ticket in tickets-out/<category>/, and an 
answer outside the three, or no answer within the circuit breaker's timeout, 
files it under unknown. | `camel infra run ollama`, a local model: `ollama pull 
granite4:3b` |
 | [MCP server](ai/mcp-server/) | Two routes are exposed as MCP tools, 
stock_level by SKU and order_status by order id, on http://localhost:8080/mcp 
with nothing but properties to switch the server on; any MCP client, a coding 
agent included, can list and call them, and the log shows each call. | nothing |
+| [AI agent with route tools](ai/agent-tools/) | A local Ollama model answers 
three customer questions about orders and stock; it knows nothing of the shop, 
so camel-openai offers it the two routes tagged shop as tools, runs the tool 
calls it asks for and hands back the results, and the log shows each question, 
each tool call and the answer; with --observe the Camel TUI shows every agent 
run, its model and tool calls, the tokens and the conversation. | `camel infra 
run ollama`, Camel 4.2 [...]
 | [OpenAI PII Redaction](ai/openai-pii-redaction/) | Text typed on standard 
input is sent to an OpenAI-compatible model with a JSON schema that asks for 
the personal identifiers redacted, and the redacted text is printed on standard 
output. | an OpenAI-compatible API: set `OPENAI_API_KEY` |
 | [Document Analysis with Docling and LangChain4j 
RAG](ai/docling-langchain4j-rag/) | Documents dropped in a directory are 
converted to Markdown by a Docling service, analysed by a local Ollama model 
through langchain4j-chat, and written as a report to an output directory; an 
HTTP endpoint answers questions against the latest document. | `camel infra run 
docling ollama`, a local model |
 
diff --git a/ai/README.md b/ai/README.md
index 1e16d73..d998334 100644
--- a/ai/README.md
+++ b/ai/README.md
@@ -1,13 +1,14 @@
 # AI
 
 <!-- group:start -->
-A local model writing text, routes exposed as MCP tools, RAG over documents, 
PII redaction.
+A local model writing text, routes exposed as MCP tools, an agent calling 
route tools, RAG over documents, PII redaction.
 
 | Example | What you will see | Needs |
 |---|---|---|
 | [LangChain4j chat](langchain4j-chat/) | A local Ollama model started with 
camel infra writes the shipping notification for each of the three orders; the 
chat model is configured by provider on the endpoint, the prompt comes from the 
order, and the log shows the reply with its token counts. | `camel infra run 
ollama`, a local model: `ollama pull granite4:3b` |
 | [Ticket classifier](ticket-classifier/) | A local model reads each of three 
support tickets and names its category, shipping, billing or account; the route 
checks the answer and files the ticket in tickets-out/<category>/, and an 
answer outside the three, or no answer within the circuit breaker's timeout, 
files it under unknown. | `camel infra run ollama`, a local model: `ollama pull 
granite4:3b` |
 | [MCP server](mcp-server/) | Two routes are exposed as MCP tools, stock_level 
by SKU and order_status by order id, on http://localhost:8080/mcp with nothing 
but properties to switch the server on; any MCP client, a coding agent 
included, can list and call them, and the log shows each call. | nothing |
+| [AI agent with route tools](agent-tools/) | A local Ollama model answers 
three customer questions about orders and stock; it knows nothing of the shop, 
so camel-openai offers it the two routes tagged shop as tools, runs the tool 
calls it asks for and hands back the results, and the log shows each question, 
each tool call and the answer; with --observe the Camel TUI shows every agent 
run, its model and tool calls, the tokens and the conversation. | `camel infra 
run ollama`, Camel 4.24 o [...]
 | [OpenAI PII Redaction](openai-pii-redaction/) | Text typed on standard input 
is sent to an OpenAI-compatible model with a JSON schema that asks for the 
personal identifiers redacted, and the redacted text is printed on standard 
output. | an OpenAI-compatible API: set `OPENAI_API_KEY` |
 | [Document Analysis with Docling and LangChain4j 
RAG](docling-langchain4j-rag/) | Documents dropped in a directory are converted 
to Markdown by a Docling service, analysed by a local Ollama model through 
langchain4j-chat, and written as a report to an output directory; an HTTP 
endpoint answers questions against the latest document. | `camel infra run 
docling ollama`, a local model |
 
diff --git a/ai/agent-tools/README.md b/ai/agent-tools/README.md
new file mode 100644
index 0000000..c7add02
--- /dev/null
+++ b/ai/agent-tools/README.md
@@ -0,0 +1,130 @@
+# AI agent with route tools
+
+The shop's customers ask about their orders and the stock, and a local model 
answers. The model knows nothing of
+the shop: the openai component offers it two routes as tools, runs the tool 
calls the model asks for and hands the
+results back, until the model has its answer. Run with `--observe`, and the 
Camel TUI shows each agent run step by
+step: the model calls, the tool calls, the tokens and the whole conversation.
+
+## What you will see
+
+```text
+INFO ... agent-tools.camel.yaml:19  : Question question-1: Is order ORD-1001 
paid?
+INFO ... agent-tools.camel.yaml:115 : Tool order_status(ORD-1001): Order 
ORD-1001 for customer C-482 in DK is paid with 2 line(s)
+INFO ... agent-tools.camel.yaml:32  : Answer question-1: Yes, order ORD-1001 
is paid.
+INFO ... agent-tools.camel.yaml:19  : Question question-2: How many Camel mugs 
do you have in stock?
+INFO ... agent-tools.camel.yaml:75  : Tool stock_level(CAMEL-MUG): 42 
CAMEL-MUG in stock
+INFO ... agent-tools.camel.yaml:32  : Answer question-2: We have 42 Camel mugs 
in stock.
+INFO ... agent-tools.camel.yaml:19  : Question question-3: Order ORD-1003 has 
a Camel cap in it: is the order paid, and is the cap in stock?
+INFO ... agent-tools.camel.yaml:115 : Tool order_status(ORD-1003): Order 
ORD-1003 for customer C-134 in US is pending with 3 line(s)
+INFO ... agent-tools.camel.yaml:75  : Tool stock_level(CAMEL-CAP): 0 CAMEL-CAP 
in stock
+INFO ... agent-tools.camel.yaml:32  : Answer question-3: Your order ORD-1003 
is still pending and the Camel cap is currently out of stock.
+```
+
+The answers are the model's own words, so yours read differently; the tool 
calls are the same.
+
+And in the Camel TUI, the agent run of the third question: two model calls and 
the two tool calls between them,
+with the tokens and the time of each step.
+
+![The agent run of the third question in the Spans tab of the Camel 
TUI](agent-tools-tui-agent-run.png)
+
+Press `t` on the agent run, and the conversation shows what the model asked 
the tools, what they answered, and the
+answer it wrote from that.
+
+![The conversation of the agent run: the tool calls, their results and the 
answer](agent-tools-tui-conversation.png)
+
+## Install Camel CLI
+
+Install [JBang](https://www.jbang.dev/download/) and the Camel CLI as 
described in the
+[root README](../../README.md#install-the-camel-cli); `camel --version` 
confirms the install. This example needs
+Camel 4.24 or newer.
+
+## Run it
+
+The example needs a running Ollama with a model, which the Camel CLI starts 
for you in a container (Docker or
+Podman must be running); the container pulls the `granite4:3b` model on first 
start, which takes a while. In one
+terminal:
+
+```shell
+camel infra run ollama
+```
+
+In another terminal:
+
+```shell
+camel run * --observe
+```
+
+`--observe` turns on the observability services: health, metrics, and tracing 
of the routes for the Camel TUI.
+Because the routes call a model, it adds the GenAI observability too, and 
`camel.aiObservability.level=full` in
+`application.properties` has it record each agent run with its model and tool 
calls, and the messages.
+
+In a third terminal, open the TUI and select the integration:
+
+```shell
+camel tui
+```
+
+- Press `F8` for the AI panel, then `Ctrl+U` for the AI usage: the model calls 
with their tokens, and a line with
+  the agent runs and their model and tool calls.
+- Open the Spans tab (under More, shortcut `o`) and press `Enter` on a trace. 
In the waterfall, `◆` is the agent run,
+  `●` a model call with its tokens, and `⚙` a tool call with its arguments; 
select the agent run to see its steps,
+  tokens and time in the detail panel, and press `t` to read the conversation.
+
+An Ollama installed on the machine works too, if its model can call tools: set 
`openai.model` in
+`application.properties` to a model you have pulled. Stop the example with 
`ctrl` + `c` and the container with
+`camel infra stop ollama`.
+
+## How it works
+
+- `agent-tools.camel.yaml` holds three routes. Route `customer-questions` 
reads each file in `questions/`, logs the
+  question and sends it to `openai:chat-completion`, which talks to Ollama 
through its OpenAI-compatible API, with a
+  system message that tells the model to look things up rather than guess.
+- `tags: shop` on that endpoint is what makes it an agent: openai offers the 
model every `ai-tool` route tagged
+  `shop`, and when the model answers with tool calls, openai calls those 
routes and sends their results back to the
+  model, until it answers in text (`autoToolExecution`, on by default).
+- Routes `stock-level` and `order-status` are the two tools, the same as in the
+  [MCP server](../mcp-server/) example: `ai-tool` names each tool, describes 
it and its parameter for the model, and
+  the route answers from `stock.json` or from `orders/`.
+- `application.properties` points openai at Ollama and sets the GenAI 
observability level: `basic` (the default)
+  records the model calls, `detailed` adds the agent runs and tool calls, 
`full` adds the messages.
+
+## Build it step by step
+
+Ask your assistant, or type it yourself, one step at a time, and run after 
each:
+
+1. A route that reads the files in `questions/` and sends each question to 
`openai:chat-completion` on Ollama
+   (`baseUrl`, `apiKey`, `model` from `application.properties`), and logs the 
answer; ask about the stock and see
+   what the model makes of a question it has no data for.
+2. Add the `stock_level` tool route with `ai-tool` and `tags: shop`, and 
`tags: shop` on the openai endpoint; run
+   again and see the tool call in the log before the answer.
+3. Add a system message that tells the model to use the tools and never guess.
+4. Add the `order_status` tool and the question about order ORD-1003, which 
needs both tools.
+5. Run with `--observe` and `camel.aiObservability.level=full`, and follow an 
agent run in the TUI.
+
+## Try changing
+
+- Ask something the tools cannot answer, such as the delivery date of an 
order, and see whether the model says so.
+- Set `camel.aiObservability.level=detailed`: the TUI still shows the agent 
runs and tool calls, but no messages.
+- Give a tool `returnDirect: true`, and its result becomes the answer without 
a second model call.
+
+## Integration testing
+
+The example comes with a test in the [Citrus](https://citrusframework.org/) 
YAML DSL,
+`test/agent-tools.citrus.it.yaml`, which the Camel CLI runs:
+
+```shell
+camel test run test/agent-tools.citrus.it.yaml
+```
+
+The test starts Ollama on a side port, waits for the model, runs the example 
and verifies that the model called
+the tools and answered the last question. It needs Docker and a model 
download, so CI does not run it.
+
+## Help and contributions
+
+If you hit any problem using Camel or have some feedback, then please
+[let us know](https://camel.apache.org/community/support/).
+
+We also love contributors, so
+[get involved](https://camel.apache.org/community/contributing/) :-)
+
+The Camel riders!
diff --git a/ai/agent-tools/agent-tools-tui-agent-run.png 
b/ai/agent-tools/agent-tools-tui-agent-run.png
new file mode 100644
index 0000000..e3f26b7
Binary files /dev/null and b/ai/agent-tools/agent-tools-tui-agent-run.png differ
diff --git a/ai/agent-tools/agent-tools-tui-conversation.png 
b/ai/agent-tools/agent-tools-tui-conversation.png
new file mode 100644
index 0000000..19541b0
Binary files /dev/null and b/ai/agent-tools/agent-tools-tui-conversation.png 
differ
diff --git a/ai/agent-tools/agent-tools.camel.yaml 
b/ai/agent-tools/agent-tools.camel.yaml
new file mode 100644
index 0000000..5c50ee8
--- /dev/null
+++ b/ai/agent-tools/agent-tools.camel.yaml
@@ -0,0 +1,116 @@
+# A local model answers the customers' questions about orders and stock. It
+# does not know the shop: openai finds the two routes tagged shop below and
+# offers them to the model as tools, runs the tool calls the model asks for and
+# hands the results back, until the model answers. Start the model with:
+# camel infra run ollama
+- route:
+    id: customer-questions
+    from:
+      uri: file
+      parameters:
+        directoryName: questions
+        noop: true
+        sortBy: "file:name"
+      steps:
+        - setBody:
+            expression:
+              simple:
+                expression: "${bodyAs(String).trim()}"
+        - log:
+            message: "Question ${file:onlyname.noext}: ${body}"
+        - to:
+            uri: openai:chat-completion
+            parameters:
+              baseUrl: "{{openai.base.url}}"
+              apiKey: "{{openai.api.key}}"
+              model: "{{openai.model}}"
+              temperature: 0
+              tags: shop
+              systemMessage: >-
+                You answer the customers of a web shop that sells Apache Camel 
merchandise.
+                Look up orders and stock with the tools, never guess, and 
answer in one or two sentences.
+        - log:
+            message: "Answer ${file:onlyname.noext}: ${body}"
+
+- route:
+    id: stock-level
+    from:
+      uri: ai-tool:stock_level
+      parameters:
+        tags: shop
+        description: "Stock level of one product in the warehouse, by SKU"
+        parameter.sku: string
+        parameter.sku.description: "The product SKU, for example CAMEL-MUG"
+        parameter.sku.required: "true"
+        readOnlyHint: "true"
+      steps:
+        - setBody:
+            expression:
+              constant:
+                expression: resource:file:stock.json
+        - unmarshal:
+            json:
+              library: Jackson
+        # the item of that SKU as a map, or null when there is none
+        - setBody:
+            expression:
+              groovy:
+                expression: "body.find { it.sku == headers.sku }"
+        - choice:
+            when:
+              - expression:
+                  simple:
+                    expression: "${body} == null"
+                steps:
+                  - setBody:
+                      expression:
+                        simple:
+                          expression: "Unknown SKU ${header.sku}"
+            otherwise:
+              steps:
+                - setBody:
+                    expression:
+                      simple:
+                        expression: "${body[qty]} ${header.sku} in stock"
+        - log:
+            message: "Tool stock_level(${header.sku}): ${body}"
+
+- route:
+    id: order-status
+    from:
+      uri: ai-tool:order_status
+      parameters:
+        tags: shop
+        description: "Status and lines of an order, by order id"
+        parameter.orderId: string
+        parameter.orderId.description: "The order id, for example ORD-1001"
+        parameter.orderId.required: "true"
+        readOnlyHint: "true"
+      steps:
+        # order ORD-1001 is the file orders/order-1001.json
+        - pollEnrich:
+            expression:
+              simple:
+                expression: 
"file:orders?fileName=order-${header.orderId.substring(4)}.json&noop=true&idempotent=false"
+            timeout: 1000
+        - choice:
+            when:
+              - expression:
+                  simple:
+                    expression: "${body} == null"
+                steps:
+                  - setBody:
+                      expression:
+                        simple:
+                          expression: "Unknown order ${header.orderId}"
+            otherwise:
+              steps:
+                - unmarshal:
+                    json:
+                      library: Jackson
+                - setBody:
+                    expression:
+                      simple:
+                        expression: "Order ${body[orderId]} for customer 
${body[customer]} in ${body[country]} is ${body[status]} with 
${body[lines].size()} line(s)"
+        - log:
+            message: "Tool order_status(${header.orderId}): ${body}"
diff --git a/ai/agent-tools/application.properties 
b/ai/agent-tools/application.properties
new file mode 100644
index 0000000..0a1e0a4
--- /dev/null
+++ b/ai/agent-tools/application.properties
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+# the model camel infra run ollama pulls, through the OpenAI-compatible API of 
Ollama
+openai.base.url=http://localhost:11434/v1
+openai.model=granite4:3b
+# Ollama needs no key, but the OpenAI client wants one
+openai.api.key=ollama
+
+# record every agent run with its model and tool calls, and the messages 
(level full);
+# camel run --observe adds the GenAI observability, the Camel TUI shows what 
it records
+camel.aiObservability.level=full
diff --git a/ai/agent-tools/metadata.json b/ai/agent-tools/metadata.json
new file mode 100644
index 0000000..86dc6d0
--- /dev/null
+++ b/ai/agent-tools/metadata.json
@@ -0,0 +1,45 @@
+{
+    "title": "AI agent with route tools",
+    "description": "A local Ollama model answers three customer questions 
about orders and stock; it knows nothing of the shop, so camel-openai offers it 
the two routes tagged shop as tools, runs the tool calls it asks for and hands 
back the results, and the log shows each question, each tool call and the 
answer; with --observe the Camel TUI shows every agent run, its model and tool 
calls, the tokens and the conversation.",
+    "level": "ai",
+    "order": 4,
+    "teaches": {
+        "components": [
+            "openai",
+            "ai-tool",
+            "file",
+            "log"
+        ],
+        "eips": [
+            "setBody",
+            "pollEnrich",
+            "choice",
+            "unmarshal"
+        ],
+        "languages": [
+            "simple",
+            "groovy",
+            "constant"
+        ],
+        "dataformats": [
+            "json"
+        ]
+    },
+    "tags": [
+        "shop",
+        "ai",
+        "llm",
+        "ollama",
+        "openai",
+        "agent",
+        "tools",
+        "observability"
+    ],
+    "infraServices": [
+        "ollama"
+    ],
+    "requiresDocker": true,
+    "bundled": false,
+    "ciSkip": true,
+    "needs": "Camel 4.24 or newer, a local model: `ollama pull granite4:3b`"
+}
diff --git a/ai/agent-tools/orders/order-1001.json 
b/ai/agent-tools/orders/order-1001.json
new file mode 100644
index 0000000..3eb5f03
--- /dev/null
+++ b/ai/agent-tools/orders/order-1001.json
@@ -0,0 +1,2 @@
+{"orderId": "ORD-1001", "customer": "C-482", "country": "DK", "status": "paid",
+ "lines": [{"sku": "CAMEL-TSHIRT", "qty": 2, "price": 19.95}, {"sku": 
"CAMEL-MUG", "qty": 1, "price": 9.50}]}
diff --git a/ai/agent-tools/orders/order-1002.json 
b/ai/agent-tools/orders/order-1002.json
new file mode 100644
index 0000000..bb7aa0e
--- /dev/null
+++ b/ai/agent-tools/orders/order-1002.json
@@ -0,0 +1,2 @@
+{"orderId": "ORD-1002", "customer": "C-207", "country": "DE", "status": "paid",
+ "lines": [{"sku": "CAMEL-MUG", "qty": 3, "price": 9.50}]}
diff --git a/ai/agent-tools/orders/order-1003.json 
b/ai/agent-tools/orders/order-1003.json
new file mode 100644
index 0000000..9edab76
--- /dev/null
+++ b/ai/agent-tools/orders/order-1003.json
@@ -0,0 +1,2 @@
+{"orderId": "ORD-1003", "customer": "C-134", "country": "US", "status": 
"pending",
+ "lines": [{"sku": "CAMEL-TSHIRT", "qty": 1, "price": 19.95}, {"sku": 
"CAMEL-CAP", "qty": 1, "price": 14.00}, {"sku": "CAMEL-MUG", "qty": 2, "price": 
9.50}]}
diff --git a/ai/agent-tools/questions/question-1.txt 
b/ai/agent-tools/questions/question-1.txt
new file mode 100644
index 0000000..38e90f6
--- /dev/null
+++ b/ai/agent-tools/questions/question-1.txt
@@ -0,0 +1 @@
+Is order ORD-1001 paid?
diff --git a/ai/agent-tools/questions/question-2.txt 
b/ai/agent-tools/questions/question-2.txt
new file mode 100644
index 0000000..a4590e0
--- /dev/null
+++ b/ai/agent-tools/questions/question-2.txt
@@ -0,0 +1 @@
+How many Camel mugs do you have in stock?
diff --git a/ai/agent-tools/questions/question-3.txt 
b/ai/agent-tools/questions/question-3.txt
new file mode 100644
index 0000000..de422da
--- /dev/null
+++ b/ai/agent-tools/questions/question-3.txt
@@ -0,0 +1 @@
+Order ORD-1003 has a Camel cap in it: is the order paid, and is the cap in 
stock?
diff --git a/ai/agent-tools/stock.json b/ai/agent-tools/stock.json
new file mode 100644
index 0000000..efab5de
--- /dev/null
+++ b/ai/agent-tools/stock.json
@@ -0,0 +1,5 @@
+[
+  {"sku": "CAMEL-TSHIRT", "qty": 120},
+  {"sku": "CAMEL-MUG", "qty": 42},
+  {"sku": "CAMEL-CAP", "qty": 0}
+]
diff --git a/ai/agent-tools/test/agent-tools.citrus.it.yaml 
b/ai/agent-tools/test/agent-tools.citrus.it.yaml
new file mode 100644
index 0000000..e6b3c17
--- /dev/null
+++ b/ai/agent-tools/test/agent-tools.citrus.it.yaml
@@ -0,0 +1,63 @@
+name: agent-tools-test
+description: A local model answers the customers' questions with the shop's 
route tools
+actions:
+  - camel:
+      infra:
+        run:
+          service: ollama
+          # a side port, so an Ollama already installed on the machine does 
not get in the way
+          port: 11435
+  # the container pulls the model after it starts; wait until Ollama lists it
+  - repeatOnError:
+      until: i >= 60
+      index: i
+      autoSleep: 5000
+      actions:
+        - http:
+            client: "http://localhost:11435";
+            sendRequest:
+              GET:
+                path: "/api/tags"
+        - http:
+            client: "http://localhost:11435";
+            receiveResponse:
+              response:
+                status: "200"
+              validate:
+                - jsonPath:
+                    - expression: "$.models[?(@.name=='granite4:3b')].name"
+                      value: "granite4:3b"
+  - camel:
+      cli:
+        run:
+          integration:
+            name: "agent-tools"
+            file: "../agent-tools.camel.yaml"
+            # the properties file would win over an inline property, so all of 
them are given here
+            systemProperties:
+              properties:
+                - name: openai.base.url
+                  value: http://localhost:11435/v1
+                - name: openai.model
+                  value: granite4:3b
+                - name: openai.api.key
+                  value: ollama
+          resources:
+            - "questions/question-1.txt"
+            - "questions/question-2.txt"
+            - "questions/question-3.txt"
+            - "stock.json"
+            - "orders/order-1001.json"
+            - "orders/order-1002.json"
+            - "orders/order-1003.json"
+  # the model asked the shop: each question calls at least one tool before its 
answer
+  - camel:
+      cli:
+        verify:
+          integration: "agent-tools"
+          logMessage: "Tool order_status(ORD-1003)"
+  - camel:
+      cli:
+        verify:
+          integration: "agent-tools"
+          logMessage: "Answer question-3:"
diff --git a/ai/docling-langchain4j-rag/metadata.json 
b/ai/docling-langchain4j-rag/metadata.json
index 3a39cc1..52b5846 100644
--- a/ai/docling-langchain4j-rag/metadata.json
+++ b/ai/docling-langchain4j-rag/metadata.json
@@ -2,7 +2,7 @@
     "title": "Document Analysis with Docling and LangChain4j RAG",
     "description": "Documents dropped in a directory are converted to Markdown 
by a Docling service, analysed by a local Ollama model through 
langchain4j-chat, and written as a report to an output directory; an HTTP 
endpoint answers questions against the latest document.",
     "level": "ai",
-    "order": 5,
+    "order": 6,
     "teaches": {
         "components": [
             "file",
diff --git a/ai/openai-pii-redaction/metadata.json 
b/ai/openai-pii-redaction/metadata.json
index 6a45e1e..54f612a 100644
--- a/ai/openai-pii-redaction/metadata.json
+++ b/ai/openai-pii-redaction/metadata.json
@@ -2,7 +2,7 @@
     "title": "OpenAI PII Redaction",
     "description": "Text typed on standard input is sent to an 
OpenAI-compatible model with a JSON schema that asks for the personal 
identifiers redacted, and the redacted text is printed on standard output.",
     "level": "ai",
-    "order": 4,
+    "order": 5,
     "teaches": {
         "components": [
             "stream",
diff --git a/camel-jbang-example-catalog.json b/camel-jbang-example-catalog.json
index ffe7f8b..33c2074 100644
--- a/camel-jbang-example-catalog.json
+++ b/camel-jbang-example-catalog.json
@@ -1,4 +1,63 @@
 [
+    {
+        "name": "ai/agent-tools",
+        "title": "AI agent with route tools",
+        "description": "A local Ollama model answers three customer questions 
about orders and stock; it knows nothing of the shop, so camel-openai offers it 
the two routes tagged shop as tools, runs the tool calls it asks for and hands 
back the results, and the log shows each question, each tool call and the 
answer; with --observe the Camel TUI shows every agent run, its model and tool 
calls, the tokens and the conversation.",
+        "level": "ai",
+        "teaches": {
+            "components": [
+                "openai",
+                "ai-tool",
+                "file",
+                "log"
+            ],
+            "eips": [
+                "setBody",
+                "pollEnrich",
+                "choice",
+                "unmarshal"
+            ],
+            "languages": [
+                "simple",
+                "groovy",
+                "constant"
+            ],
+            "dataformats": [
+                "json"
+            ]
+        },
+        "tags": [
+            "shop",
+            "ai",
+            "llm",
+            "ollama",
+            "openai",
+            "agent",
+            "tools",
+            "observability"
+        ],
+        "bundled": false,
+        "requiresDocker": true,
+        "hasCitrusTests": true,
+        "files": [
+            "README.md",
+            "agent-tools.camel.yaml",
+            "application.properties",
+            "orders/order-1001.json",
+            "orders/order-1002.json",
+            "orders/order-1003.json",
+            "questions/question-1.txt",
+            "questions/question-2.txt",
+            "questions/question-3.txt",
+            "stock.json"
+        ],
+        "infraServices": [
+            "ollama"
+        ],
+        "needs": "Camel 4.24 or newer, a local model: `ollama pull 
granite4:3b`",
+        "ciSkip": true,
+        "order": 4
+    },
     {
         "name": "ai/docling-langchain4j-rag",
         "title": "Document Analysis with Docling and LangChain4j RAG",
@@ -44,7 +103,7 @@
         ],
         "needs": "a local model",
         "ciSkip": true,
-        "order": 5
+        "order": 6
     },
     {
         "name": "ai/langchain4j-chat",
@@ -169,7 +228,7 @@
         ],
         "needs": "an OpenAI-compatible API: set `OPENAI_API_KEY`",
         "ciSkip": true,
-        "order": 4
+        "order": 5
     },
     {
         "name": "ai/ticket-classifier",
diff --git a/generate-catalog.sh b/generate-catalog.sh
index 840921f..eb8bd24 100755
--- a/generate-catalog.sh
+++ b/generate-catalog.sh
@@ -158,7 +158,7 @@ GROUPS = [
     ("connect", "Connect without a service", "Files, an HTTP client and a REST 
server; everything runs inside the example."),
     ("connect-service", "Connect to one service", "SQL, JMS, MQTT, Kafka and 
FTP against a service the Camel CLI starts for you with `camel infra run`."),
     ("contracts", "Contracts and security", "An OpenAPI contract served and 
called, and an API protected by Keycloak."),
-    ("ai", "AI", "A local model writing text, routes exposed as MCP tools, RAG 
over documents, PII redaction."),
+    ("ai", "AI", "A local model writing text, routes exposed as MCP tools, an 
agent calling route tools, RAG over documents, PII redaction."),
     ("cloud", "Cloud", "A cloud service, run locally through LocalStack and 
switched to the real thing by properties."),
     ("showcase", "Showcase", "Tooling demos outside the ladder: the TUI, a 
memory leak, message sizes, log analysis."),
 ]

Reply via email to