npm package: @opencsg/agentichub-plugin
Description: OpenClaw plugin for integrating AgenticHub instances - call external agent instances via API
Author: OpenCSG
Latest version: 0.1.7

# AgenticHub Plugin for OpenClaw

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

OpenClaw plugin for integrating AgenticHub instances. It allows you to call external agent instances via API directly from OpenClaw, enabling you to seamlessly use custom Flow Agents and Code Agents deployed on AgenticHub.

## Features

- 🤖 **Multiple Agent Types** - Support for Flow Agents, Code Agents, and Super Assistant.
- � **Interactive Chat Commands** - Control the plugin directly via `/agentichub` or `/ah` commands.
- 🔄 **Dynamic Switching** - Switch between different agent environments and instances on the fly.
- � **Token Management** - Easily configure and update your AgenticHub API token via chat.
- 📋 **Agent Discovery** - List and search available agents within AgenticHub.

## Quick start

### Prerequisites

- Node.js >= 22.0.0
- OpenClaw >= 2026.0.0
- AgenticHub API Token

### Installation

```bash
# 1. Install the plugin
openclaw plugins install @opencsg/agentichub-plugin

# 2. Enable it
openclaw plugins enable agentichub-plugin
```

### Update

```bash
openclaw plugins update agentichub-plugin
```

### Uninstall

```bash
openclaw plugins disable agentichub-plugin
openclaw plugins uninstall agentichub-plugin
```

## Chat Commands Usage

The primary way to interact with the plugin is through built-in OpenClaw chat commands: `/agentichub` or the shorthand `/ah`.

### Help & Overview
Run the command without arguments or with the help flag to see available options:
```text
/ah
# or
/ah -h
```

### 1. Token Configuration (Required)
Before running queries, you must set an API token. 
* STG Environment Token URL: [https://opencsg-stg.com/settings/access-token](https://opencsg-stg.com/settings/access-token)
* PROD Environment Token URL: [https://opencsg.com/settings/access-token](https://opencsg.com/settings/access-token)

Update your token in the chat:
```text
/ah -token <your_token>
```
*Note: This updates the token and securely validates it against the current environment.*

### 2. List Agents
List available agents. You can append a search term to filter:
```text
/ah -list
/ah -list python
```

### 3. Select an Agent
Switch to a specific Agent ID. Future queries will automatically route to this agent:
```text
/ah -agent 123
```

### 4. Running Queries
Execute a prompt against the configured agent:
```text
/ah What is the time complexity of QuickSort?
```
Alternatively, use the query flag explicitly:
```text
/ah -query Explain this code snippet.
```
**Chaining commands:** You can select an agent and query it in a single command:
```text
/ah -agent 123 -query Generate a react component.
```

### 5. Switch to Super Assistant
Switch to the built-in Super Assistant mode:
```text
/ah -super
/ah -super Hello, how can you help me?
```

### 6. View Current Status
Check current configuration, selected agent, environment, and user info:
```text
/ah -st
# or
/ah -status
```

### 7. Miscellaneous Flags
* `-verbose`: Show detailed debug logs and tool calls in your terminal output.
* `-reset`: Reset all modified configurations back to defaults.
* `-v` or `-version`: Show the plugin version.

## Tool Integration

Additionally, the plugin registers an `agentichub_instance` tool for the OpenClaw Agent, allowing internal OpenClaw systems to invoke AgenticHub programmatically during reasoning.

### `agentichub_instance` Parameters

| Param | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | ✅ | Task description sent to AgenticHub |
| `type` | string | ❌ | Execution type: `flow` (default), `code`, or `super` |
| `flowId` | string | ❌ | Target Agent Flow ID |
| `agentName` | string | ❌ | Custom agent name for code type |
| `sessionId` | string | ❌ | For maintaining conversation state seamlessly |
| `history` | array | ❌ | Array of `{ role: string, content: string }` objects |

## Development

```bash
# Watch mode
pnpm run dev

# Typechecking
pnpm run typecheck

# Build plugin
pnpm run build
```