A programming language for orchestrating AI agents.
Concerto provides a Rust-like syntax purpose-built for designing complex AI harnesses. Define models, tools, memory databases, and multi-step pipelines as code -- then let the Concerto runtime handle LLM connections, structured output validation, and external integration.
Prompt engineering is time-consuming. LangChain-style libraries are task-specific. Concerto gives you a full programming language to orchestrate agents -- with type safety, error handling, and composable pipelines.
Concerto.toml
[project]
name = "classifier"
version = "0.1.0"
entry = "src/main.conc"
[connections.openai]
provider = "openai"
api_key_env = "OPENAI_API_KEY"
default_model = "gpt-4o"src/main.conc
schema Classification {
label: String,
confidence: Float,
reasoning: String,
}
model Classifier {
provider: openai,
base: "gpt-4o",
temperature: 0.2,
system_prompt: "You are a document classifier.",
}
fn main() {
let document = "The quarterly earnings report shows a 15% increase...";
let prompt = "Classify this document: ${document}";
let result = Classifier.execute_with_schema<Classification>(prompt);
match result {
Ok(classification) => emit("result", classification),
Err(e) => emit("error", e),
}
}
- Models as first-class constructs -- Define LLM-powered models with base model, provider, temperature, system prompt, tools, and memory
- Model memory --
memorydeclarations pluswith_memory(...)for multi-turn context injection and auto-append chat history - Dynamic tool binding --
with_tools([...])adds tools per-execution,without_tools()strips default tools for focused runs - Schema validation -- Define expected output structures; runtime validates and auto-retries on mismatch
- First-class pipelines --
pipeline/stagekeywords for declarative multi-model workflows - Bidirectional emit system -- Runtime outputs that enable programmatic integration with host applications
- In-memory databases -- Map-like storage for model query design and harness state (ledger)
- Tools -- Define tools as classes that models can invoke, with auto-generated parameter schemas
- Strong type system -- Static typing with inference, including AI-specific types (
Prompt,Response,Schema<T>) - Dual error handling --
Result<T,E>with?propagation andtry/catchfor flexibility - Async-native -- All model execution is async; parallel execution with
await (a, b, c) - Pipe operator --
prompt |> model.execute() |> parse_schema(Output) |> emit("result") - LLM provider agnostic -- use manifest-based
[connections.*]entries for OpenAI, Anthropic, Google, Ollama, or custom providers
.conc Source Code
|
v
+-----------+
| COMPILER | Lexer -> Parser -> AST -> Semantic Analysis -> IR Generation
+-----------+
|
v
.conc-ir (JSON-based Intermediate Representation)
|
v
+-----------+
| RUNTIME | Stack-based VM with model, tool, memory, and emit systems
+-----------+
|
v
Emits (programmatic output to host application)
schema Classification {
label: String,
confidence: Float,
}
pipeline DocumentProcessor {
stage extract(doc: String) {
let text = Extractor.execute(doc)?;
text
}
stage classify(text: String) {
let result = Classifier.execute_with_schema<Classification>(text)?;
result
}
stage route(classification: Classification) {
match classification.label {
"legal" => LegalModel.execute(classification)?,
"technical" => TechModel.execute(classification)?,
_ => DefaultModel.execute(classification)?,
}
}
}
fn main() {
let result = DocumentProcessor.run(input_document);
match result {
Ok(output) => emit("processed", output),
Err(e) => emit("error", e),
}
}
git clone https://github.com/Digine-Labs/concerto-lang.git
cd concerto-lang
cargo build --releaseBinaries will be in target/release/:
concertoc-- Compiler (.conc->.conc-ir)concerto-- Runtime (executes.concdirectly or precompiled.conc-ir)
- Write a Concerto program:
// hello.conc
fn main() {
emit("greeting", "Hello from Concerto!");
}
- Compile it:
concertoc hello.conc- Run it:
concerto run hello.concOptional: run the compiled IR artifact:
concerto run hello.conc-irexamples/hello_agent-- minimal single-model flowexamples/tool_usage-- local tools + MCP tool interfacesexamples/multi_agent_pipeline-- multi-stage orchestrationexamples/agent_memory_conversation-- spec 24 memory patterns (with_memory, manual mode, message queries)examples/dynamic_tool_binding-- spec 25 dynamic tool composition (with_tools,without_tools)examples/host_streaming-- spec 27 listen syntax with external agent streamingexamples/bidirectional_host_middleware-- self-contained bidirectional agent middleware test (includes local agent process)examples/core_language_tour-- broad core syntax/semantics coverage (types, control flow, loops, traits/impls, hashmap, Result)examples/modules_and_visibility-- module/import/visibility syntax coverage (use,mod,pub)examples/error_handling_matrix-- Option/Result +?+try/catch/throwruntime behavior matrixexamples/async_concurrency_patterns-- async/await syntax coverage (prefix+postfix await, tuple await, await emit, pipeline interplay)examples/agent_chat_stream-- memory-backed multi-turn chat + chunk streaming surrogate with emit channelsexamples/schema_validation_modes-- strict schema + fallback/optional schema + manual coercion strategy patternsexamples/testing--@test/@expect_faildecorator examples with mock agents, assertions, and emit capture
Agent adapter reference projects:
agents/claude_code-- reference middleware that bridges Concerto agent protocol to Claude Code CLI (oneshot+listen/stream modes)
| Module | Functions | Description |
|---|---|---|
std::math |
abs, min, max, clamp, round, floor, ceil, pow, sqrt, random, random_int | Numeric operations |
std::string |
split, join, trim, replace, to_upper, to_lower, contains, substring, len, repeat, reverse, parse_int, parse_float | String manipulation |
std::env |
get, require, all, has | Environment variables |
std::time |
now, now_ms, sleep | Time and ISO 8601 |
std::json |
parse, stringify, stringify_pretty, is_valid | JSON serialization |
std::fmt |
format, pad_left, pad_right, truncate, indent | Text formatting |
std::log |
info, warn, error, debug | Structured logging |
std::fs |
read_file, write_file, append_file, exists, list_dir, remove_file, file_size | File system |
std::collections |
Set, Queue, Stack (+ 20 methods) | Data structures |
std::http |
get, post, put, delete, request | HTTP client |
std::crypto |
sha256, md5, uuid, random_bytes | Cryptography |
std::prompt |
template, from_file, count_tokens | Prompt utilities |
Language specifications are in the spec/ directory:
- Language Overview
- Lexical Structure
- Type System
- Variables and Bindings
- Operators and Expressions
- Control Flow
- Functions
- Models
- Tools
- Memory and Databases
- Emit System
- LLM Connections
- Schema Validation
- Error Handling
- Modules and Imports
- Concurrency and Pipelines
- IR Specification
- Runtime Engine
- Compiler Pipeline
- Standard Library
- Interop and FFI
- Ledger System
- Project Manifest
- Project Scaffolding
- Model Memory
- Dynamic Tool Binding
- Agents
- Agent Streaming
- Testing
- Agent Initialization
- Pipeline Type Contracts
See STATUS.md for detailed project tracking.
Current: Phase 1-8 + Specs 29-30 complete (latest: agent initialization params with init/init_ack protocol, pipeline stage type contracts with adjacency checking and signature syntax).
MIT