> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentwallex.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bắt đầu nhanh

> Tích hợp AgentWallex trong dưới 5 phút — tạo ví tác nhân và gửi thanh toán đầu tiên của bạn.

## Điều kiện tiên quyết

* Node.js 18+ hoặc Python 3.9+
* Khóa API AgentWallex (`awx_...`) — [đăng ký truy cập sớm](https://agentwallex.com)
* Hiểu biết cơ bản về giao dịch blockchain

## Cài đặt

<CodeGroup>
  ```bash npm theme={null}
  npm install @agentwallex/sdk
  ```

  ```bash yarn theme={null}
  yarn add @agentwallex/sdk
  ```

  ```bash pnpm theme={null}
  pnpm add @agentwallex/sdk
  ```

  ```bash pip theme={null}
  pip install agentwallex
  ```
</CodeGroup>

## Tích hợp từng bước

<Steps>
  <Step title="Khởi tạo client">
    Tạo client AgentWallex với khóa API của bạn. Sử dụng `sandbox` để thử nghiệm và `production` cho mainnet.

    <CodeGroup>
      ```typescript TypeScript theme={null}
      import { AgentWallex } from "@agentwallex/sdk";

      const aw = new AgentWallex({
        apiKey: process.env.AGENTWALLEX_API_KEY!,
        environment: "sandbox", // use "production" for mainnet
      });
      ```

      ```python Python theme={null}
      from agentwallex import AgentWallex

      aw = AgentWallex(
          api_key=os.environ["AGENTWALLEX_API_KEY"],
          environment="sandbox",  # use "production" for mainnet
      )
      ```
    </CodeGroup>
  </Step>

  <Step title="Tạo ví tác nhân">
    Mỗi tác nhân có ví MPC được bảo mật riêng với các chính sách có thể cấu hình.

    <CodeGroup>
      ```typescript TypeScript theme={null}
      const agent = await aw.agents.create({
        name: "my-trading-agent",
        chain: "eip155:84532",
        policies: {
          maxTransactionAmount: "100",   // USDC
          dailyLimit: "1000",
          allowedAddresses: ["0x..."],
        },
      });

      console.log(`Agent ID: ${agent.id}`);
      console.log(`Wallet: ${agent.wallet.address}`);
      ```

      ```python Python theme={null}
      agent = await aw.agents.create(
          name="my-trading-agent",
          chain="eip155:84532",
          policies={
              "max_transaction_amount": "100",
              "daily_limit": "1000",
              "allowed_addresses": ["0x..."],
          },
      )

      print(f"Agent ID: {agent.id}")
      print(f"Wallet: {agent.wallet.address}")
      ```
    </CodeGroup>
  </Step>

  <Step title="Nạp tiền vào ví">
    Gửi token testnet đến địa chỉ ví tác nhân của bạn. Trên Base Sepolia, bạn có thể sử dụng [faucet](https://www.coinbase.com/faucets/base-ethereum-goerli-faucet) để nhận USDC thử nghiệm.

    <Note>
      Ở chế độ sandbox, ví tác nhân của bạn nằm trên testnet. Không có quỹ thực nào bị rủi ro.
    </Note>
  </Step>

  <Step title="Gửi thanh toán">
    Thực hiện thanh toán on-chain thông qua tác nhân.

    <CodeGroup>
      ```typescript TypeScript theme={null}
      const tx = await aw.payments.send({
        agentId: agent.id,
        to: "0xRecipientAddress",
        amount: "10.00",
        token: "USDC",
      });

      console.log(`Transaction hash: ${tx.hash}`);
      console.log(`Status: ${tx.status}`); // "confirmed"
      ```

      ```python Python theme={null}
      tx = await aw.payments.send(
          agent_id=agent.id,
          to="0xRecipientAddress",
          amount="10.00",
          token="USDC",
      )

      print(f"Transaction hash: {tx.hash}")
      print(f"Status: {tx.status}")  # "confirmed"
      ```
    </CodeGroup>
  </Step>
</Steps>

## Những gì diễn ra bên trong

1. **Kiểm tra Chính sách** — Công cụ chính sách xác thực giao dịch dựa trên quy tắc của tác nhân (giới hạn chi tiêu, danh sách địa chỉ cho phép, kiểm soát tốc độ).
2. **Ký MPC** — Giao dịch được ký bằng MPC ngưỡng 2-trong-3. Không bên đơn lẻ nào nắm giữ toàn bộ khóa.
3. **Phát sóng** — Giao dịch đã ký được gửi lên mạng lưới.
4. **Xác nhận** — AgentWallex theo dõi và xác nhận giao dịch, sau đó gửi sự kiện webhook.

## Bước tiếp theo

<CardGroup cols={2}>
  <Card title="TypeScript SDK" icon="js" href="/vi/sdks/typescript">
    Tài liệu SDK đầy đủ với tất cả phương thức và kiểu dữ liệu.
  </Card>

  <Card title="REST API" icon="code" href="/vi/api-reference/overview">
    Các endpoint HTTP cho tích hợp tùy chỉnh.
  </Card>

  <Card title="Thanh toán nhỏ x402" icon="credit-card" href="/vi/features/x402-micropayments">
    Kích hoạt thanh toán theo cuộc gọi API cho tác nhân của bạn.
  </Card>

  <Card title="Công cụ Chính sách" icon="shield-check" href="/vi/features/policy-engine">
    Cấu hình kiểm soát chi tiêu và quy tắc bảo mật.
  </Card>
</CardGroup>
