golemcloud/golem/golem-agent-reflection-go
- community
Checking that the SKILL.md file is still in the repository.
Calling Golem agents from Go without sharing their Go definition — caller-defined method-only and full agent clients, discovered (reflected) clients with canonical JSON, and fully dynamic invocation with packed values. Use when agent types or methods are selected at runtime, many agent types share a method shape, schemas must be inspected or rendered as JSON Schema, or an agent id must be parsed, built or rebound in a Go Golem project.
Install
npx vskill@latest install golemcloud/golem/golem-agent-reflection-goSKILL.md
Calling Agents with Runtime Reflection (Go)
Normal RPC through the callee's definition package or a generated guest client (see golem-call-another-agent-go) is the baseline. Reflection adds three more levels, which compose through agent ids:
| Level | Use it when | Go | |
|---|---|---|---|
| Caller-defined, method-only | Many agent types share a method shape; you have an id | golem.DefineAgentClient[Shape]() + Method[In, Out], Bind(id) | |
| Caller-defined, full | You own Go types for one target type, without its definition | golem.DefineFullAgentClient[Id](name, spec) + Method[In, Out] | |
| Discovered | The type or method is chosen at runtime and should be validated | reflection.DiscoverAgentType → Get / Bind → Call | |
| Fully dynamic | Values are already packed; no schema authority kept | reflection.BindAgentID(id) → Call |
Every level uses the same verbs: Call waits for the result, Trigger does not, Schedule runs it later. Discovered and dynamic clients live in the reflection package (github.com/golemcloud/golem/sdks/go/golem/reflection).
Method-Only Clients
A method-only client declares methods and nothing else, so it calls any existing agent that has them, whatever its type:
Bind checks nothing about the target, which the client does not describe; a target that is not deployed is reported by Bind, and a mismatch by the host or when the result is decoded. Binding does not create the agent, but the first call to a durable id does.
Full Clients
A full client also declares the target type's name, constructor and lifecycle, so it creates and addresses instances like the agent's own definition:
Get,NewPhantom,BindandAgentIDwork the same on an agent's own definition (DefineAgent), except that thereGet,NewPhantomandAgentIDpanic instead of returning an error: the target is in the same component, so a failure is a programming mistake.golem.AgentClientSpec{Mode: golem.Ephemeral}declares an ephemeral target: it has no durable identity, soGetandBindare refused andNewPhantomaddresses it.golem.DefineConfiguredFullAgentClient[Id, Cfg]declares the target's configuration type, soGet(id, client.WithConfig(cfg))passes typed creation-time overrides, checked at compile time againstCfg.
Generated guest clients are built on full clients.
Discover and Inspect
Input() returns a schema.Ref for the parameter record (without host-filled fields such as the principal). Output() returns a golem.Option[schema.Ref]: golem.None[schema.Ref]() when there is no result. Use Get() and check its boolean before accessing the result schema. A schema.Ref from github.com/golemcloud/golem/sdks/go/core/schema packs and unpacks canonical JSON and renders JSON Schema. Constructor().Input() describes the constructor the same way. A discovery miss (not deployed, not visible to the caller) reports false. A snapshot never refreshes itself; discover again when a newer deployment matters.
Call a Discovered Agent
Gettakes the constructor arguments by name and creates the agent if it does not exist;reflection.WithPhantomID(uuid)addresses a phantom instance andNewPhantomallocates one.Bind(agentID)addresses an existing id of this type.reflection.WithConfigJSON(path, value)overrides one declared configuration value at creation, as canonical JSON (reflection.WithConfigValue(path, schema.SchemaValue)takes a schema-model value);Get,NewPhantomandBindaccept it. Undeclared paths, secrets and invalid values are refused before anything is sent. An agent that already exists keeps the configuration it was created with.Call,TriggerandSchedulereturn the invocation'sgolem.InvocationID(agent id and idempotency key) — for an ephemeral agent, the only record of which instance ran.CallAsyncreturns a*reflection.PendingCall: itsIDis known at once,Get()returns the result (MustGet()panics on an error, and a secondGetreturns the same result), andCancel()stops waiting (the call may already have run;Getthen reportsgolem.ErrCallCancelled). It behaves like the*golem.Futurethat a typedCallAsyncreturns. A scheduled call is cancelled through the*golem.ScheduledInvocationthatSchedulereturns.- Missing, unexpected or invalid arguments fail with
*schema.ValidationError, listing every problem, before anything is sent. - Remote failures are
*golem.RemoteCallError; for a remote agent error, itsCauseis a*golem.AgentError.
Agent IDs
Parsing is strict and reports malformed ids; lookup by id never creates the agent. Agent ids are scoped to the caller's environment.
Fully Dynamic
A dynamic client sends values the caller packed itself and validates nothing. Keep a discovered snapshot beside it for validation:
A dynamic client also has CallAsync, Trigger and Schedule. reflection.MakeAgentID(typeName, constructor, phantom) builds an id from a packed constructor, so a dynamic caller can address any instance; the first call to it creates a durable agent.
Canonical JSON
- Integers up to 32 bits are JSON numbers;
s64,u64, duration nanoseconds and quantity mantissas are base-10 strings ("5"). A duration is{"nanoseconds": "…"}. - An absent option is
null; a result is{"ok": …}or{"err": …}; a variant case is its name, or{name: payload}; a map is[[k, v], …]; flags are an array of names; binary is unpadded base64url. - Streams, futures and other capabilities cannot be packed as JSON; call such methods through a typed client.
Related Skills
| Skill | When to Load | |
|---|---|---|
golem-agent-reflection | Choosing between client approaches, identity rules | |
golem-call-another-agent-go | Typed RPC through definitions and guest clients | |
golem-call-tool-go | Calling tools the same ways | |
golem-multi-instance-agent-go | Agent identities and phantoms |
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinggolem-skills/skills/go/golem-agent-reflection-go/SKILL.md
Popularity
- Repository stars
- 1,514
- Repository forks
- 210
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/golemcloud/golem/golem-agent-reflection-go)