I've been building CLI tools specifically for AI agent workflows and found Pascal to be unusually well-suited for this use case.
AI coding agents (Claude Code, Cursor, Aider, etc.) accomplish tasks by invoking CLI tools repeatedly: grep, cat, ls, and custom scripts. A single task might involve hundreds of tool invocations. When agents need deterministic calculations, they typically either generate Python scripts on the fly or attempt the math with the LLM itself. Both approaches are wasteful: the first has significant startup overhead, the second uses tokens and is error-prone.
The better approach is purpose-built CLI tools the agent can call directly. This is where Pascal excels.
Startup Time MattersWhen a tool is invoked hundreds of times per task, startup latency dominates. Here are some benchmarks from
bdrung/startup-time:
| Language | Intel Core i5 2400S | Raspberry Pi 3 |
| Pascal (fpc) | 0.08 ms | 0.66 ms |
| C (gcc) | 0.26 ms | 2.19 ms |
| Go | 0.41 ms | 4.10 ms |
| Rust | 0.51 ms | 4.42 ms |
| Python | 9.43 ms | 91.85 ms |
Pascal starts 3x faster than C and over 100x faster than Python. For a 1,000-call loop, Python spends ~90 seconds just on interpreter startup. Pascal finishes the entire workload before Python completes 30 iterations.
Even with NumPy acceleration, Python's startup cost exceeds the actual computation time for most simple workflows. NumPy and such only really excel in long matrix solving problems and complex mathematical tasks. For simple mathematical workflows with a sequence of calculations and logic (like in the case study below), any modern CPU will finish the task instantly. The bottleneck is loading the runtime, not doing the math.
The tiny binaries (~130KB) fit easily in the L3 cache of any modern CPU. When invoking the tool a thousand times, 999 of them will be cache hits.
Case Study: Structural Engineering ToolsFor my work, I built a suite of reinforced concrete design tools following the Brazilian NBR 6118 standard:
Repository: github.com/felcardoso1/concrete_design_toolsThese tools calculate steel reinforcement for flexure design, shear capacity, etc. An AI agent can now call these directly instead of regenerating the formulas each time (and risk making a dangerous error in the process).
I tested these tools with a few different AI agents (using a skills.md file in the same folder to "explain" to the AI how to use the tools), and they used them in their workflows seamlessly, as smoothly as they use grep, ls, etc.
Why Pascal SpecificallyOther compiled languages produce static binaries, but Pascal has some advantages for this niche:
- Fastest startup in the benchmarks—even faster than C, partly because it's statically linked
- Zero dependencies: Single static binary. No environment setup, no package management. Works immediately in sandboxed AI environments. An AI agent will often waste time awkwardly setting up a Python environment and installing dependencies.
- LLM-friendly syntax: I converted these tools from Fortran 90 code using Claude. The conversion was essentially one-shot—working code on the first attempt. Pascal's explicit structure and strong typing seem to reduce the logic errors LLMs make with more permissive languages. The lack of complex syntax with lots of symbols like Rust or C++ made it easier for the LLM to use its "intuition" to solve the problem. Keep in mind that LLMs don't even have as much Pascal code in their training data as they have Python and other languages!
- Simple toolchain—"fpc source.pas" produces a ready binary
- Readable syntax—easier for LLMs to generate and modify correctly. Definitely easier to read than Rust or C.
- Mature standard library—JSON, XML, CSV, HTTP, hashing, regex all available without external dependencies
- Cross-compilation—build Windows/Linux/macOS binaries from one machine
The language's age is an asset here. The runtime is minimal because there's no garbage collector, no JIT, no framework initialization, no modern bloat whatsoever. It just runs. Since the idea is tools that follow the Unix philosophy of doing one thing well, it doesn't need any of that. It's a simple sequence: start, do the task, output, exit.
Output Design for Token EfficiencySince LLM API calls are billed per token, I added a concise output mode:
$ ./flexao --bw=20 --h=50 --d=46 --fck=25 --fyk=500 --mk=120
As=9.94 As'=0.00 dominio=3 rho=0.99The agent gets exactly the data it needs without parsing verbose text.
ConclusionFor CLI tools designed to be called by AI agents—especially tools that wrap deterministic calculations such as engineering design tasks—Pascal offers a combination of startup speed, deployment simplicity, and code clarity that modern alternatives don't match.
The repository linked above is MIT licensed. Feedback is welcome!