Native Kotlin/Wasm SDK for Golem agents#3696
Draft
JohnSColeman wants to merge 12 commits into
Draft
Conversation
✅ Deploy Preview for golemcloud canceled.
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a native Kotlin SDK under
sdks/kotlin/for writing Golem agents in idiomaticKotlin. Agents — and the SDK itself — compile directly to a WebAssembly Component via
Kotlin/Wasm (WasmGC): no JavaScript, no QuickJS, no engine embedding. The SDK links the
Golem host interfaces (
golem:agent,golem:api/*,golem:durability,wasi:*, …) throughthe raw canonical ABI, producing a small, interpreter-free component.
What's included
sdk/— core SDK module: canonical-ABI runtime/guest, host bindings, hand-rolled codecs(zero new runtime deps).
ksp/— KSP annotation processor: reads@Agent/@Endpoint/… and generates the@WasmExportguest entry points + agent metadata.gradle-plugin/+wit-native/— Gradle plugin driving the Kotlin/Wasm compile and thewasm-tools embed → new → validatepipeline, plus the bundled WIT.example/— a durable counter agent.README.md+docs/— programming-model docs and a capability matrix.scripts/— host-level e2e + contract-test harnesses.cli/golem-cli— Kotlin language support:golem new --template kotlinandkotlin/snapshotting, first-class Kotlin agent-id/value rendering + parsing(
SourceLanguage::Kotlin), and Kotlin build-tool requirements (JDK 17).golem-skills/…/golem-custom-snapshot-kotlin— snapshotting skill.golem-worker-executor,golem-component-compilation-service, and agent-type extraction (required to run nativeKotlin/Wasm components).
Capabilities
Cross-referenced against the Scala reference SDK — 15 complete, 3 partial:
transactions, context, RPC (
@RemoteAgenttyped clients), RDBMS, quota, WASI, guards &checkpoint, secrets, snapshotting (typed
Snapshotted<S>mixin, KSP-derived codec),utility types.
lazy-initialized-pollabledeferred), tools (streamed stdindeferred), middleware (request-time HTTP enforcement is host-side).
golem-clicode-gen gap — does notaffect in-Golem RPC); request-time HTTP routing/enforcement (host-side).
Testing
sdk60 /ksp30 /gradle-plugin8) +golem-clisuitegreen (incl. Kotlin agent-id round-trip tests).
15/15 ABI-boundary contract probes; and a manual snapshot-update round-trip proving typed
agent state survives a component revision bump and a server restart.
Notes
Snapshotted<S>) — the codec is derived by KSP from thestate type; there is no raw-bytes hook path. On a manual update the agent is reconstructed
from its own agent-id inside
load-snapshot.