Chuyển đến nội dung chính
AgentBridge cho phép coding agent nói chuyện trực tiếp với một instance LemonClaw đang chạy bằng gateway token của instance được hiển thị trong dashboard hosted.

Cách lấy access pack

Mở Dashboard > Claw, chọn một instance đang chạy, bấm AgentBridge, rồi sao chép toàn bộ access pack từ modal. Gói này đã bao gồm runtime base URL, bearer token, quy ước session key và các endpoint quan trọng nhất.

Token này làm được gì

Gateway token được sao chép chỉ quản lý runtime. Nó có thể đọc trạng thái runtime, gửi yêu cầu chat, nhận SSE, đọc lịch sử thread, dừng thread đang chạy và lấy media do AgentBridge trả về. Nó không thể gia hạn, rebuild, restart từ hosted control plane hay truy cập các route billing/admin của tổ chức.

Quy tắc session key

Session key luôn theo định dạng agentbridge:<client_id>:<workspace_id>:<thread_id>. Hãy giữ nguyên cả ba giá trị cho cùng một thread. Nếu chuyển sang provider family khác, hãy tạo thread_id mới thay vì dùng lại thread cũ.

Các runtime endpoint chính

  • GET /api/status
  • GET /api/usage?session=<session_key>
  • POST /api/agentbridge/chat
  • POST /api/agentbridge/chat/stream
  • POST /api/agentbridge/uploads
  • GET /api/agentbridge/messages
  • GET /api/agentbridge/events/stream
  • POST /api/agentbridge/stop
  • GET /api/agentbridge/media
curl -N https://claw-demo.lemondata.cc/api/agentbridge/chat/stream \
  -H "Authorization: Bearer <gateway_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "codex",
    "workspace_id": "default",
    "thread_id": "demo-thread",
    "message": "Give me a short status update for this instance."
  }'

Prompt cho coding agent

Hãy đưa đoạn hướng dẫn ngắn này cùng với access pack cho coding agent:
Use /api/agentbridge/chat/stream first. Keep client_id, workspace_id, and thread_id stable for the same conversation. If you get provider_family_conflict, create a new thread_id instead of reusing the old one.

Lỗi thường gặp

  • provider_family_conflict — thread này đã có lịch sử trên provider family khác; hãy tạo thread_id mới.
  • Unauthorized — bearer token bị thiếu, hết hạn hoặc không thuộc về instance này.
  • Instance not running — AgentBridge access pack chỉ được cấp cho instance đang chạy.