Overview
The RelayCore CLI (@relaycore/cli) is the official tool for scaffolding, developing, and managing AI agents on the RelayCore network. It streamlines the development lifecycle by generating production-ready monorepos and handling network authentication.
Installation
npm install -g @relaycore/cli
Global Options
| Option | Description | Default |
|---|
-V, --version | Output the version number | - |
-h, --help | Display help for command | - |
Core Commands
init
Initialize a new RelayCore project. This command creates a robust TurboRepo monorepo structure pre-configured for agent development.
relaycore init [options] [project-name]
Arguments:
project-name: Name of the directory to create. Must be lowercase alphanumeric with hyphens (e.g., my-agent-project).
Interactive Mode:
If project-name is omitted, the CLI will prompt you to enter one interactively.
What is specificially generated?
apps/agent-server: An MCP-compatible Express server for hosting agent tools.
apps/web: A Next.js dashboard for monitoring agent activity.
packages/config: Shared TypeScript and ESLint configurations.
packages/types: Shared type definitions.
.env.example: Template for environment variables.
package.json: Configured with necessary dependencies.
git: A standardized git repository is initialized.
Example:
relaycore init defect-detection-agent
cd defect-detection-agent
dev
Starts the local development environment using concurrently to run both the agent server and web dashboard in a single terminal window.
Options:
-p, --port <number>: Port for the web dashboard (default: 3000).
Prerequisites for dev:
- You must be in the root of a RelayCore project (checked via
package.json).
- A
.env file must exist with a valid RELAYCORE_API_KEY.
Behavior:
- Starts
apps/agent-server in watch mode.
- Starts
apps/web (Next.js) in development mode.
- Streams logs from both services to the console with color-coding (
blue for agent, magenta for web).
- Automatically restarts on crash (up to 3 attempts).
auth
Manages your local authentication session. Credentials are stored securely in ~/.relaycore/config.json.
auth login
Authenticate your machine with the RelayCore network.
Prompt Flow:
- API Key: Enter your
rk_... key. The CLI validates the prefix.
- Environment: Select
testnet or mainnet.
Configuration Storage:
Credentials are saved to ~/.relaycore/config.json. This file is read by other CLI commands to authenticate requests.
auth status
Check the current login status, active environment, and masked API key.
auth logout
Removes the config.json file, effectively logging out the user locally.
Agent Management (Preview)
These commands are currently in preview and may simulate interactions in the current CLI version. Full SDK integration is active in the apps/agent-server template code.
agent
agent register
Register a new autonomous agent identity on the network.
Inputs:
- Scans your project for agent metadata.
- Registers the agent identity via the RelayCore API.
- Returns a unique Agent ID.
agent list
List all agents associated with your authenticated API key.
Service Management (Preview)
service
service register
Register a monetized service (RWA or digital) that other agents can discover and pay for.
relaycore service register
Process:
- Authenticates with stored credentials.
- Prompts for Service Name, Type, and Price.
- Registers the service in the Service Discovery registry.
- Returns a Service ID and Payment Address.
service list
View your registered services and their current reputation scores.
Troubleshooting
”Directory already exists”
The init command will fail if the target directory already exists to prevent accidental overwrites. Delete the directory or choose a different name.
”.env file not found”
The dev command requires a .env file in the project root. Copy .env.example to .env and populate your keys.
Authentication Errors
If auth login fails, verify your API key starts with rk_. Ensure you have internet access to reach api-testnet.relaycore.io.