Rust is the best language for coding agents
I think Rust is the most powerful language for coding agents right now.
Why? Because Rust gives agents the ability to move anywhere up and down the ladder of abstraction in computing and has a strong enough type system to create guardrails against common pitfalls of coding agents.
No other language has these two traits:
- is low-level enough to allow you to manipulate bits and bytes, think/design memory layout, system calls, speak the C ABI, etc. allowing you to write efficient performant sensitive code and do anything
- has a Standard ML / Haskell / Hindley-Milner style type-system with enough abstractive power to write high-level code and encode important constraints and invariants into types, allowing you to offload some mental compute and reasoning to the compiler.
Prior to coding agents, all of this came at the cost of verbosity. The “type algebra” you needed to solve to appease both borrow checker and type errors in the compiler creates a material drop in productivity. But since all of that now is delegated to agents, you really get to have your cake and eat it too.
An exampleλ
Lately, I write all my hobby graphics programming projects with agents + Rust. Prior to agents, I used to use Zig because I found iteration speed faster.Because Rust speaks the C ABI, it can use Sokol (a C library) to write cross-platform graphics code (Linux, macOS, Windows, WGPU).
Rust is low level enough that I can prompt the agent to follow data-oriented design, to pack data efficiently and think about CPU caching, etc.
And I use Rust’s powerful type system to prevent the agent from making common mistakes.
A very common type of mistake in graphics programming is mixing up coordinate spaces.
This type system is powerful enough to encode which coordinate spaces and transformations are valid in the type system.
The euclid Rust crate fixes this:
use euclid::{point2, vec2, Point2D, Translation2D, Vector2D};
struct WorldSpace;
struct ScreenSpace;
type WorldPoint = Point2D<f32, WorldSpace>;
type WorldVector = Vector2D<f32, WorldSpace>;
type ScreenPoint = Point2D<f32, ScreenSpace>;
fn main() {
let player: WorldPoint = point2(10.0, 20.0);
let movement: WorldVector = vec2(5.0, 0.0);
// Allowed: point + vector in the same space.
let moved_player = player + movement;
// Allowed: explicitly convert from world space to screen space.
let world_to_screen = Translation2D::<f32, WorldSpace, ScreenSpace>::new(100.0, 50.0);
let player_on_screen: ScreenPoint = world_to_screen.transform_point(moved_player);
// Disallowed: can't mix coordinate spaces.
let bad: ScreenPoint = player;
}
This lets agents not make the stupid mistake of mixing world space coordinates with screen space coordinates:

Important to note is that prior to agents, I never used euclid because I found it too verbose and a hindrance to my productivity.
But now it doesn’t matter because I can offload all of that verbosity to the agent and because LLMs have supreme working memory and never get tired.
Strong defaultsλ
The default way to write Rust encourages good behaviour.Rust enums are fully powerful algebraic data-types ripped right out of FP, and pattern matching is the default and most ergonomic, low-friction way to manipulate them. This is good because it is exhaustive and will error if you forget to check a variant.
I can’t tell you how many times I’ve seen coding agents write TypeScript and
prefer if/else statements over switch to match a type, and how many times I’ve
accidentally let that slip through and how it caused a bug later.