agent-auth-cli

Sử dụng Agent Auth CLI (auth-agent) để khám phá nhà cung cấp, kết nối tác nhân, quản lý khả năng và thực thi các thao tác. Sử dụng khi người dùng muốn tương tác…

npx skills add https://github.com/better-auth/agent-auth --skill agent-auth-cli

Agent Auth CLI

You have access to the auth-agent CLI for interacting with Agent Auth providers. Always prefer using the CLI for any agent authentication operations rather than making raw HTTP requests or writing custom code.

Binary

The CLI binary is auth-agent (package: @auth/agent-cli). If not installed globally, run via npx @auth/agent-cli.

Workflow

Follow this order when working with a provider:

1. Discover or find a provider

# If you have the provider URL
auth-agent discover https://api.example.com

# If you need to search by intent
auth-agent search "deploy web apps"

# List already-known providers
auth-agent providers
  • discover fetches the /.well-known/agent-configuration document and caches the provider.
  • search queries the directory and returns matching providers.
  • Always discover or search first before connecting.

2. Explore capabilities

# List all capabilities for a provider
auth-agent capabilities --provider https://api.example.com

# Filter by query
auth-agent capabilities --provider https://api.example.com --query "transfer"

# Get full definition with input schema
auth-agent describe transfer_money --provider https://api.example.com
  • Always run describe before executing a capability to understand the required input schema and constraints.
  • If connected, pass --agent-id <id> to see which capabilities are granted.

3. Connect an agent

# Basic connection with specific capabilities
auth-agent connect --provider https://api.example.com \
  --capabilities read_data transfer_money \
  --name my-agent

# With constraints on capability arguments
auth-agent connect --provider https://api.example.com \
  --capabilities read_data transfer_money \
  --constraints '{"transfer_money":{"amount":{"max":1000}}}' \
  --name constrained-agent

# Autonomous mode (no user association)
auth-agent connect --provider https://api.example.com \
  --capabilities read_data \
  --mode autonomous

# With CIBA approval (backchannel, sends notification to user)
auth-agent connect --provider https://api.example.com \
  --capabilities read_data \
  --preferred-method ciba \
  --login-hint [email protected]
  • Save the returned agent_id — you need it for all subsequent operations.
  • If approval is required, the CLI opens the browser or prints the approval URL. Pass --no-browser to suppress browser opening.
  • Use --force-new to create a new connection even if one exists.

4. Check status

auth-agent status <agent-id>
  • Shows agent status (pending_approval, active, expired, revoked), granted capabilities, and constraints.
  • Run this after connecting to confirm the agent was approved.

5. Execute capabilities

auth-agent execute <agent-id> transfer_money \
  --args '{"amount": 50, "to": "alice"}'
  • The --args flag takes a JSON string matching the capability's input schema.
  • Always describe the capability first to know the required arguments.

6. Request additional capabilities

auth-agent request <agent-id> \
  --capabilities admin_panel \
  --constraints '{"admin_panel":{"scope":{"in":["read","write"]}}}' \
  --reason "Need admin access for deployment"

7. Lifecycle management

# Disconnect (revoke) an agent
auth-agent disconnect <agent-id>

# Reactivate an expired agent
auth-agent reactivate <agent-id>

# View stored connection details
auth-agent connection <agent-id>

# List all connections for a provider
auth-agent connections <issuer-url>

8. Key rotation

# Rotate an agent's keypair
auth-agent rotate-agent-key <agent-id>

# Rotate the host keypair for a provider
auth-agent rotate-host-key <issuer-url>

9. Host enrollment

auth-agent enroll-host --provider https://api.example.com --token <enrollment-token> --name "My Device"

10. Sign JWTs manually

# Sign an agent JWT (for use with external HTTP calls)
auth-agent sign <agent-id>

# Scope to specific capabilities
auth-agent sign <agent-id> --capabilities transfer_money read_data

Global Flags

FlagEnv varDescription
--storage-dir <path>AGENT_AUTH_STORAGE_DIRStorage directory (default: ~/.agent-auth)
--directory-url <url>AGENT_AUTH_DIRECTORY_URLDirectory URL for provider search
--host-name <name>AGENT_AUTH_HOST_NAMEHost name for identification
--no-browserAGENT_AUTH_NO_BROWSER=1Suppress browser opening for approval URLs
--url <urls...>AGENT_AUTH_URLSProvider URLs to auto-discover at startup

Important Rules

  • Never make raw HTTP requests to Agent Auth endpoints. Always use the CLI.
  • Always discover before connecting. The CLI needs the provider's configuration cached locally.
  • Always describe before executing. Check the input schema so you pass correct arguments.
  • Check status after connecting. The agent may require user approval before it becomes active.
  • Store agent IDs. You need them for execute, status, request, disconnect, and all other operations.
  • Use constraints when connecting to limit what the agent can do — this is a security best practice.
  • Set AGENT_AUTH_ENCRYPTION_KEY in production to encrypt private keys stored in ~/.agent-auth/.

Storage

Connections, keys, and provider configs are stored in ~/.agent-auth/ by default:

  • host.json — host identity and keypair
  • agents/<agent-id>.json — agent connections
  • providers/<encoded-issuer>.json — cached provider configurations

