Korean SRT (Super Rapid Train) search, reservation, and booking management
OpenClaw skill for managing Korean SRT (Super Rapid Train) reservations with search, booking, view, and cancellation capabilities.
1. **Python 3.10+** installed
2. **SRT account** with phone number and password
3. **OpenClaw** installed and configured
Set your SRT credentials as environment variables:
```bash
export SRT_PHONE="010-1234-5678"
export SRT_PASSWORD="your_password"
```
Add these to your shell profile (`~/.zshrc`, `~/.bashrc`, etc.) for persistence.
**Security Note:** Avoid committing credentials to version control.
**Important:** Phone number must include hyphens in the format `010-XXXX-XXXX`
Use the `/srt` slash command in OpenClaw:
```
/srt search --departure "μμ" --arrival "λΆμ°" --date "20260217" --time "140000"
/srt reserve --train-id "1"
/srt reserve --retry --timeout-minutes 60
/srt reserve --retry --train-id "1,3,5" --timeout-minutes 60
/srt log -n 30
/srt list
/srt cancel --reservation-id "RES123456"
```
The AI can invoke this skill based on user intent:
**Examples:**
```bash
uv run --with SRTrain python3 scripts/srt_cli.py search \
--departure "μμ" \
--arrival "λΆμ°" \
--date "20260217" \
--time "140000" \
--passengers "adult=2"
uv run --with SRTrain python3 scripts/srt_cli.py reserve --train-id "1"
uv run --with SRTrain python3 scripts/srt_cli.py reserve --retry \
--timeout-minutes 60 \
--wait-seconds 10
uv run --with SRTrain python3 scripts/srt_cli.py reserve --retry \
--train-id "1,3,5" \
--timeout-minutes 60 \
--wait-seconds 10
uv run --with SRTrain python3 scripts/srt_cli.py log -n 30
uv run --with SRTrain python3 scripts/srt_cli.py list --format json
uv run --with SRTrain python3 scripts/srt_cli.py cancel \
--reservation-id "RES123456" \
--confirm
```
**Main SRT Stations:**
**Important:** Station names MUST be in Korean (Hangul) for the SRT API to work correctly.
This skill provides 5 tools for managing SRT train reservations:
Search for available trains between stations.
**Usage:**
```bash
uv run --with SRTrain python3 scripts/srt_cli.py search \
--departure "μμ" \
--arrival "λΆμ°" \
--date "20260217" \
--time "120000"
```
**Returns:** JSON array of available trains with seat availability
**JSON Format:**
```json
{
"success": true,
"data": [
{
"train_id": "1",
"train_number": "301",
"train_name": "SRT301",
"departure_time": "120500",
"arrival_time": "143000",
"departure_station": "μμ",
"arrival_station": "λΆμ°",
"seat_available": true,
"general_seat": "μμ½κ°λ₯",
"special_seat": "μμ½κ°λ₯"
}
]
}
```
Reserve trains with optional automatic retry support.
**Usage (single attempt):**
```bash
uv run --with SRTrain python3 scripts/srt_cli.py reserve --train-id "1"
```
**Usage (with retry):**
```bash
uv run --with SRTrain python3 scripts/srt_cli.py reserve --retry \
--timeout-minutes 60 \
--wait-seconds 10
uv run --with SRTrain python3 scripts/srt_cli.py reserve --retry \
--train-id "1,3,5" \
--timeout-minutes 60 \
--wait-seconds 10
```
**Options:**
**Behavior with --retry:**
1. Cycles through all available trains from search results
2. Waits `--wait-seconds` between attempts (plus rate-limiting delays)
3. Continues until success or timeout
4. Logs progress to `~/.openclaw/tmp/srt/reserve.log`
**Returns:** Reservation details with payment deadline
**JSON Format:**
```json
{
"success": true,
"data": {
"reservation_id": "RES123456",
"journey_date": "20260217",
"journey_time": "120500",
"departure": "μμ",
"arrival": "λΆμ°",
"train_number": "301",
"seat_number": "3A",
"payment_required": true,
"attempts": 12
}
}
```
**Note:**
List all current reservations.
**Usage:**
```bash
uv run --with SRTrain python3 scripts/srt_cli.py list --format json
```
**Returns:** JSON array of active reservations
**JSON Format:**
```json
{
"success": true,
"data": [
{
"reservation_id": "RES123456",
"journey_date": "20260217",
"journey_time": "120500",
"departure": "μμ",
"arrival": "λΆμ°",
"train_number": "301",
"seat_number": "3A",
"payment_required": true
}
]
}
```
Cancel a reservation by ID.
**Usage:**
```bash
uv run --with SRTrain python3 scripts/srt_cli.py cancel \
--reservation-id "RES123456" \
--confirm
```
**Returns:** Cancellation confirmation
**JSON Format:**
```json
{
"success": true,
"data": {
"success": true,
"reservation_id": "RES123456",
"message": "Reservation cancelled successfully"
}
}
```
Check the progress of reservation attempts (especially useful for retry mode).
**Usage:**
```bash
uv run --with SRTrain python3 scripts/srt_cli.py log -n 30
```
**Returns:** Last N lines of reservation log file (`~/.openclaw/tmp/srt/reserve.log`)
**Options:**
**Log Format Example:**
```
[2026-02-03 11:00:00] INFO: === SRT μμ½ μμ (μ¬μλ λͺ¨λ) ===
[2026-02-03 11:00:00] INFO: νμμμ: 60λΆ
[2026-02-03 11:00:00] INFO: μ¬μλ κ°κ²©: 10μ΄
[2026-02-03 11:00:00] INFO: λμ μ΄μ°¨: 1,3,5 (μ΄ 3κ°)
[2026-02-03 11:00:05] INFO: === μλ #1 (μ΄μ°¨ 1/3) ===
[2026-02-03 11:00:05] INFO: π« μμ½ μλ μ€... (μ΄μ°¨ 301, 120500)
[2026-02-03 11:00:06] WARN: β μ’μ μμ (μ΄μ°¨ 301)
[2026-02-03 11:00:06] INFO: β³ 10μ΄ λκΈ° ν μ¬μλ...
[2026-02-03 11:00:26] INFO: === μλ #2 (μ΄μ°¨ 2/3) ===
...
[2026-02-03 11:05:00] SUCCESS: β μμ½ μ±κ³΅!
```
The skill provides clear, actionable error messages:
**Common Errors:**
1. **AuthenticationFailed**
- Invalid credentials
- **Solution:** Check phone number and password in config
2. **NoSeatsAvailable**
- Train is sold out
- **Solution:** Try next train or different time
- **Exit code:** 1 (retryable)
3. **StationNotFound**
- Invalid station name
- **Solution:** Use Korean station names from the list above
4. **NoTrainsFound**
- No trains for specified route/time
- **Solution:** Try different date or time
5. **RateLimitExceeded**
- Too many retry attempts (max 10 per session)
- **Solution:** Wait a few minutes before trying again
6. **NetworkError**
- Connection timeout or failure
- **Solution:** Check internet connection and retry
**Exit Codes:**
To protect your SRT account from being blocked by the server:
- Minimum 3 seconds between reservation attempts
- Minimum 5 seconds between search requests
**What this means for users:**
**For AI orchestration:**
When users make requests in Korean, the AI should:
1. **Extract parameters** from natural language:
- Stations (must convert to Korean if given in English)
- Date (relative dates like "λ΄μΌ", "λ€μμ£Ό κΈμμΌ" β YYYYMMDD)
- Time (relative times like "μ€ν 2μ", "12μ μ΄ν" β HHMMSS)
- Passenger count (default to 1 if not specified)
2. **Call tools in correct sequence:**
- Search before reserving
- List before canceling
- Handle retry logic with rate limiting
3. **Handle errors gracefully:**
- If no seats available, try next train (with delays)
- If station not found, suggest correct Korean name
- Inform user about waiting times during rate limiting
4. **Confirm actions in Korean:**
- "μμ½μ΄ μλ£λμμ΅λλ€" (Reservation completed)
- "3μ΄ ν λ€μ μ΄μ°¨λ₯Ό μλν©λλ€" (Trying next train in 3 seconds)
- "κ²°μ λ SRT μ±μμ μλ£ν΄μ£ΌμΈμ" (Complete payment in SRT app)
**User:** "2μ 17μΌμ μμμμ λλꡬ κ°λκ±° 12μμ΄ν μ μΌ λΉ λ₯Έκ±Έλ‘ 2μ₯ μμ½ν΄μ€"
**AI Actions:**
1. Parse: departure=μμ, arrival=λλꡬ, date=20260217, time=120000, passengers=adult:2
2. Search trains
3. Select first available train
4. Reserve train
5. Confirm with payment reminder
**User:** "λ§€μ§μ΄λ©΄ μ±κ³΅ν λκΉμ§ λ°λ³΅ν΄"
**AI Actions:**
1. Search trains
2. Start background retry:
```bash
exec reserve --retry --timeout-minutes 60 --wait-seconds 10 (in background)
```
3. Create monitoring cron job (isolated session + agentTurn):
```bash
cron add --job '{
"schedule": {"kind": "every", "everyMs": 120000},
"payload": {
"kind": "agentTurn",
"message": "Check SRT retry log and report progress",
"deliver": true,
"channel": "discord"
},
"sessionTarget": "isolated",
"enabled": true
}'
cron wake --mode "now"
```
4. Inform user: "λ°±κ·ΈλΌμ΄λ μ¬μλ μμ. 2λΆλ§λ€ μ λ°μ΄νΈν©λλ€."
**MANDATORY:** Use isolated session + agentTurn cron jobs for monitoring `reserve --retry`.
```bash
exec reserve --retry --timeout-minutes 60 (background)
cron add --job '{
"schedule": {"kind": "every", "everyMs": 120000},
"payload": {
"kind": "agentTurn",
"message": "Check `srt_cli.py log -n 30`, parse progress, report to user. Delete cron if done.",
"deliver": true,
"channel": "discord"
},
"sessionTarget": "isolated",
"enabled": true
}'
cron wake --mode "now"
```
**User:** "λ΄ μμ½ νμΈν΄μ£Όκ³ μ μΌ λΉ λ₯Έκ±° μ·¨μν΄μ€"
**AI Actions:**
1. List reservations
2. Parse JSON, find earliest by date/time
3. Cancel reservation
4. Confirm cancellation
**User:** "λΆμ° μμ½ μ·¨μνκ³ λλκ΅¬λ‘ λ€μ μμ½ν΄μ€"
**AI Actions:**
1. List reservations
2. Find Busan reservation
3. Cancel Busan reservation
4. Search for trains to λλꡬ (same date/time)
5. Reserve new train
6. Confirm both actions
**IMPORTANT:** This skill can search and reserve trains, but **cannot process payments**.
After making a reservation:
1. You'll receive a reservation number
2. Payment must be completed via:
- SRT mobile app (iOS/Android)
- SRT website (https://etk.srail.kr)
3. Check payment deadline (usually 20 minutes after reservation)
4. Unpaid reservations will be automatically cancelled
```bash
export SRT_PHONE="010-1234-5678"
export SRT_PASSWORD="your_password"
uv run --with SRTrain python3 scripts/srt_cli.py search --departure "μμ" --arrival "λΆμ°" --date "20260203" --time "140000"
uv run --with SRTrain python3 scripts/srt_cli.py list
```
```bash
clawhub login
clawhub publish . \
--slug srt \
--name "SRT Korean Train Service" \
--version 0.1.2 \
--tags latest
```
MIT
For issues or questions:
- Unified `reserve` command with `--retry` flag
- Added `--timeout-minutes` for time-based retry limits (default: 60)
- Added `--train-id` support for comma-separated multiple trains (e.g., "1,3,5")
- Changed `--wait-seconds` default from 20 to 10 seconds
- Search includes sold-out trains by default (`available_only=False`)
- **Monitoring:** Isolated session + agentTurn cron jobs required for background retry
- Replace venv/pip with `uv run --with SRTrain`
- Environment variables only for credentials (remove config file support)
- Search trains
- Make reservations
- View bookings
- Cancel bookings
- Rate limiting protection
- AI-friendly JSON output
Leave a review
No reviews yet. Be the first to review this skill!