You type camel many times a day: camel run, camel ps, camel get route, camel log. And now so do AI agents, which call the CLI over and over in a loop. In Camel 4.24 the Camel CLI got a lot of attention. This post is about three changes:
- it is fast: a command such as
camel versionorcamel pstakes about 125 ms, where 4.23 took more than a second - it runs on aesh instead of picocli
- it is a CLI an AI agent can trust: exit codes, errors on stderr, JSON output and timeouts
And then some of the smaller things that make the day better.
Fast
This is the time a command takes, from typing it to the prompt coming back. It is the median of 15 runs of the camel launcher of the distribution (4.23.0, and 4.24 built from main), after 3 runs to warm up, on an Apple M4 Pro with Java 25:
| Command | Camel 4.23 | Camel 4.24 |
|---|---|---|
camel version | 1233 ms | 128 ms |
camel ps | 1223 ms | 122 ms |
camel init --help | 1196 ms | 138 ms |
camel get --help | 1182 ms | 167 ms |
camel run --help | 1202 ms | 256 ms |
camel --help | 1198 ms | 256 ms |
That is about 10 times faster for the commands you use the most. A camel ps now comes back before you notice it was gone. For you that is nice. For an AI agent it matters much more, as we will see below.
Where did the second go? Not into one big fix, but many small ones, found by measuring first:
- Only the command you run is created. The Camel CLI has more than 160 commands. Camel 4.23 created all of them, with all their options, and those of every plugin, before it ran one. Now
camel pscreatescamel ps, and a plugin command creates only that plugin. - No logging unless something logs. Most commands log nothing, yet log4j was started for each of them. Also the check for a newer version of the CLI started log4j, before every command. And a Camel class that only has a logger no longer starts it either.
camel psloads 1,591 classes, and none of log4j or Jackson. In 4.23 it loaded 5,373, of which 704 were of log4j. - No terminal when there is none. A command whose output goes to a file or a pipe built a terminal only to find out that there was none, to leave out the colors.
- The launcher script no longer runs
java -versionto find out the Java version. It reads the release file of the JDK instead, which saves starting a second JVM. - The JVM no longer waits at exit for the thread of an HTTP client that a command created but never used, or for the update check.
- The distribution runs from plain jars. Camel 4.23 ran the CLI from one Spring Boot fat jar, which has its own class loader for the nested jars. Camel 4.24 has the jars in
lib/, next to a thin launcher jar. - Class data sharing. Because the jars are plain jars now, the JVM can keep the classes a command loads in an archive, and map it in on the next run. The
camelscript does this by itself: the first run of a command writes the archive (under~/.cache/camel-cli/cds/), and the runs after it are faster. SetCAMEL_CDS=falseto turn it off. Without the archive,camel versiontakes 154 ms instead of 128 ms, andcamel --help411 ms instead of 256 ms. - aesh. More about that below.
And there is more to come. At the start of each command, aesh looks through all 344 jars of the CLI for its registry of commands, which only its own jar has. We asked for a way to skip that search (aesh#779), which should take about another 40 ms off every command.
On aesh instead of picocli
The Camel CLI has used picocli from its start. picocli served us well, but it moves slowly now: its last release was in April 2025. In Camel 4.24 the Camel CLI parses its command lines, prints its help and completes its commands with aesh, the Java library for command line tools by Ståle Pedersen.
The main reason for the move is not speed. It is that aesh is a living project, with a maintainer we can talk to. We saw that during the port. Before switching, we ported all of the CLI on a branch and wrote down every gap and bug we found in aesh: 36 issues and 17 pull requests. Ståle fixed or merged nearly all of them within days, and released aesh 3.19 and 3.19.1 with them. Thank you, Ståle!
aesh is a little faster too. In our measurements during the port, aesh took about 20 ms off camel version, and about 60 ms off camel --help. That is a small part of the second above, but it all adds up.
What changes for you
For using the Camel CLI, not much. The commands and their options are the same. To be sure of that, before the switch we wrote a test with 2207 command lines and what picocli made of them, and one with the help of all commands and the errors of wrong command lines. The aesh port had to give the same answers.
The help looks a little different: the default value of an option is on a line of its own (Default: ...).
An argument @file is replaced by the arguments in that file, as it was with picocli, such as camel @run.txt.
If you wrote your own plugin for the Camel CLI, it must be changed and built for Camel 4.24: a plugin adds its commands to a CommandTree instead of a picocli CommandLine, and the commands use the aesh annotations. The upgrade guide has the details.
A CLI that an AI can trust, and that keeps up with it
More and more, the Camel CLI is not called by a person, but by an AI agent. The agent works in a loop: it runs a command, reads what came back, decides the next step, and runs the next command. To build and fix an integration it looks up a component, writes a route, validates it, runs it, reads the log, sends a message, checks the routes, and goes around again. That is easily 50 or 100 calls of the CLI for one task.
Fast matters more for an AI than for you
When you type a command, one second is a short pause. You were reading the last output anyway. For an agent, every call is a stop: the loop waits for the CLI before the model can think about the next step. 100 calls of a CLI that takes 1.2 seconds is two minutes of waiting. At 125 ms it is less than 13 seconds.
And it is not only about time. When a check is cheap, an agent does it: it looks up the option instead of guessing it, it validates after each change, and it checks the routes once more after the reload. When every call costs a second, there are fewer of those checks for the same time and the same budget, and more guessing. A fast CLI makes the agent quicker, and it makes it better, because it can afford to verify. Running a local model, where the model is already the slow part, you want every other part of the loop to be as fast as possible.
An answer an AI can trust
An agent cannot see your screen. All it has is the exit code and the text that came back, and it builds its next step on that. A person reads “ERROR: no integration found” and knows what to do, even when the exit code says 0. An agent that gets 0 for a command that did not work takes it as a fact, and goes down the wrong path. A command that waits for a terminal that is not there leaves the agent stuck until its own timeout. Every answer the CLI gets wrong costs the agent more than the command took.
So in Camel 4.24 the Camel CLI has a contract: the exit codes and output. The same contract is good for a script and a CI job too:
| Exit code | Meaning |
|---|---|
| 0 | success |
| 1 | the command failed |
| 2 | usage error: a wrong option or argument |
| 3 | not found: no integration, route, Kamelet or plugin of that name |
| 66 | a file or directory that does not exist |
| 70 | internal error |
| 124 | timed out: the integration did not answer in time |
And with it:
- Errors go to stderr, so the output on stdout can be read as is.
- With
--json, stdout is exactly one JSON document, also when the command fails, so it can always be parsed. A listing with nothing in it prints[]. - Commands that talk to a running integration take a
--timeout, and say so when the integration did not answer, instead of waiting forever. - No command waits for a terminal that is not there. Without one,
--watchshows the output once,camel logdoes not follow, and a command that needs a terminal, such ascamel debug, exits with2instead of hanging a CI job. camel stopandcamel restartwait until the integration has stopped, and exit with124when it did not stop in time.camel stopwithout a name stops the integration that runs. When several run, it stops none, lists them, and exits with2: give the name, or--allto stop them all. When we had agents test the CLI, the barecamel stopof one agent stopped the integrations of the others.- A kill of
camel run --jvm-args=...or--jvm-debug, as a supervisor or an agent sends it, stops the JVM that runs the integration too. It kept running, with nothing left to stop it. camel run --backgroundwaits for the integration to start, and a file that does not exist fails before anything starts.- A route that fails to start exits with
1, which says “fix the route”, with one line on stderr: the stack trace is in the log already. Before, it was70, which says “a bug in Camel, do not retry”, so an agent gave up instead of fixing its route. - With
ordersandorders-v2running,camel stop ordersstopsorders. A name was a prefix only, so it stopped both, and every command for one integration failed fororders. A name that no integration has is still a prefix. - An option given on the command line wins over
application.properties. Withcamel.main.tracing=falsein the file,camel run --traceprinted no trace. - No ANSI color codes when the output is a file or a pipe, unless
--logging-coloris given:camel cmd send --reply | cathad them. camel validateexits with66for a file that does not exist, and for nothing to validate. It said “Validation success (files:0)” for anotes.txt. So docamel export,camel dependencyandcamel transform routefor a file that does not exist, with the message on stderr.- A
--camel-versionthat was never released saysCamel version 9.9.9 not foundand exits with3, incamel catalog,camel docandcamel validate. It said “Cannot resolve dependencies”, which reads like a network problem, and that still exits with1.camel version set 9.9.9refuses it, where it stored it for every later command to fail on. X=$(camel eval expression ...)is only the value. The Camel thatcamel evalstarts for itself printed its state first. A syntax error prints what is wrong, without the 30 lines of stack trace before it, and--jsongives the value or the error as JSON.- The
--timeoutofcamel cmd sendbounds the send, not only the wait of the CLI. A send todirect:nopewaited 30 seconds for a consumer and ended in a timeout of the CLI; now it fails at once with “No consumers available”. - Options do with
--jsonwhat they do without:camel cmd route-structure --json --filter=ordersprinted every route, and a filter that matches nothing exits with3.camel cmd receive --output=jsonhas only JSON on stdout. - A row of a JSON listing says which integration it is of, with
pidas a number andname, and a list is a list also for one integration. camel cmd send --jsonprints the outcome of the send, and the reply, as one JSON object, andcamel trace --action=dump --jsonprints one JSON object per trace, a line each.- Only the result goes to stdout:
camel generate schema --verbosetells what it does on stderr, andcamel generate restprints only the REST DSL, where the banner of the OpenAPI generator made> rest.xmlinvalid XML. - A missing argument says
Missing argument: ..., with the usage line under it, wherecamel docprinted its whole description. camel mcpwithout JBang says how to run the MCP server without it, where it exited with70and a stack trace.
The AI tools of the Camel CLI, the MCP server and camel ask, pass these failures on to the agent as errors, so the model sees what went wrong instead of guessing it. And they act on the integration the agent named: a runtime tool takes the integration as nameOrPid, name or pid, where a name was ignored and the tool acted on the only integration that ran, which could be another app. camel_get_files reads a large file in parts, instead of an answer of a million tokens, and camel_edit_file keeps a replace of only whitespace, which matters in YAML. The lines of source code in the answers are as they are in the file, without \", and a misspelled name in the catalog, such as kafak, suggests kafka, and asking for it a third time says so again, rather than to go on with the options the answer gave.
The MCP server names its own tools in its answers: some answers named the tools of camel ask, which the server does not have. Every tool costs context in every session, so camel_dependency_check now does the security audit as well, and four tools that were stale are gone. camel_render_route_diagram works when it is called several times at once, and is a second faster. In camel ask, the code of an answer is checked, and an option that does not exist is marked. A chat keeps its history bounded, and a question that fails leaves no trace in it. And the AI clients of the CLI work with the current Claude models.
Keeping up with the agent
An agent does not only start commands, it talks to the integration it is building: it sends a message, reloads a changed route, and asks how the integration is doing. In Camel 4.24 those got faster, and some of them got a command of their own:
- An action is answered in about 25 ms, such as
camel cmd sendorcamel get route, where it took about 110 ms. The CLI and the integration looked for each other’s files every 100 ms; now they look much more often, but only read the folder when it changed. camel run --backgroundreturns when the routes are up, about 0.4 s after Camel started, where it was about 1.3 s. The integration writes its status at once when it has started, instead of on the next tick of a second.camel cmd reload --wait --jsonreloads the changed files of an integration in dev mode at once, and says how it went:reloaded,unchangedorfailed, with the error. Before, an agent wrote a file and then had to guess when the reload had happened.camel status <name> --jsonis the state of an integration in one call: its routes, the problems first, the last errors and log lines, the HTTP endpoints, and the oldest exchange in flight. In about 0.3 s, wherecamel get route,get health,get errorandcamel logtook about a second together.- A send that waits does not hold up the rest. A
camel cmd sendthat waits, such as a--pollof an empty endpoint, held upcamel stop(22 seconds in our test) and the status of the integration. A send now runs on a thread of its own. - The trace file stays small. With tracing on, the trace file grew without end, about 15 MB a minute at 100 messages a second, and
camel traceread it all each time. It starts again at 10 MB, andcamel tracefollows the new file.
Fast and trustworthy go together: the agent calls the CLI often because each call is cheap, and it can act on what comes back because the answer is right.
Stay up to date
The web installer installs the latest release:
curl -fsSL https://camel.apache.org/install.sh | shYou can ask it for the newest LTS release, or the newest release of a line, and camel self-update stays on it:
curl -fsSL https://camel.apache.org/install.sh | sh -s -- --version LTS
curl -fsSL https://camel.apache.org/install.sh | sh -s -- --version 4.24And new in 4.24: try what is coming before it is released. Apache publishes a nightly build of the Camel CLI, and camel self-update can switch to it, and back:
camel self-update --version SNAPSHOTNightly builds are development builds for testing, not Apache releases.
The smaller things
-
camel cmd sendcan feed a route:--repeatand--intervalsend many messages, and--body=file:<folder>sends the files of a folder, one message per file.camel cmd send --endpoint=kafka:refunds --body=file:refund.json --repeat=50 --interval=100..500 -
camel run --data-dirnames the folders with data files under the source directory, which dev mode does not watch, so writing a file there does not reload the routes. Nor do the files a run writes itself:camel dev > run.logreloaded the routes every 2 seconds. Log files,target,.gitand the.camelfolders are not watched. -
In dev mode, a change of
application.propertiesis reloaded, and with files in two folders, such ascamel run a.camel.yaml other/b.camel.yaml --dev, both are watched: only the folder ofb.camel.yamlwas. -
camel run '*'works when the shell does not expand the*, such as the Windows command prompt: it said “No routes found in: *”. -
A value in the configuration that an option does not take, such as
runtime=springboot, says which file, key and value; every command with--runtimefailed with “DefaultValueProvider failed for option runtime”.camel config setrefuses such a value, andcamel config unsetof a key that is not set exits with3. -
--excludetakes a folder, such as--exclude=sub/**, and works forcamel run .,--source-dirandcamel dev, where it was left out. -
In dev mode, a reload applies changed
camel.beansandcamel.componentproperties, and a dependency added tocamel.jbang.dependencieswhile the app runs is downloaded. -
The log of the previous run is kept, also for the Spring Boot and Quarkus runtimes, so you can read why it failed at startup.
camel dirty --cleanremoves those logs too. -
camel cmd route-diagram,route-structureandroute-topologyread Java routes with the Java DSL parser, without compiling them. -
camel cmd send --body=...without a name sends to the integration that runs, such as aftercamel run --stub=jms. It sent to an empty Camel of its own, and said “Sent (success)”. An endpoint of a system outside the integrations, such askafka:topic, is still sent from the CLI. -
A
camel-cli.propertiesin the current directory is laid over the global~/.camel-cli.properties, rather than hiding all of it. -
From the launcher,
camel exportexports the Citrus tests,--jvm-debugand--jvm-argswork without JBang, andcamel.bathas Windows line endings. -
camel kuberneteshonours--kube-configin all commands, andcamel kubernetes logsstops at a pod that has finished.camel kubernetes exportputs--env,--config,--volume,--labeland--annotationin a CronJob and a Knative Service too, where they were dropped without a word. A configmap and a secret of the same name are two volumes, a cron schedule such as0 1,13 * * *keeps its comma,--profilekeeps the traits ofapplication.properties, and--trait route.annotations=k=vgives an annotation.camel kubernetes deletedeletes the CronJob too. -
camel debug --breakpoint tickand--source-dirwork; the debug options were taken apart wrongly before they went tocamel run. -
camel initgives a Kamelet its kind from the file name, puts./x.yamlin--dir, and refuses a Java file whose name is not a class name, such asmy-route.java. -
camel doctorchecks a nightly build against the Apache snapshots, where it reported Maven as failed. -
camel infra stop --killno longer kills a process that got the pid of a service that was killed hard. -
camel cmd logger --logging-level=BOGUSis a usage error instead of setting the level toERROR, andcamel cmd browse --endpoint=seda:foo, the example of its own help, findsseda://foo. -
camel generate rest --routeswrites routes that validate and run, with a log step to replace, and the DTOs it generates compile in a Camel 4 project, withjakartaimports.camel test initdoes not overwrite a test you edited, unless--force. -
camel get consumerandcamel get producerwork again: in 4.23 they failed with exit70for an integration with a consumer.camel get transformerno longer warns for each integration without transformers. -
camel dependency copyresolves the dependencies together, solib/has one version of each library, andcamel dependency updatekeeps the line endings of the file. -
A plugin built for another Camel version no longer stops
camel runandcamel export: they warn and go on without it. -
camel run --example ... --backgrounddeletes the folder of the example when the integration stops.--profilereadsapplication-<profile>.propertiesnext toapplication.properties, not from the current directory, and the port ofplatform-httpis the one of the run, not of an earlier run in the same directory. -
camel catalog --filter=aws2matches a part of a name, the options ofcamel update runare kebab-case (--dry-run, the camelCase names still work),camel transform route --output=Out.javanames the classOut, and a completion incamel editkeeps the rest of the line.
Try it
Try it now with the nightly build:
camel self-update --version SNAPSHOTWhen Camel 4.24 is released, camel self-update --version 4.24 switches back to the releases. Or install it with the web installer above.
And then type camel ps, and see how fast it comes back.