Skip to content

About

?? FlyAI Skill - Travel, Flight & Hotel Search and Booking, powered by Fliggy. Agent skill with 8 search commands via @fly-ai/flyai-cli.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

✈️ FlyAI Skill

Travel, Flight & Hotel Search and Booking

Travel search, powered by Fliggy — for AI coding agents

License: MIT Node.js Version FlyAI CLI Skill Type

Quick Start · Commands · How It Works · Agent Integration · Troubleshooting


Why FlyAI Skill?

  • Natural language in, JSON out — ask in plain English or Chinese, get structured single-line JSON on stdout.
  • Direct Fliggy integration — calls the official Fliggy FlyAI MCP API for real-time hotel, flight, train, POI, and booking data.
  • 8 dedicated search commands — from broad keyword/AI search to category-specific hotel, flight, train, POI, and Marriott queries.
  • Bookable results — every result carries jumpUrl / detailUrl for one-click booking and picUrl / mainPic for rich display.

Quick Start

Step 1 — Install dependencies

cd flyai-skill
npm install

This installs @fly-ai/flyai-cli (v1.0.16) and its dependencies into node_modules/.

Step 2 — Set your API key

Get a free API key from the Fliggy FlyAI Open Platform.

Windows (cmd / PowerShell):

set FLYAI_API_KEY=your_api_key_here

Linux / macOS:

export FLYAI_API_KEY=your_api_key_here

Step 3 — Verify it works

node scripts/flyai.mjs keyword-search --query "things to do in Tokyo"

You should see a single-line JSON response with status: 0 and a data.itemList array.


Commands

All commands are invoked through the wrapper script. Before calling any command, read its corresponding file in references/ for exact required parameters — do not guess or reuse formats across commands.

Command Description Required Parameter Reference
keyword-search Broad natural-language search across hotels, flights, tickets, events --query references/keyword-search.md
ai-search AI-powered semantic search with complex intent understanding --query references/ai-search.md
search-hotel Structured hotel search with filters (star, price, bed type, POI) --dest-name references/search-hotel.md
search-flight Structured flight search with date ranges, cabin class, sorting --origin references/search-flight.md
search-train Structured train ticket search with seat class, duration, sorting --origin references/search-train.md
search-poi POI / attraction search by city, level, category, keyword --city-name references/search-poi.md
search-marriott-hotel Marriott Group hotel search with brand and name filters --dest-name references/search-marriott-hotel.md
search-marriott-package Marriott hotel package (dining, spa, stay) search --keyword references/search-marriott-package.md

Example calls

# Broad search
node scripts/flyai.mjs keyword-search --query "France visa"

# AI semantic search
node scripts/flyai.mjs ai-search --query "下周从上海去东京,优先直飞,帮我找性价比高的航班和酒店"

# Hotel search
node scripts/flyai.mjs search-hotel --dest-name "杭州" --poi-name "西湖" --check-in-date 2026-03-10 --check-out-date 2026-03-12

# Flight search
node scripts/flyai.mjs search-flight --origin "上海" --destination "东京" --dep-date 2026-03-20 --back-date 2026-03-25 --journey-type 1

# Train search
node scripts/flyai.mjs search-train --origin "北京" --destination "上海" --dep-date 2026-03-15 --seat-class-name "second class"

# POI search
node scripts/flyai.mjs search-poi --city-name "杭州" --keyword "西湖" --category "山湖田园"

# Marriott hotel
node scripts/flyai.mjs search-marriott-hotel --dest-name "上海" --hotel-brands "万豪酒店,喜来登" --check-in-date 2026-03-20 --check-out-date 2026-03-22

# Marriott package
node scripts/flyai.mjs search-marriott-package --keyword "JW万豪" --sort-type price_asc

How It Works

flowchart TD
    A[Agent asks a travel question] --> B["node scripts/flyai.mjs <command> [args...]"]
    B -->|wrapper resolves flyai-cli bin, spawns node| C["@fly-ai/flyai-cli (npm package, v1.0.16)"]
    C -->|HTTP call with FLYAI_API_KEY| D["Fliggy FlyAI MCP API<br/>flyai.open.fliggy.com"]
    D --> E[Single-line JSON on stdout]
    E --> F[Agent parses &amp; renders results]
Loading
  • stdout: single-line JSON response (status, message, data, systemMessage)
  • stderr: error messages and hints (prefixed [flyai])
  • Exit codes: 0 success, 2 dependency/CLI resolution error, 3 API key missing, 4 CLI spawn failure

Agent Integration

This is a Skill (not an MCP server). Agents invoke it by executing node scripts/flyai.mjs <command> [args...].

Claude Code / OpenClaw / compatible agents

  1. Clone this repository (or copy the SKILL.md, scripts/, references/, package.json, and package-lock.json into your agent's skills directory).
  2. Run npm install inside the skill directory to install @fly-ai/flyai-cli.
  3. Ensure the agent has permission to execute node and read the SKILL.md frontmatter (which declares runtime: node and intent patterns).
  4. Set FLYAI_API_KEY in the agent's environment.

The agent will then automatically route travel-related queries to the appropriate node scripts/flyai.mjs command based on the intent patterns and reference docs declared in SKILL.md.


Troubleshooting

[flyai] FLYAI_API_KEY is not set. (exit code 3)

The FLYAI_API_KEY environment variable is missing. Set it before running commands:

# Windows
set FLYAI_API_KEY=your_key
# Linux/macOS
export FLYAI_API_KEY=your_key

Get a key at flyai.open.fliggy.com.

[flyai] missing package: ...\node_modules\@fly-ai\flyai-cli\package.json (exit code 2)

The @fly-ai/flyai-cli dependency is not installed. Run:

npm install

inside the skill directory (the one containing package.json).

[flyai] cannot resolve CLI entry

The installed flyai-cli package has an unexpected bin field. Reinstall:

rm -rf node_modules package-lock.json
npm install

Acknowledgements

This skill is derived from the open-source alibaba-flyai/flyai-skill and adapted for direct repository usage (npm install + node scripts/flyai.mjs) without the platform packaging layer.

All travel data is provided by Fliggy FlyAI.


License

MIT

About

?? FlyAI Skill - Travel, Flight & Hotel Search and Booking, powered by Fliggy. Agent skill with 8 search commands via @fly-ai/flyai-cli.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages