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

# Agent & Token Workflow

> An end-to-end walkthrough: register an ERC-8004 agent, then deploy and manage its token with the Brickken CLI.

This guide runs a full lifecycle on Base Sepolia: register an agent, finalize its profile and metadata, then deploy and operate its token — all through x402.

It uses **`client-signed`** mode so you keep self-custody of signing — passing `--signer-address` (and `--agent-wallet`) selects it. For the hands-off path where Brickken's relayer signs and broadcasts, drop those flags and add `--execution-mode brickken-relayed` — see the [Quickstart](/cli/quickstart).

## Prerequisites

* The CLI is [installed](/cli/installation) and a private key is set (`BRICKKEN_PRIVATE_KEY`).
* The wallet holds enough Base Sepolia Circle USDC (`0x036CbD53842c5426634e7929541eC2318f3dCF7e`) to cover x402 send fees (`0.01 USDC` per send in sandbox) and a little native ETH for gas (client-signed mode).
* `jq` is available for reading `--json` output.

```bash theme={null}
export BRICKKEN_ENV="sandbox"
export CHAIN="84532"                 # Base Sepolia
export WALLET="0xYourWallet"
export BRICKKEN_RPC_URL="https://sepolia.base.org"
```

<Warning>
  Each step below depends on the previous transaction being mined. Wait for confirmation before preparing the next dependent transaction — preparing them back-to-back can cause nonce conflicts.
</Warning>

## Part 1 — Register the agent

### 1. Register

```bash theme={null}
brickken agent register \
  --chain "$CHAIN" \
  --signer-address "$WALLET" \
  --name "Research Agent" \
  --description "On-chain AI research agent" \
  --image https://example.com/agent.png \
  --service-name A2A \
  --service-endpoint https://agent.example/.well-known/agent-card.json \
  --service-version 0.3.0 \
  --ai-model-provider OpenAI \
  --ai-model-name "Research Model" \
  --x402-support true \
  --execute \
  --json | tee register-output.json

export AGENT_UUID="$(jq -r '.prepared.info.agentUuid' register-output.json)"
echo "$AGENT_UUID"
```

### 2. Finalize the profile URI

After the registration transaction is mined:

```bash theme={null}
brickken agent set-uri \
  --chain "$CHAIN" \
  --signer-address "$WALLET" \
  --agent-uuid "$AGENT_UUID" \
  --name "Research Agent" \
  --description "On-chain AI research agent" \
  --image https://example.com/agent.png \
  --service-name A2A \
  --service-endpoint https://agent.example/.well-known/agent-card.json \
  --service-version 0.3.0 \
  --tag ai-agent \
  --documentation https://docs.brickken.com \
  --source-code https://github.com/Brickken/brickken-api-cli \
  --license MIT \
  --agent-type research \
  --supported-trust feedback \
  --x402-support true \
  --active true \
  --execute \
  --json
```

### 3. Set structured metadata

After the URI transaction is mined:

```bash theme={null}
brickken agent set-metadata \
  --chain "$CHAIN" \
  --signer-address "$WALLET" \
  --agent-uuid "$AGENT_UUID" \
  --metadata-key capabilities \
  --metadata-value '{"tasks":["research","summarization","token-operations"]}' \
  --metadata-encoding json \
  --execute \
  --json
```

The canonical identity flow is therefore: **`register` → wait → `set-uri` → wait → `set-metadata`**. See the [agent command reference](/cli/commands/agent) for every flag.

## Part 2 — Token lifecycle

### 4. Deploy the agent token

```bash theme={null}
brickken create-token \
  --chain "$CHAIN" \
  --signer-address "$WALLET" \
  --name "Research Agent Token" \
  --symbol RAGT \
  --agent-wallet "$WALLET" \
  --premint 1000 \
  --decimals 18 \
  --execute \
  --json | tee create-token-output.json

export TOKEN_ADDRESS="$(jq -r '.tokenAddress' create-token-output.json)"
echo "$TOKEN_ADDRESS"
```

<Note>
  Do not continue unless `TOKEN_ADDRESS` is populated. The CLI only adds `tokenAddress` after the deployment receipt is read from the RPC.
</Note>

### 5. Mint

```bash theme={null}
brickken mint \
  --chain "$CHAIN" \
  --signer-address "$WALLET" \
  --token-address "$TOKEN_ADDRESS" \
  --to 0xRecipientWallet \
  --amount 100 \
  --decimals 18 \
  --execute \
  --json
```

### 6. Approve an allowance

```bash theme={null}
brickken approve \
  --chain "$CHAIN" \
  --signer-address "$WALLET" \
  --token-address "$TOKEN_ADDRESS" \
  --spender-address 0xSpenderWallet \
  --amount 50 \
  --decimals 18 \
  --execute \
  --json
```

### 7. Transfer

```bash theme={null}
brickken transfer \
  --chain "$CHAIN" \
  --signer-address "$WALLET" \
  --token-address "$TOKEN_ADDRESS" \
  --to 0xRecipientWallet \
  --amount 10 \
  --decimals 18 \
  --execute \
  --json
```

## Track a transaction

Check the status of any broadcast transaction by hash:

```bash theme={null}
brickken tx status --hash 0xBlockchainTxHash --json
```

## See also

<CardGroup>
  <Card title="agent commands" icon="robot" href="/cli/commands/agent">
    Full reference for identity and reputation operations.
  </Card>

  <Card title="Token economics" icon="coins" href="/cli/commands/token-economics">
    Every token command and flag.
  </Card>

  <Card title="Raw tx flow" icon="terminal" href="/cli/commands/tx">
    Prepare, sign, send, and status for any method.
  </Card>

  <Card title="Agentic Methods (x402)" icon="book" href="/api-reference/endpoint/agentic-methods-x402">
    Backend field-level reference.
  </Card>
</CardGroup>
