Golem fire and forget go

From golemcloud/golem · View interactive version

Golem fire and forget go is an AI agent skill from the GitHub repository golemcloud/golem. Fire-and-forget agent invocations in Go with Trigger. Use when the user wants to enqueue work without awaiting a result, send a notification to another agent, fan out to many agents, or kick off background work in a Go Golem project.

How to use this skill

Skill file

Fire-and-Forget Invocations in Go (`Trigger`)

Overview

Method.Trigger(client, in) enqueues an invocation without waiting for its result and returns an InvocationID, or an error if the invocation could not be enqueued (MustTrigger panics instead). Use it for notifications, fan-out, or handing work to a background/worker agent. Unlike a synchronous Call, Trigger does not block — so it is also safe for an agent to message itself (a synchronous self-Call would deadlock, since one instance handles one invocation at a time).

Steps

  1. Import the target agent's definition package.
  2. Get a client with Agent.Upsert(id).
  3. Trigger the method: Target.Method.MustTrigger(client, in) — returns immediately.

Example

package impl

import (
	"myapp/agents/coordinator"
	"myapp/agents/worker"

	"github.com/golemcloud/golem/sdks/go/golem"
)

type state struct{}

var agent = coordinator.Agent.Implement(func(coordinator.ID) *state { return &state{} })

func init() {
	agent.Handle(coordinator.Start, func(_ *golem.Context[state], in coordinator.StartIn) golem.Unit {
		// Hand each unit of work to a worker without awaiting the outcome.
		for _, w := range in.Jobs {
			c := worker.Agent.Upsert(worker.ID{Name: w.Worker})
			worker.Dispatch.MustTrigger(c, worker.DispatchIn{Job: w.Job})
		}
		return golem.Unit{}
	})
}

Fanning out is just a loop of Trigger calls — each runs independently on its target agent.

Trigger vs Call

The returned InvocationID is an opaque handle to the enqueued invocation; you can ignore it for pure fire-and-forget.

Key Constraints

Related Skills

| Skill | When to Load |

|-------|--------------|

| golem-call-another-agent-go | You need the callee's result (sync Call / async CallAsync) |

| golem-recurring-task-go | Schedule a future/self invocation at a specific time |

| golem-add-agent-go | Define the agent being triggered |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.