Invoking a TypeScript Golem agent method from the CLI. Use when asked to call, invoke, or run a method on a deployed agent using golem agent invoke.
golem agent invokeBoth golem and golem-cli can be used — all commands below work with either binary.
golem agent invoke <AGENT_ID> <FUNCTION_NAME> [ARGUMENTS...]
This invokes a method on a deployed agent and waits for the result. The agent is automatically created on first invocation if it does not exist yet. Standard output, error, and log streams from the agent are streamed live to the terminal by default.
The agent ID identifies the agent type and its constructor parameters:
AgentTypeName(param1, param2, ...)
The agent ID can optionally be prefixed with environment or application paths:
| Format | Description |
|---|---|
AgentTypeName(params) | Standalone agent name |
env/AgentTypeName(params) | Environment-specific |
app/env/AgentTypeName(params) | Application and environment-specific |
account/app/env/AgentTypeName(params) | Account, application, and environment-specific |
For agents with no constructor parameters, use empty parentheses: AgentTypeName().
golem agent invoke 'MyAgent()' getStatus
golem agent invoke 'MyAgent("user-123")' processOrder '"order-456"' 42
golem agent invoke 'ChatRoom("general")' sendMessage '"Hello, world!"'
golem agent invoke 'staging/MyAgent("user-123")' getStatus
| Option | Description |
|---|---|
-t, --trigger | Only trigger the invocation without waiting for the result (fire-and-forget) |
-i, --idempotency-key <KEY> | Set a specific idempotency key; use "-" for auto-generated |
--no-stream | Disable live streaming of agent stdout/stderr/log |
--schedule-at <DATETIME> | Schedule the invocation at a specific time (requires --trigger; ISO 8601 format) |
Every invocation uses an idempotency key. If not provided, one is generated automatically. The same idempotency key guarantees that the invocation is executed at most once, even if the CLI call is retried.
golem agent invoke -i my-unique-key 'MyAgent()' doWork
If the agent's component has not been deployed yet and the CLI is run from an application directory, golem agent invoke will automatically build and deploy the component before invoking.
The agent ID parameters and method arguments use TypeScript syntax:
camelCaseundefined{ fieldOne: 1, fieldTwo: "hello" }"variant-name"{ tag: "variant-name", value: 42 }[1, "hello"]{ ok: value } / { error: value }golem agent invoke 'MyAgent("user-123")' updateProfile '{ displayName: "Alice", age: 30 }'