HiveLang

Variables

Learn how to declare, assign, and use variables in HiveLang.

Declaring Variables

Assign a value with =. Variables are scoped to the handler they're declared in.

example.hive
bot Calculator {
  on user.message {
    price = 100
    tax = 0.2
    total = price * (1 + tax)
    respond with "Total: " + total
  }
}

Variable Types

HiveLang supports several data types:

  • Numbers — Integers and decimals (e.g., 42, 3.14)
  • Strings — Text in quotes (e.g., "hello")
  • Booleanstrue or false
  • Lists — Collections (e.g., [1, 2, 3])

Building Strings

Concatenate strings and variables with the + operator.

interpolation.hive
name = "Alice"
greeting = "Hello, " + name + "!"
respond with greeting  // Output: Hello, Alice!

Storing Tool Results

Use the as keyword to store the result of a tool call.

tool-result.hive
call web.search with { query: "AI news" } as results
respond with "Found: " + results

How helpful was this page?

Not helpfulExcellent