Skip to main content
The Guild CLI is your primary tool for creating, testing, and publishing agents locally.

Installation

Prerequisites

  • Node.js 18+ and npmnodejs.org
  • A Guild account — your Guild contact provides access

Install and authenticate

guild auth login opens your browser to sign in at app.guild.ai and configures your local npm registry for Guild packages.

Coding assistant skills

If you use a coding assistant, install Guild CLI skills into your project:
guild setup previews the changes and prompts you to choose Claude Code, Codex, or Gemini. Pass --provider <claude|codex|gemini> to skip the prompt and --yes to accept the preview without confirming. Choosing Claude Code adds SDK reference and CLI workflow docs to .claude/skills/ so your coding assistant understands Guild agent development patterns.

Create an agent

guild agent init scaffolds the project into a new ./<agent-name>/ directory, so run it from the parent directory and cd in afterwards. Pass --directory <path> to scaffold somewhere else. The CLI prompts for a name, template, and category. Every agent requires a category, and any tags you provide are validated against that category’s allowed tags. Skip prompts with flags:
In non-interactive mode, --owner is required when your account belongs to one or more organizations. Use guild config set default_owner <name-or-id> to set a default and avoid passing --owner on every invocation. In interactive mode, the CLI always prompts for owner selection.

Templates

Project structure

Guild Native agents

When you initialize a Guild Native agent, the scaffold includes:
  • PROMPT.md — defines the agent’s role, behavior, and instructions.
  • guild.yaml — declares the integrations, sub-agents, and built-in tools Guild brokers for the agent.
Guild Native agents skip the build validation step and immediately transition to READY after initialization.

Goose agents

When you initialize a Goose agent, the scaffold includes:
  • recipe.yaml — defines the agent’s parameters, instructions, and response JSON schema.
  • guild.yaml — declares the integrations, sub-agents, and built-in tools Guild brokers for the agent.
Goose agents skip the build validation step and immediately transition to READY after initialization.

OpenClaw agents

When you initialize an OpenClaw agent, the scaffold includes:
  • AGENTS.md — the agent’s instructions. This file is the agent: it becomes the system prompt.
OpenClaw agents have a coding toolchain built in — a shell, file editing, git, and search. See OpenClaw agents.

Write your agent

Edit agent.ts. The template gives you a working starting point.

TypeScript LLM agent

Define a system prompt and tools. No procedural code needed.
mode: "multi-turn" keeps the conversation going after each response. Use "one-shot" (default) when the agent should respond once and finish.
llmAgent wires ui_notify internally so progress notifications (task.ui.notify()) work, but hides it from the model unless you explicitly add ui_notify to your agent’s tools. Add userInterfaceTools if your agent needs ui_prompt or ui_ping.

Code-first agent

Write TypeScript that calls tools directly. Requires the "use agent" directive at the top of the file so the runtime can manage state between tool calls.

Tools overview

Agents have access to three categories of tools:
  • Service tools (gitHubTools, etc.) — call third-party APIs. When a user first triggers a service tool, Guild prompts them to connect their account via OAuth.
  • guildTools — query the Guild platform (agents, workspaces, sessions, triggers).
  • userInterfaceTools — interact with the user during a session (questions, progress updates).
All tool calls go through task.tools:

Available services

The runtime provides 7 service integrations (GitHub, Slack, Azure DevOps, Confluence, and more). Import them from their @guildai-services/* packages — don’t add them to package.json. See Service integrations for the full list with import paths.
Credentials for each service are configured at the organization level in Settings > Credentials at app.guild.ai. When an agent first uses a service tool, Guild prompts the user to connect if credentials aren’t already configured.

Development loop

The typical workflow: pull, edit, test, save.

Pull latest changes

If others are working on the same agent:

Test locally

guild agent test opens an interactive session. Ephemeral versions are created automatically when testing from a local agent directory. Changes to agent.ts take effect on the next save — no restart needed.
guild agent test includes only files tracked by Git. Files that are already committed or staged with git add are uploaded to the ephemeral version. New untracked files are ignored until you stage them with git add. Modified tracked files still upload their working-tree content, so you can test uncommitted changes to existing files without committing them first.

Chat with a published agent

To chat with a published agent by name, use guild workspace chat --agent from any directory:
guild chat opens The Smith, Guild’s built-in support agent. To chat with the generic workspace assistant or a specific agent, use guild workspace chat.

Save your work

This commits your code and creates a new version in the Guild backend. Versions start as drafts. Pass --version-number <version> to set the version explicitly instead of using the default package.json version. Goose and Guild Native agents have no package.json, so the CLI skips the version-bump check for them; when you publish one without --version-number, it derives a patch increment of the latest published version (or 1.0.0 if none exists).
guild agent save -A/--all commits only modified tracked files. New files are untracked, so stage them with git add <file> (or git add .) before you run save -A.

Publish

--wait blocks until validation passes. --publish implies --wait and makes the agent available to your organization once validation and publish both finish. Use --timeout <seconds> (default: 300) to bound how long the command waits. When validation fails, --wait prints each build and validation step with a status icon ( SUCCEEDED, FAILED or ERRORED, RUNNING, other) followed by that step’s log output. guild agent revalidate prints the same step output, and takes no flags. Run guild agent logs to retrieve step logs at any time without triggering a new save. Publish separately if needed:

Check status

Key rules

  • Agent code lives at agent.ts in the project root.
  • Don’t add @guildai/agents-sdk, zod, or @guildai-services/* to package.json — the runtime provides them.
  • Call tools through task.tools.<name>(args). Never access services directly.
  • Agents have no direct internet route. fetch, axios, and node:http do not work, even inside a custom tool — reach external APIs through integrations on task.tools.*. See Network isolation.
  • Use guild agent save to commit and guild agent pull to sync. Don’t use raw git commands.
  • Don’t edit guild.json — it’s managed by the CLI.

Commands

Agent commands

Chat

Other commands

Diagnostics

Run guild doctor to check your setup:

Troubleshooting

  1. Check your internet connection.
  2. Run guild doctor to identify which check is failing.
Your default workspace may not match the target. Override with an environment variable:
Or set a new default:
Re-authenticate:
On a headless host with no OS keyring, guild auth login stores the token in a fallback file instead of the keyring. The CLI prints a warning that no keyring is available and that it is writing the token to a 0600 file named auth-token.json in the global config directory (GUILD_CONFIG_DIR, or ~/.guild when unset). Entries are keyed by host, so the same config directory works across multiple hosts.If the fallback file also cannot be written, the CLI prints Authorization succeeded, but the token could not be saved and exits without persisting the token. Confirm the config directory exists and is writable, then run guild auth login again.
Run from inside an agent directory (one with a guild.json file), or pass the agent ID explicitly:
If a previous save committed locally but failed to push, run save again — it detects unpushed commits and resumes:
guild agent save -A/--all commits only modified tracked files, so a newly created file is untracked and is skipped. Stage it first, then save:
Check the latest version for errors and save again:
To inspect step logs for the latest version without re-saving:
  1. Check for TypeScript errors in agent.ts.
  2. Make sure you’ve saved at least once: guild agent save --message "initial".
  3. Try a single message: guild agent chat "hello".