Toolang — A language and runtime for agents and humans

toolang

2 min read Original article ↗

Define agent loops as functions. Compose them for complex tasks with fine-grained control.

All in natural language that humans and agents can read and write, and that the runtime can execute.

Install toolang v0.4.0

Then get started

THE LANGUAGE

Give agentic work structure.

Bring agent loops, control flow, and reusable caps together in a language shared by humans, LLMs, and the runtime.

Agic

The counterpart to a function in traditional programming languages—a reusable agent loop with structured inputs and outputs.

agic translate(_, lang):
  Translate {{_}} into {{lang}}.
  Return only the translation.
 
struct WeatherReport:
  city: Text
  condition: Text
 
agic check_weather(city) -> WeatherReport:
  Get current weather for {{city}} from wttr.in.

Flow

Orchestrate agics in sequence, in parallel, or in loops—sync or async. Keep the steps explicit and the reasoning autonomous.

flow research:
  let question = {{_}}
 
  run -> Text[]:
    Propose 8 focused research tasks for {{question}}.
 
  map in 4 lanes:
    Research {{_}} to help answer {{question}}.
    Find and read sources; return findings with URLs.
 
  Answer {{question}} concisely based on {{_}}.
  Cite sources; merge duplicates; flag conflicts.

Caps

Extend agents with composable agent primitives—psyches, skills, services, and prompts—through references or inline definitions.

with psyche gh:briceyan/concise
with skill gh:anthropics/frontend-design
 
service figma:
  description = Create and edit Figma designs.
  transport = http
  target = https://mcp.figma.com/mcp
 
prompt polish:
  Polish this UI text: {{_}}.

Program

A Toolang program defines an agent’s core elements in natural language. As a plain-text file, it’s easy to edit and share.

Toolang program overview: agic, flow, types, and caps.


THE RUNTIME

Put that structure to work.

Execute agics and flows on your computer or in a sandbox, with visibility into active runs and execution history.


GET STARTED