rust-soham/golem-claw/golem-add-agent-ts
- community
Checking that the SKILL.md file is still in the repository.
Adding a new TypeScript agent to a Golem component. Use when the user asks to create, add, or define a new agent type, implement an agent class, or add agent methods in a TypeScript Golem project.
Install
npx vskill@latest install rust-soham/golem-claw/golem-add-agent-tsSKILL.md
Adding a New Agent to a TypeScript Golem Component
Overview
An agent is a durable, stateful unit of computation in Golem. Each agent type is a class decorated with @agent() that extends BaseAgent from @golemcloud/golem-ts-sdk.
Steps
- Create the agent file — add a new file
src/<agent-name>.ts - Define the agent class — decorate with
@agent(), extendBaseAgent - Import from `main.ts` — add
import './<agent-name>';tosrc/main.ts - Build — run
golem buildto verify
src/main.ts is the entrypoint module that must import each agent module for side effects. Agent classes do not need to be exported for discovery — importing the module is sufficient because @agent() registers the class.
Agent Definition
Custom Types
Use TypeScript type aliases or interfaces for parameters and return types. Use named types instead of anonymous inline object types for better interoperability. TypeScript enums are not supported — use string literal unions instead:
Returning Failures
Agent methods should distinguish between domain errors (expected failure outcomes) and uncaught errors:
- Uncaught errors (thrown exceptions, rejected promises) are not returned to the caller as a failed invocation. Golem treats them as crashes: the invocation is retried according to the agent's retry policy, and if the retries are exhausted the agent itself becomes failed.
- Domain errors that the caller should observe as a normal failure result must be expressed in the method's return type using the SDK's
Result<T, E>type.
Returning Result.err(...) completes the invocation successfully — the caller receives the error as a value. Throwing (e.g. throw new Error(...)) or returning a rejected promise will instead trigger a retry and eventually fail the whole agent.
If the throw happens after a durable side effect has already completed, retry replays that side effect's recorded result. A common example is const response = await fetch(...); if (!response.ok) throw ...: the HTTP response status/body are recorded before the exception is thrown. Wrap the fetch, body read, and status check in atomically(...) when the exception should make Golem re-execute the HTTP request instead of replaying the recorded response.
Related Skills
- Load
golem-js-runtimefor details on the QuickJS runtime environment, available Web/Node.js APIs, and npm compatibility - Load
golem-file-io-tsfor reading and writing files from agent code
Key Constraints
- All agent classes must extend
BaseAgentand be decorated with@agent() - Constructor parameters define agent identity — they must be serializable types
- TypeScript enums are not supported — use string literal unions instead
- Agents are created implicitly on first invocation — no separate creation step
- Invocations are processed sequentially in a single thread — no concurrency within a single agent
- The build pipeline uses
golem-typegenfor type metadata extraction; ensureexperimentalDecoratorsandemitDecoratorMetadataare enabled intsconfig.json
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 repositoryCheckingpackages/golem/.agents/skills/golem-add-agent-ts/SKILL.md
Popularity
- 7-day trend score
- 0
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/rust-soham/golem-claw/golem-add-agent-ts)