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

# Fetch wrapper

> A drop-in replacement for the standard fetch that guards every outbound call.

A drop-in replacement for the standard `fetch` that guards every outbound call.
Use this when your agent doesn't live inside one of the supported framework
SDKs.

## Install

```bash theme={"dark"}
npm install @inviolet/agent-sdk-fetch @inviolet/agent-sdk-core
```

## Use

```ts theme={"dark"}
import { Inviolet } from '@inviolet/agent-sdk-core'
import { createGuardedFetch } from '@inviolet/agent-sdk-fetch'

const inviolet = new Inviolet({
  gatewayUrl: process.env.INVIOLET_GATEWAY_URL!,
  apiKey: process.env.INVIOLET_API_KEY!,
  agentId: 'data-bot',
})

const fetch = createGuardedFetch({
  inviolet,
  intentId: 'intents:hr_lookup',
  actor: 'alice@example.com',
  audience: 'workday-prod',
})

const res = await fetch('https://workday.example.com/api/people/42')
```

## What it does

Every request resolves a `surface=http_api`, `operation=<METHOD> <url-path>`
action and runs it through `inviolet.guard()`. Denied calls throw
`InvioletDeniedError`; allowed calls proceed exactly as the native `fetch`
would.
