An Introduction to Qosm
A language for secure AI agents.
Qosm is a language for building AI agents that are secure by construction.
You don't write Qosm by hand. Your LLM writes it. The Qosm compiler guarantees the code can only do what you explicitly allow — no prompt injection, no credential leaks, no unauthorized access. Not by guardrails or sandboxes, but by the type system itself.
Here's what a Qosm agent looks like:
let classify text =
my_claude @{sentiment: String, confidence: Float}
`Classify the sentiment of: {{ text }}`;
let analyze text =
match classify text with (
| Ok{value: r} -> .sentiment r ++ " (" ++ to_string (.confidence r) ++ ")"
| Err{value: e} -> "error: " ++ .message e);
The code looks unfamiliar — we'll get to how it works. For now, notice a few things:
my_claudeis a capability — a typed function the host provides. The agent can't call anything the host didn't explicitly give it.@{sentiment: String, confidence: Float}tells the model the exact return shape. The compiler enforces it.- The type system tracks that this code uses the
LLM.Calleffect. You can see exactly what any agent does just by reading its type signature.
This guide will walk you through the Qosm workflow, explain what makes it different, and build a complete agent together. Let's start.
How to read this guide
-
The Qosm Workflow — Connect your IDE, configure capabilities, and let your LLM write code. This is how you'll work with Qosm every day.
-
What Makes Qosm Different — Capabilities, effects, code mode vs tool mode, and attenuations. The ideas that make Qosm agents safe by construction.
-
Tutorial: Self-Healing Agent — Build a real agent end-to-end: monitor a service, diagnose errors with an LLM, and push fixes via GitHub.
-
Workspace, SDKs, Reference, Language — The details, when you need them.