AI agents have learned to analyze markets and develop trading strategies, but they still need human intervention to execute trades: traders copy the chatbot's output, switch to the platform, and manually place orders.

In March 2025, the cryptocurrency exchange OKX launched two toolkits that bridge this gap: OnchainOS for on-chain operations and Agent Trade Kit for trading on centralized platforms. Let's explore how they work and their purpose.

What is an AI Agent and Why Does It Need Exchange Access?

An AI agent is a program based on a language model that performs tasks autonomously. Unlike a typical chatbot, an agent not only answers questions but also makes decisions, calls external services, and acts in a sequence of steps without constant human intervention.

What are AI agents and how do they simplify life for Web3 users?

Agents can track prices, analyze on-chain data, and formulate trading hypotheses. However, there remains a manual step between analysis and trade execution: the trader reads the recommendation, then switches to the terminal to place the order manually.

To eliminate this limitation, developers provide the agent with programmatic access to trading infrastructure. This is achieved using the MCP (Model Context Protocol) — an open standard introduced by Anthropic on November 25, 2024. It offers a universal way to connect language models to external data, tools, and services.

OKX has implemented MCP support in two products: OnchainOS covers decentralized markets, while Agent Trade Kit focuses on centralized exchanges. Together, they create a unified environment where the AI agent operates with both on-chain assets and exchange instruments.

OnchainOS: AI for On-Chain Operations

OnchainOS is a toolkit for developers that grants AI agents access to the OKX Web3 wallet and on-chain marketplace. According to OKX, the wallet is used by over 12 million people monthly.

The platform supports more than 60 blockchains, aggregates liquidity from decentralized exchanges, and processes over 1.2 billion API requests daily. The average response time is under 100 ms, with a claimed uptime of 99.9%.

Depending on the task and level of control, OnchainOS offers developers three interfaces:

  • AI Skills — the simplest option. The agent describes an action in natural language, and OnchainOS interprets the request and executes the operation. Developers do not need to understand the specifics of a particular blockchain or write integration code;
  • MCP Server — connects to agent platforms. Through MCP, OnchainOS integrates with Claude Code, Cursor, OpenClaw, and other environments. The system calls on-chain functions like standard tools within a working session;
  • Open API — direct RESTful access to all platform capabilities. Suitable for developers needing full control over application logic.

The source code for OnchainOS Skills is available on GitHub. The toolkit includes seven specialized skills, each addressing a specific task.

SkillFunctionsokx-wallet-portfolioDisplays wallet balance, lists tokens, and calculates portfolio value.okx-dex-marketShows real-time prices, charts, index prices, and wallet profit and loss.okx-dex-signalTracks signals from smart money, whales, and influencers.okx-dex-trenchesScans meme tokens and developer reputation.okx-dex-swapExchanges tokens via an aggregator with access to over 500 liquidity sources.okx-dex-tokenSearches for tokens, returns metadata, capitalization, ratings, liquidity pools, holder data, and trading history.okx-onchain-gatewayEstimates gas, simulates transactions, sends them to the blockchain, and tracks confirmation status.

The skills support X Layer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon, and over 20 other networks.

How Skills Work

The skills are designed as links in a chain — the agent combines them based on the task. Here are a few typical scenarios:

  • Searching for and buying a token. The agent finds a token (okx-dex-token), checks the balance (okx-wallet-portfolio), and executes the trade (okx-dex-swap);
  • Portfolio overview. The system requests assets (okx-wallet-portfolio), enriches the data with analytics (okx-dex-token), and builds charts (okx-dex-market);
  • Complete trading cycle. The agent searches for a token (okx-dex-token), analyzes the chart (okx-dex-market), checks the balance (okx-wallet-portfolio), retrieves transaction data (okx-dex-swap), simulates, sends, and tracks execution (okx-onchain-gateway).

Example:

  1. The trader writes: “Exchange my ETH for USDC if the ETH price drops below $2000.”
  2. The agent tracks the price in real-time via okx-dex-market.
  3. When the condition is met, it checks the token's security and liquidity through okx-dex-token.
  4. Finds the best exchange route via okx-dex-swap.
  5. Simulates the transaction and sends it through okx-onchain-gateway.
  6. Tracks confirmation on the blockchain.
  7. Reports the result: “Received 1337 USDC.”

The entire process from condition to execution occurs without manual intervention. The payment module is built on the x402 protocol, allowing agents to conduct micropayments autonomously. When executed on X Layer — OKX's proprietary blockchain — the gas fee is zero.

Agent Trade Kit: AI Trading on a Centralized Exchange

While OnchainOS covers on-chain operations, Agent Trade Kit addresses a similar need for the centralized exchange OKX. This is an open-source MCP toolkit that provides AI agents access to spot, futures, and options trading through a single interface.

Installing the Agent Trade Kit is as simple as running one command:

npm install -g @okx_ai/okx-trade-mcp @okx_ai/okx-trade-cli

The toolkit is available in two formats: okx-trade-mcp (MCP server for agent platforms) and okx-trade-cli (CLI, command-line interface for scripts and automation with minimal token consumption). The repository is available on GitHub.

