@galdor/core
v0.3.1
Published
galdor-bun core: schema, provider, tool, graph, agent, observability.
Readme
@galdor/core
The core of galdor: a typed message
schema, a provider abstraction over LLM backends, tools defined once with
Zod and validated at runtime, a graph runtime with ReAct and
plan-and-execute agents, persistent memory, and first-class observability that
persists gen_ai.* / galdor.* spans.
Runs on Bun (loads the TypeScript source directly) and Node ≥ 22.5 (uses the compiled build) from the same package.
Install
bun add @galdor/core # or: npm install @galdor/coreSubpath exports
Reach each concern through its own entry point:
| Import | What it gives you |
|---|---|
| @galdor/core/schema | Messages, content parts, tool calls, usage |
| @galdor/core/provider | Provider interface, error taxonomy, retry, capabilities |
| @galdor/core/tool | defineTool, Registry, executeCalls |
| @galdor/core/graph | Graph builder, Runnable, checkpoints, interrupts, hooks |
| @galdor/core/agent | ReAct and plan-and-execute agents |
| @galdor/core/council | Supervisor and swarm multi-agent orchestration |
| @galdor/core/store | SQLite span store (dual-runtime driver) |
| @galdor/core/observability | setupTracing, span instrumentation, exporter |
| @galdor/core/memory | Retriever, InMemoryStore, chunking |
| @galdor/core/embedder | Generic HTTPEmbedder |
| @galdor/core/eval | Dataset runner, scorers, report module |
| @galdor/core/replay | Deterministic replay from fixtures or the span store |
| @galdor/core/spellbook | Versioned prompt-template store with rendering |
| @galdor/core/testprovider | Scripted Provider for tests |
The root @galdor/core also re-exports every module as a namespace
(import { graph, provider } from "@galdor/core").
Quickstart
import { Graph, START, END } from "@galdor/core/graph";
import { userMessage, messageText } from "@galdor/core/schema";
import { newAnthropic } from "@galdor/provider-anthropic";
const provider = newAnthropic({ apiKey: process.env.ANTHROPIC_API_KEY! });
type S = { question: string; answer: string };
const app = new Graph<S>()
.addNode("ask", async (s) => {
const res = await provider.generate({ model: "claude-haiku-4-5", messages: [userMessage(s.question)] });
return { ...s, answer: messageText(res.message) };
})
.addEdge(START, "ask")
.addEdge("ask", END)
.compile();
const out = await app.invoke({ question: "Capital of Ecuador?", answer: "" });
console.log(out.answer);Observability
import { setupTracing, instrumentProvider } from "@galdor/core/observability";
const { tracer, store, shutdown } = setupTracing("traces.db");
const traced = instrumentProvider(provider, tracer, { captureContent: true });
// run agents with `traced`; explore the spans with `galdor scry` or the dashboard.
await shutdown();Providers
@galdor/core defines the Provider interface; install an adapter to use a
backend: @galdor/provider-anthropic,
@galdor/provider-openai,
@galdor/provider-google,
@galdor/provider-bedrock,
or @galdor/providerset to
pick one by name.
License
Apache-2.0
