Hysen Labs
Open-source project
sema-lisp/sema avatar
sema-lisp

sema

A Lisp with first-class LLM primitives, implemented in Rust

34 stars1 forksRustMIT
DEEP OPEN-SOURCE ANALYSIS

Sema

A Scheme like Lisp with first class LLM primitives, implemented in Rust and compiled to a fast bytecode virtual machine shipped as a single binary.

Core idea

Sema is a Lisp where LLM agents are language primitives rather than an SDK. Prompts are s expressions, conversations are persistent data structures, and LLM calls are just another form of evaluation, using Clojure style keywords, map literals and vector literals. The pitch is that the usual agent loop scaffolding, retries, caching, cost caps, rate limits, tool dispatch and conversation state, becomes the runtime, so a script stays the size of its idea and ships as a single binary that a coding agent already speaks.

Features

Examples in the README show deftool for defining tools the LLM can call, such as reading or editing a file or running a shell command, and defagent to create an agent with tools, a system prompt and a turn limit. Budget scoping uses llm/with-budget in US dollars and is automatically restored after the block. Other forms cover llm/complete for a simple completion, llm/extract for structured data returned as a map, llm/classify for labels, multi turn conversations as immutable data, streaming, concurrent batch, and vision extraction plus multimodal chat with images.

Distribution

Sema compiles to a bytecode virtual machine and ships as a single binary, with a public playground at sema.run and documentation at sema-lang.com including a for agents page and examples. It is licensed MIT and carries a code coverage badge. The README notes a coding agent with file tools, safety checks and budget tracking can be written in about forty lines, illustrating how the runtime absorbs the scaffolding.

Editorial conclusion

Sema is MIT licensed and reported thirty four stars at indexing, implemented in Rust with a homepage at sema-lang.com and a public playground at sema.run.

DEEP OPEN-SOURCE ANALYSIS

Official sources

Community notes

Community notes