“The security of API keys is the primary concern for traders when connecting an AI agent to an exchange. In most implementations, keys are passed directly into the model context, creating a risk of leakage. Agent Trade Kit addresses this architecturally. API keys are stored in a local configuration file and read only by the MCP server on the user's machine. The language model does not have access to the keys — it only sends the trading intent,” emphasizes OKX.

The second layer of protection is a permissions system. When the server starts, it checks the API key's permissions. If it lacks trading permissions, the tools for placing orders are not registered in the agent's toolbox. The model cannot even attempt to execute an action for which it lacks permissions.

Agent Trade Kit includes 82 tools distributed across seven modules:

  • Spot, perpetual contracts, and futures. The agent executes trades across all exchange markets — from simple spot purchases to positions on perpetual swaps;
  • Options. OKX positions Agent Trade Kit as the only exchange MCP toolkit supporting options trading. The tool provides access to market data, order books, open interest, and position management — for traders hedging exposure or building multi-layer strategies;
  • Algorithmic orders. The agent places OCO orders, trailing stops, and conditional triggers. Commands are formulated in natural language — the system interprets the intent and translates it into order parameters;
  • Trading bots. Through Agent Trade Kit, grid and DCA bots can be configured in dialogue mode;
  • Account management. The system requests balances, open positions, and trading history within the working session;
  • Demo mode. Full access to the OKX trading environment with simulated assets. Developers can test strategies, validate execution logic, and debug the agent without risking real losses.

For developers needing specific functionality rather than the complete set of 82 tools, Agent Trade Kit offers four Skills modules:

  • okx-cex-market — market data (quotes, order books, tickers);
  • okx-cex-trade — trading (orders, positions, execution);
  • okx-cex-portfolio — portfolio (balances, history, P&L — profit and loss);
  • okx-cex-bot — bots (configuration of grid and DCA strategies).

The modules can be connected separately: only the necessary functionality is loaded, saving context window.

Getting Started: Step-by-Step Instructions

Agent Trade Kit (CEX)

Create an API key on OKX. Visit the OKX website, then select "Corporate Solutions" from the top menu, go to the API section, and click "Create API Key."

Source: OKX.

When creating, specify the necessary permissions: "Read" for analytics, "Withdrawal" for fund withdrawals, or "Trading" for order execution.

Next, install the toolkit:

npm install -g @okx_ai/okx-trade-mcp @okx_ai/okx-trade-cli

Then configure your credentials through the interactive wizard:

okx config init

The wizard will prompt for the API key, secret, and passphrase. The data is stored locally in (~/.okx/config.toml) and is not sent to the model.

Connect the MCP server to the agent platform:

okx-trade-mcp setup --client claude-code okx-trade-mcp setup --client cursor okx-trade-mcp setup --client claude-desktop

Agent Trade Kit is compatible with Claude Code, Cursor, VS Code, OpenClaw, and any MCP client. The market data module works without an API key. Start with —demo — this will allow you to verify that the agent correctly reads market data, places orders, and manages positions. Only after validation should you switch to real trading.

OnchainOS Skills (DeFi)

1. Obtain an API key from the OKX Developer Portal.

2. Install the skills — one command for any environment:

npx skills add okx/onchainos-skills

The installer will automatically detect the platform (Claude Code, Cursor, Codex CLI, OpenCode) and set up the environment.

For Claude Code, installation is also available via a plugin:

/plugin marketplace add okx/onchainos-skills /plugin install onchainos-skills

3. Configure the keys. Create a .env file in the project root:

OKX_API_KEY="your-api-key" OKX_SECRET_KEY="your-secret-key" OKX_PASSPHRASE="your-passphrase"

Do not commit .env to git and avoid exposing keys in logs or chats.

4. Connect the MCP server (optional). The OnchainOS CLI operates as a native MCP server:

claude mcp add --scope user onchainos-cli onchainos mcp

Documentation with step-by-step instructions is available on the Run Your First AI Agent page.

Key Considerations

An AI agent is not a replacement for a trader. Language models can misinterpret market situations or formulate incorrect orders. The OKX team provides the following recommendations for safe operation:

  • Start with demo mode. Agent Trade Kit offers a full testing environment with simulated assets. Use it to debug logic before moving to real funds;
  • Limit API key permissions. If the agent only needs analytics, do not grant trading rights to the key. Agent Trade Kit will automatically hide unavailable functions from the model;
  • Control position sizes. Set limits on the maximum volume of a single trade. This reduces the risk of significant losses due to incorrect agent behavior;
  • Monitor agent actions. Track order and position history — both through the OKX interface and via account management tools in Agent Trade Kit;
  • Update the toolkit. Both products are evolving in open access. Keep an eye on updates on GitHub: Agent Trade Kit, OnchainOS Skills.

Individually, OnchainOS and Agent Trade Kit cover two different market segments. Together, they form a unified platform where the AI agent can work with both centralized exchanges and decentralized protocols simultaneously.