Examples
The SDK is Python-native; hx is a regular CLI any language can call as a subprocess.
Python
import heepx
warrant = heepx.learn("warrant")
print(warrant.name, warrant.version)
for result in heepx.search("review"):
print(result.name, "-", result.description)JavaScript
The SDK is Python-only today. Any language can drive the hx CLI as a subprocess and read the capability files it caches locally.
import { execFileSync } from "node:child_process";
import { readFileSync } from "node:fs";
execFileSync("hx", ["learn", "warrant"]);
const path = execFileSync("hx", ["learn", "warrant", "--offline"])
.toString()
.match(/path\s+(\S+)/)[1];
console.log(readFileSync(`${path}/INSTRUCTIONS.md`, "utf8"));Go
Same approach: hx is a regular CLI, callable from any language via a subprocess.
package main
import (
"fmt"
"os/exec"
)
func main() {
out, err := exec.Command("hx", "learn", "warrant").CombinedOutput()
if err != nil {
panic(err)
}
fmt.Println(string(out))
}Rust
Same approach again — hx's behavior is identical no matter what calls it.
use std::process::Command;
fn main() {
let output = Command::new("hx")
.args(["learn", "warrant"])
.output()
.expect("hx must be installed");
println!("{}", String::from_utf8_lossy(&output.stdout));
}Multi-agent
Compose independent capabilities — each agent in a pipeline learns only what it needs.
import heepx
planning = heepx.learn("planning")
verify = heepx.learn("verify")
# planning.dependencies lists other capabilities it composes with,
# declared in its own CAPABILITY.yaml (composes_with:)
plan = run_agent(planning, task="ship the v0.2 release")
checked = run_agent(verify, task=plan)Offline
import heepx
# First call needs the network; offline=True guarantees the second
# doesn't.
heepx.learn("warrant")
capability = heepx.learn("warrant", offline=True)
try:
heepx.learn("never-cached", offline=True)
except heepx.OfflineError as exc:
print(f"expected: {exc}")