Skip to main content
Kairo’s standard library is organized into three distinct layers, each designed for a specific scope of availability and use. The Kairo Core prelude is always present — no imports needed for everyday types. Pulse Runtime Services extend the runtime with I/O, process control, and environment access for application packages. Astra First-Party Packages are optional, explicitly declared dependencies that add capabilities like JSON, HTTP, file system access, and more. Understanding which layer provides what helps you write clean, intentional code without pulling in more than you need.

Kairo Core

Kairo Core is always available — you never need an import statement to use its prelude types. These are the foundational primitives and collections that every Kairo program can rely on, regardless of package type or target environment.

Prelude types (no import required)

The following types are in scope automatically in every Kairo file:
  • Bool — boolean true/false values
  • Text — the primary text type in Kairo (see note below)
  • Int32, Int64 — fixed-width integer types
  • Decimal — the default type for fractional literals
  • Float64 — IEEE 754 double-precision float; requires explicit typing
  • Date, Time, DateTime, Instant, Duration — comprehensive date and time primitives
  • List<T>, Set<T>, Map<K, V> — immutable collection types
  • MutableList<T>, MutableSet<T>, MutableMap<K, V> — mutable collection variants
  • Result<T, E> — typed error handling
Core also includes core math operations and parsing/formatting utilities for all of the above types.
Text, not String — Kairo’s primary text type is Text. There is no String type in Core. If you see String in Kairo code, it does not refer to a built-in.Decimal, not Float64 by default — Fractional literals such as 3.14 are typed as Decimal unless you explicitly annotate them as Float64. Use Float64 only when you have a specific reason to prefer binary floating-point arithmetic.

What is NOT in Kairo Core

Core is intentionally minimal. The following capabilities are not provided by Core and must be sourced from Pulse or Astra packages:
  • JSON and XML processing
  • File system access
  • HTTP client or server
  • Database access
  • Application configuration
  • Cryptography
  • Monetary values (Money is not a core primitive)
  • Console/stdout output

Pulse Runtime Services

Pulse Runtime Services are available in all application packages — they ship alongside the Pulse runtime and do not require a manifest dependency. However, each module must be explicitly imported before use. Pulse is not a keyword or global; you must bring each module into scope with an import statement.

Available Pulse modules

Pulse.Console

Pulse.Console is your gateway to standard output and standard error. Import it at the top of any file that needs to write to the console. Pulse.Console.out — writes to stdout:
  • .writeLine(text: Text) — writes the value followed by a newline
  • .write(text: Text) — writes the value without a trailing newline
Pulse.Console.error — writes to stderr:
  • .writeLine(text: Text) — writes the value followed by a newline
  • .write(text: Text) — writes the value without a trailing newline
Both out and error accept Text, Bool, Int32, Int64, Decimal, Float64, enum values, and value or object instances.
Always import the specific Pulse module you need rather than assuming console output is a global. This keeps your module dependencies explicit and your code portable across different execution environments.

Astra First-Party Packages

Astra packages are optional, first-party libraries published by Astra Kairo. They are not bundled with the toolchain or runtime — you must declare each one as an explicit dependency in your kairo.toml manifest before you can use it. Once declared, add the corresponding import statement in any file that needs the package.

Available Astra packages

Astra.Money

Monetary values and arithmetic. Money is not a Core primitive — use this package whenever your domain requires currency-aware types.

Astra.Json

JSON serialization and deserialization. Convert Kairo values to and from JSON text.

Astra.Xml

XML parsing and generation. Work with XML documents, elements, and attributes.

Astra.Configuration

Application configuration loading. Read structured configuration from files or environment sources.

Astra.Http

HTTP client and server. Make outbound requests and handle inbound HTTP traffic.

Astra.Cryptography

Cryptographic primitives. Hashing, signing, encryption, and secure random generation.

Astra.FileSystem

File system access. Read, write, and navigate files and directories.

Astra.Database

Database access. Connect to and query relational and other database systems.
Money is not a primitive in Kairo Core. Astra.Money is the canonical source for monetary values in Kairo applications. If your domain models prices, balances, or any currency-denominated quantity, declare Astra.Money as a dependency.

Adding an Astra package

To use any Astra package, add it to the [dependencies] section of your kairo.toml and then run forge restore to fetch and register the package.
Then import the package in your source file and use it:
Astra package documentation expands as each package stabilizes. Check the individual package reference pages for the most up-to-date API details.