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

# Quick Start

> Get started with Spellguard in your agent

# Quick Start

<Tabs>
  <Tab title="For Agents">
    ```typescript theme={null}
    import { fetchAndVerifyVerifier, buildEvidence, signEvidence } from '@spellguard/ctls';
    import { encryptForVerifier } from '@spellguard/amp';

    // 1. Verify Verifier before connecting
    const verifier = await fetchAndVerifyVerifier(verifierUrl, expectedImageHash);
    if (!verifier.verified) throw new Error('Verifier verification failed');

    // 2. Register with the Verifier
    const evidence = buildEvidence({
      agentId: 'my-agent',
      codeHash: 'sha256:abc123...',
      endpoint: 'https://my-agent.com/_spellguard/receive',
      agentCardUrl: 'https://my-agent.com/.well-known/agent.json',
    });
    const signed = await signEvidence(evidence, privateKey);

    // 3. Send encrypted messages
    const encrypted = encryptForVerifier(
      JSON.stringify(payload),
      verifier.sessionX25519PublicKey
    );
    ```
  </Tab>

  <Tab title="For Verifier Operators">
    ```typescript theme={null}
    import {
      generateSessionKeys,
      generateAttestationDocument,
      verifyEvidence
    } from '@spellguard/ctls';
    import {
      initLoggingBackends,
      generateCommitment,
      logAndArchive
    } from '@spellguard/amp';

    // 1. Initialize
    await generateSessionKeys();    // RAM-only, forward secrecy
    await initLoggingBackends();    // Connect to Rekor, S3, etc.

    // 2. Handle attestation requests
    const attestation = await generateAttestationDocument(clientNonce);

    // 3. Verify and register agents
    const result = await verifyEvidence(signedEvidence);
    if (result.verified) {
      registerAgent({
        agentId: result.agentId,
        channelToken: result.channelToken
      });
    }

    // 4. Process messages with audit trail
    const commitment = generateCommitment(message);
    await logAndArchive(message, commitment);
    ```
  </Tab>
</Tabs>

## Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install @spellguard/ctls @spellguard/amp
  ```

  ```bash pnpm theme={null}
  pnpm add @spellguard/ctls @spellguard/amp
  ```

  ```bash yarn theme={null}
  yarn add @spellguard/ctls @spellguard/amp
  ```
</CodeGroup>