Thêm skills từ better-auth

agent-auth-mcp
better-auth
Sử dụng các công cụ Agent Auth MCP để khám phá nhà cung cấp, kết nối tác nhân, quản lý khả năng và thực thi các thao tác thông qua giao thức MCP. Sử dụng khi làm việc…
official
better-icons
better-auth
Tìm kiếm và truy xuất SVG từ hơn 200 thư viện biểu tượng với tích hợp CLI và máy chủ MCP. Hỗ trợ tìm kiếm qua các bộ sưu tập lớn (Lucide, Material Design Icons, Heroicons, Tabler và hơn 200 bộ khác) với bộ lọc theo tiền tố và giới hạn kết quả. Lệnh CLI để tìm kiếm biểu tượng, tải xuống hàng loạt dưới dạng tệp SVG và truy xuất từng biểu tượng với tùy chỉnh màu sắc và kích thước. Công cụ máy chủ MCP dành cho tác nhân AI bao gồm đề xuất thông minh, so khớp tương tự, quét dự án và biểu tượng hàng loạt...
official
better-auth-best-practices
better-auth
Thiết lập hoàn chỉnh máy chủ và máy khách Better Auth với các bộ điều hợp cơ sở dữ liệu, quản lý phiên, plugin và cấu hình bảo mật. Bao gồm toàn bộ quy trình từ cài đặt đến di chuyển cơ sở dữ liệu, thiết lập biến môi trường và tạo trình xử lý tuyến đường trên nhiều framework. Hỗ trợ nhiều bộ điều hợp cơ sở dữ liệu (Prisma, Drizzle, MongoDB, kết nối trực tiếp) với hướng dẫn quan trọng về quy ước đặt tên model so với bảng. Bao gồm các chiến lược lưu trữ phiên với bộ lưu trữ thứ cấp (Redis/KV), cookie...
official
create-auth-skill
better-auth
Tạo khung và triển khai xác thực trong ứng dụng TypeScript/JavaScript với phát hiện framework Better Auth, thiết lập adapter cơ sở dữ liệu và tích hợp OAuth. Phát hiện các framework (Next.js, SvelteKit, Nuxt, Astro, Express, Hono), cơ sở dữ liệu (Prisma, Drizzle, MongoDB, trình điều khiển thô) và các thư viện xác thực hiện có thông qua quét dự án. Hỗ trợ email/mật khẩu, OAuth (Google, GitHub, Apple, Microsoft, Discord, Twitter), liên kết ma thuật, khóa truy cập và xác thực qua điện thoại với xác minh email có thể cấu hình...
official
Email & Password Best Practices
better-auth
email-&-password-best-practices — một kỹ năng có thể cài đặt cho các tác nhân AI, được phát hành bởi better-auth/skills.
official
email-and-password-best-practices
better-auth
Xác minh email, luồng đặt lại mật khẩu và chính sách mật khẩu có thể tùy chỉnh cho Better Auth. Hỗ trợ xác minh email với tùy chọn bắt buộc để chặn đăng nhập cho đến khi được xác minh, cùng với thời gian hết hạn token có thể cấu hình và token đặt lại chỉ sử dụng một lần. Luồng đặt lại mật khẩu với bảo mật tích hợp: gửi email nền, ngăn chặn tấn công thời gian, thao tác giả trên các yêu cầu không hợp lệ và tùy chọn thu hồi phiên khi đặt lại. Giới hạn độ dài mật khẩu có thể cấu hình (mặc định 8–256 ký tự) và tùy chỉnh...
official
organization-best-practices
better-auth
Thiết lập tổ chức đa đối tượng thuê với quản lý thành viên, kiểm soát truy cập dựa trên vai trò và hỗ trợ nhóm thông qua Better Auth. Cấu hình tổ chức với các quy tắc tạo tùy chỉnh, giới hạn thành viên và ràng buộc quyền sở hữu; người tạo tự động nhận vai trò chủ sở hữu. Quản lý thành viên và lời mời với tính năng gửi email, thời hạn hiệu lực và URL lời mời có thể chia sẻ; hỗ trợ nhiều vai trò cho mỗi thành viên. Xác định vai trò và quyền tùy chỉnh với kiểm soát truy cập động; kiểm tra quyền...
official
two-factor-authentication-best-practices
better-auth
Xác thực đa yếu tố với TOTP, OTP, mã dự phòng và quản lý thiết bị đáng tin cậy cho Better Auth. Hỗ trợ ba phương thức xác minh: ứng dụng xác thực (TOTP với mã QR), mã email/SMS (OTP) và mã dự phòng dùng một lần. Xử lý luồng đăng nhập 2FA hoàn chỉnh với quản lý phiên tự động, cookie 2FA tạm thời và theo dõi thiết bị đáng tin cậy với thời gian hết hạn có thể cấu hình. Các tính năng bảo mật tích hợp bao gồm giới hạn tốc độ (3 yêu cầu mỗi 10 giây), mã hóa dữ liệu lưu trữ cho bí mật...
official