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

# Olostep + Mastra Integratie

> Bouw AI-agenten met webzoek-, scraping- en crawlfuncties met behulp van het agentframework van Mastra.ai

De Olostep Mastra-integratie brengt krachtige webdata-extractiemogelijkheden naar Mastra.ai-agenten. Olostep is een Webzoek-, scraping- en crawling-API — een API om webdata te zoeken, te extraheren en te structureren. Bouw intelligente AI-agenten die autonoom data van elke website kunnen zoeken, scrapen, analyseren en structureren.

[Installeren van npm →](https://www.npmjs.com/package/@olostep/mastra-tools)

## Functies

De integratie biedt 4 krachtige API's voor geautomatiseerde webdata-extractie:

<CardGroup cols={2}>
  <Card title="Website Scrapen" icon="file-lines">
    Extraheer inhoud van elke enkele URL in meerdere formaten (Markdown, HTML, JSON, tekst)
  </Card>

  <Card title="Batch Scrapen van URL's" icon="layer-group">
    Verwerk tot 100.000 URL's parallel. Perfect voor grootschalige data-extractie
  </Card>

  <Card title="Crawl Maken" icon="spider-web">
    Ontdek en scrape autonoom volledige websites door links te volgen
  </Card>

  <Card title="Kaart Maken" icon="map">
    Extraheer alle URL's van een website voor analyse van de sitestructuur en inhoudsontdekking
  </Card>
</CardGroup>

## Installatie

<CodeGroup>
  ```bash npm theme={null}
  npm install @olostep/mastra-tools
  ```

  ```bash yarn theme={null}
  yarn add @olostep/mastra-tools
  ```

  ```bash pnpm theme={null}
  pnpm add @olostep/mastra-tools
  ```
</CodeGroup>

## Configuratie

### 1. Installeer het Pakket

```bash theme={null}
npm install @olostep/mastra-tools @mastra/core
```

### 2. Importeer en Registreer Integratie

In je Mastra-configuratiebestand:

```typescript theme={null}
import { Mastra } from '@mastra/core';
import { createOlostepIntegration } from '@olostep/mastra-tools';

// Maak de Olostep-integratie
const olostep = createOlostepIntegration();

// Registreer API's (dit maakt ze beschikbaar voor agenten)
olostep.registerApis();

// Voeg toe aan je Mastra-config
export const mastra = new Mastra({
  config: {
    integrations: [olostep],
    // ... andere config
  },
});
```

### 3. Configureer API-sleutel

Stel je Olostep API-sleutel in als een omgevingsvariabele:

```bash theme={null}
export OLOSTEP_API_KEY=your-api-key-here
```

Of in je `.env` bestand:

```
OLOSTEP_API_KEY=your-api-key-here
```

Verkrijg je API-sleutel van het [Olostep Dashboard](https://olostep.com/dashboard).

## Beschikbare API's

De integratie stelt 4 API's bloot die je Mastra-agenten kunnen gebruiken:

### scrapeWebsite

Extraheer inhoud van een enkele URL. Ondersteunt meerdere formaten en JavaScript-rendering.

**Gebruiksscenario's:**

* Specifieke pagina's monitoren op wijzigingen
* Productinformatie van e-commerce sites extraheren
* Data verzamelen van nieuwsartikelen of blogposts
* Inhoud ophalen voor contentaggregatie

**Schema Parameters:**

<ParamField path="apiKey" type="string" required>
  Je Olostep API-sleutel
</ParamField>

<ParamField path="url_to_scrape" type="string" required>
  Website-URL om te scrapen (moet http\:// of https\:// bevatten)
</ParamField>

<ParamField path="formats" type="array" default="['markdown']">
  Uitvoerformaten: \['html', 'markdown', 'json', 'text']
</ParamField>

<ParamField path="country" type="string">
  Landcode voor locatie-specifieke inhoud (bijv. "US", "GB", "CA")
</ParamField>

<ParamField path="wait_before_scraping" type="number">
  Wachttijd in milliseconden voor JavaScript-rendering (0-10000)
</ParamField>

<ParamField path="parser" type="string">
  Optionele parser-ID voor gespecialiseerde extractie (bijv. "@olostep/amazon-product")
</ParamField>

**Antwoord:**

* `id` - Scrape ID
* `url_to_scrape` - Gescrapete URL
* `result.markdown_content` - Markdown inhoud
* `result.html_content` - HTML inhoud
* `result.json_content` - JSON inhoud
* `result.text_content` - Tekst inhoud
* `result.screenshot_hosted_url` - Screenshot URL (indien beschikbaar)
* `result.markdown_hosted_url` - Gehoste markdown URL
* `object` - Objecttype ("scrape")
* `created` - Unix-tijdstempel

**Voorbeeldgebruik:**

```typescript theme={null}
// In je agent of workflow
const result = await mastra.callApi({
  integrationName: 'olostep',
  api: 'scrapeWebsite',
  payload: {
    data: {
      apiKey: process.env.OLOSTEP_API_KEY,
      url_to_scrape: 'https://example.com',
      formats: ['markdown'],
      country: 'US',
    }
  }
});
```

### batchScrape

Verwerk meerdere URL's parallel (tot 100.000 tegelijk). Perfect voor grootschalige data-extractie.

**Gebruiksscenario's:**

* Volledige productcatalogi scrapen
* Data extraheren van meerdere zoekresultaten
* Lijsten van URL's uit spreadsheets verwerken
* Bulk contentextractie

**Schema Parameters:**

<ParamField path="apiKey" type="string" required>
  Je Olostep API-sleutel
</ParamField>

<ParamField path="batch_array" type="array" required>
  Array van objecten met `url` en optionele `custom_id` velden

  Voorbeeld: `[{"url":"https://example.com","custom_id":"site1"}]`
</ParamField>

<ParamField path="formats" type="array" default="['markdown']">
  Uitvoerformaten voor alle URL's
</ParamField>

<ParamField path="country" type="string">
  Landcode voor locatie-specifieke scraping
</ParamField>

<ParamField path="wait_before_scraping" type="number">
  Wachttijd in milliseconden voor JavaScript-rendering
</ParamField>

<ParamField path="parser" type="string">
  Optionele parser-ID voor gespecialiseerde extractie
</ParamField>

**Antwoord:**

* `batch_id` - Batch ID (gebruik dit om later resultaten op te halen)
* `status` - Verwerkingsstatus
* `object` - Objecttype ("batch")

**Voorbeeldgebruik:**

```typescript theme={null}
const result = await mastra.callApi({
  integrationName: 'olostep',
  api: 'batchScrape',
  payload: {
    data: {
      apiKey: process.env.OLOSTEP_API_KEY,
      batch_array: [
        { url: 'https://example.com', custom_id: 'site1' },
        { url: 'https://test.com', custom_id: 'site2' },
      ],
      formats: ['markdown'],
    }
  }
});
```

### createCrawl

Ontdek en scrape autonoom volledige websites door links te volgen. Perfect voor documentatiesites, blogs en inhoudsrepositories.

**Gebruiksscenario's:**

* Volledige documentatiesites crawlen en archiveren
* Alle blogposts van een website extraheren
* Kennisbanken bouwen van webinhoud
* Wijzigingen in de sitestructuur monitoren

**Schema Parameters:**

<ParamField path="apiKey" type="string" required>
  Je Olostep API-sleutel
</ParamField>

<ParamField path="start_url" type="string" required>
  Start-URL voor de crawl (moet http\:// of https\:// bevatten)
</ParamField>

<ParamField path="max_pages" type="number" default="10">
  Maximum aantal pagina's om te crawlen. Stel in op `1` om alleen de start-URL te scrapen.
</ParamField>

<ParamField path="formats" type="array" default="['markdown']">
  Formaat voor gescrapete inhoud
</ParamField>

<ParamField path="country" type="string">
  Optionele landcode voor locatie-specifieke crawling
</ParamField>

<ParamField path="parser" type="string">
  Optionele parser-ID voor gespecialiseerde inhoudsextractie
</ParamField>

**Antwoord:**

* `id` - Crawl ID (gebruik dit om later resultaten op te halen)
* `object` - Objecttype ("crawl")
* `status` - Crawlstatus
* `created` - Unix-tijdstempel

**Voorbeeldgebruik:**

```typescript theme={null}
const result = await mastra.callApi({
  integrationName: 'olostep',
  api: 'createCrawl',
  payload: {
    data: {
      apiKey: process.env.OLOSTEP_API_KEY,
      start_url: 'https://docs.example.com',
      max_pages: 50,
      formats: ['markdown'],
    }
  }
});
```

### createMap

Extraheer alle URL's van een website voor inhoudsontdekking en sitestructuuranalyse.

**Gebruiksscenario's:**

* Sitemaps en sitestructuurdiagrammen bouwen
* Alle pagina's ontdekken voordat je batch scraping uitvoert
* Gebroken of ontbrekende pagina's vinden
* SEO-audits en analyses

**Schema Parameters:**

<ParamField path="apiKey" type="string" required>
  Je Olostep API-sleutel
</ParamField>

<ParamField path="url" type="string" required>
  Website-URL om links uit te extraheren (moet http\:// of https\:// bevatten)
</ParamField>

<ParamField path="search_query" type="string">
  Optionele zoekopdracht om URL's te filteren (bijv. "blog")
</ParamField>

<ParamField path="top_n" type="number">
  Beperk het aantal geretourneerde URL's
</ParamField>

<ParamField path="include_urls" type="array">
  Glob-patronen om specifieke paden op te nemen (bijv. \["/blog/\*\*"])
</ParamField>

<ParamField path="exclude_urls" type="array">
  Glob-patronen om specifieke paden uit te sluiten (bijv. \["/admin/\*\*"])
</ParamField>

**Antwoord:**

* `id` - Map ID
* `object` - Objecttype ("map")
* `url` - Website-URL
* `total_urls` - Totaal gevonden URL's
* `urls` - Array van ontdekte URL's

**Voorbeeldgebruik:**

```typescript theme={null}
const result = await mastra.callApi({
  integrationName: 'olostep',
  api: 'createMap',
  payload: {
    data: {
      apiKey: process.env.OLOSTEP_API_KEY,
      url: 'https://example.com',
      search_query: 'blog',
      top_n: 100,
      include_urls: ['/blog/**'],
    }
  }
});
```

## Gebruik met Agenten

### Basis Agent Voorbeeld

Maak een agent die websites kan scrapen:

```typescript theme={null}
import { Agent } from '@mastra/core';
import { createOlostepIntegration } from '@olostep/mastra-tools';

const olostep = createOlostepIntegration();
olostep.registerApis();

const agent = new Agent({
  name: 'web-onderzoeker',
  instructions: `
    Je bent een webonderzoeksassistent. Wanneer gebruikers je vragen om informatie van een website te halen,
    gebruik je de Olostep scrapeWebsite API om de inhoud te extraheren en deze vervolgens samen te vatten voor hen.
  `,
  model: 'openai/gpt-4',
});

// De agent kan nu Olostep API's gebruiken via Mastra's API-systeem
```

### Agent Workflow Voorbeeld

Bouw een onderzoeksworkflow die inhoud ontdekt en scrapt:

```typescript theme={null}
// 1. Kaart een website om URL's te ontdekken
const mapResult = await mastra.callApi({
  integrationName: 'olostep',
  api: 'createMap',
  payload: {
    data: {
      apiKey: process.env.OLOSTEP_API_KEY,
      url: 'https://example.com',
      include_urls: ['/blog/**'],
    }
  }
});

// 2. Batch scrape ontdekte URL's
const batchResult = await mastra.callApi({
  integrationName: 'olostep',
  api: 'batchScrape',
  payload: {
    data: {
      apiKey: process.env.OLOSTEP_API_KEY,
      batch_array: mapResult.urls.slice(0, 10).map(url => ({ url })),
      formats: ['markdown'],
    }
  }
});

// 3. Verwerk resultaten met je agent
const summary = await agent.generate({
  messages: [{
    role: 'user',
    content: `Vat deze inhoud samen: ${batchResult.result.markdown_content}`
  }]
});
```

## Populaire Gebruiksscenario's

### Onderzoeksagent

Bouw een agent die autonoom onderwerpen onderzoekt:

<AccordionGroup>
  <Accordion title="Multi-Source Onderzoek">
    **Workflow:**

    1. Gebruiker vraagt: "Onderzoek AI-trends"
    2. Agent gebruikt `createMap` om relevante pagina's te ontdekken
    3. Agent gebruikt `batchScrape` om inhoud te extraheren
    4. Agent analyseert en vat bevindingen samen
    5. Retourneert gestructureerd onderzoeksrapport
  </Accordion>

  <Accordion title="Concurrentie Monitoring">
    **Workflow:**

    1. Plan dagelijkse monitoring
    2. Gebruik `scrapeWebsite` om concurrentiepagina's te controleren
    3. Vergelijk met eerdere data
    4. Waarschuw bij significante wijzigingen
    5. Genereer wekelijkse rapporten
  </Accordion>

  <Accordion title="Inhoudsaggregatie">
    **Workflow:**

    1. Gebruik `createCrawl` om alle blogposts te ontdekken
    2. Gebruik `batchScrape` om inhoud te extraheren
    3. Verwerk met AI om kernonderwerpen te extraheren
    4. Sla op in kennisbank
    5. Genereer inhoudskalender
  </Accordion>
</AccordionGroup>

### E-commerce Intelligentie

Monitor producten en prijzen:

```
Agent Workflow:
1. Scrape productpagina's (scrapeWebsite)
2. Extraheer gestructureerde data (met parser)
3. Volg prijswijzigingen
4. Genereer waarschuwingen
5. Update database
```

### SEO Analyse

Analyseer sitestructuur en inhoud:

```
Agent Workflow:
1. Kaart sitestructuur (createMap)
2. Crawl belangrijke secties (createCrawl)
3. Analyseer inhoudskwaliteit
4. Identificeer SEO-kansen
5. Genereer aanbevelingen
```

## Gespecialiseerde Parsers

Olostep biedt vooraf gebouwde parsers voor populaire websites. Gebruik ze met de `parser` parameter:

<CardGroup cols={2}>
  <Card title="Google Zoeken" icon="google">
    `@olostep/google-search`

    Extraheer: zoekresultaten, titels, fragmenten, URL's
  </Card>

  <Card title="Google Maps" icon="map">
    `@olostep/google-maps`

    Extraheer: bedrijfsinformatie, beoordelingen, beoordelingen, locatie
  </Card>
</CardGroup>

### Gebruik van Parsers

Voeg de parser-ID toe aan de `parser` parameter:

```typescript theme={null}
const result = await mastra.callApi({
  integrationName: 'olostep',
  api: 'scrapeWebsite',
  payload: {
    data: {
      apiKey: process.env.OLOSTEP_API_KEY,
      url_to_scrape: 'https://www.amazon.com/dp/PRODUCT_ID',
      formats: ['json'],
      parser: '@olostep/amazon-product',
    }
  }
});
```

De parser extraheert automatisch gestructureerde data specifiek voor dat websitetype.

## Beste Praktijken

<AccordionGroup>
  <Accordion title="Gebruik Batchverwerking voor Meerdere URL's">
    Wanneer je meer dan 3-5 URL's scrapt, gebruik dan `batchScrape` in plaats van meerdere `scrapeWebsite` oproepen. Batchverwerking is:

    * Veel sneller (parallelle verwerking)
    * Kosteneffectiever
    * Makkelijker te beheren
    * Beter voor snelheidslimieten
  </Accordion>

  <Accordion title="Stel Geschikte Wachttijden In">
    Voor JavaScript-intensieve sites, gebruik de `wait_before_scraping` parameter:

    * Eenvoudige sites: 0-1000ms
    * Dynamische sites: 2000-3000ms
    * Zware JavaScript: 5000-8000ms

    Test met verschillende waarden om de optimale wachttijd te vinden.
  </Accordion>

  <Accordion title="Gebruik Gespecialiseerde Parsers">
    Voor populaire websites (Amazon, LinkedIn, Google), gebruik vooraf gebouwde parsers:

    * Krijg automatisch gestructureerde data
    * Betrouwbaardere extractie
    * Geen behoefte aan aangepaste parsing
    * Onderhouden door Olostep
  </Accordion>

  <Accordion title="Behandel Asynchrone Operaties">
    Batch-, Crawl- en Map-operaties zijn asynchroon:

    * Bewaar de geretourneerde ID (batch\_id, crawl\_id, map\_id)
    * Poll voor voltooiing of gebruik webhooks
    * Stel aparte workflows in voor ophalen
  </Accordion>

  <Accordion title="Foutafhandeling">
    Omhul API-oproepen altijd in try-catch blokken:

    ```typescript theme={null}
    try {
      const result = await mastra.callApi({
        integrationName: 'olostep',
        api: 'scrapeWebsite',
        payload: { data: {...} }
      });
    } catch (error) {
      // Behandel authenticatie-, snelheidslimiet- of netwerkfouten
      console.error('Scraping mislukt:', error.message);
    }
    ```
  </Accordion>

  <Accordion title="Snelheidslimiet">
    Wees je bewust van snelheidslimieten:

    * Spreid verzoeken met vertragingen
    * Gebruik batchverwerking wanneer mogelijk
    * Monitor gebruik in Olostep dashboard
    * Upgrade plan indien nodig
  </Accordion>
</AccordionGroup>

## Compleet Voorbeeld

Hier is een compleet voorbeeld van het bouwen van een onderzoeksagent:

```typescript theme={null}
import { Mastra } from '@mastra/core';
import { Agent } from '@mastra/core';
import { createOlostepIntegration } from '@olostep/mastra-tools';

// Maak en registreer Olostep-integratie
const olostep = createOlostepIntegration();
olostep.registerApis();

// Initialiseer Mastra
export const mastra = new Mastra({
  config: {
    integrations: [olostep],
    // ... andere config
  },
});

// Maak onderzoeksagent
const researchAgent = new Agent({
  name: 'onderzoeksassistent',
  instructions: `
    Je bent een onderzoeksassistent die webdata kan zoeken, extraheren en structureren.
    Wanneer gebruikers je vragen om een onderwerp te onderzoeken:
    1. Gebruik Olostep's createMap om relevante pagina's te ontdekken
    2. Gebruik batchScrape om inhoud van meerdere bronnen te extraheren
    3. Analyseer en vat de bevindingen samen
    4. Presenteer gestructureerde onderzoeksrapporten
  `,
  model: 'openai/gpt-4',
});

// Gebruik de agent
async function researchTopic(topic: string) {
  // Stap 1: Ontdek relevante pagina's
  const mapResult = await mastra.callApi({
    integrationName: 'olostep',
    api: 'createMap',
    payload: {
      data: {
        apiKey: process.env.OLOSTEP_API_KEY!,
        url: `https://example.com/search?q=${topic}`,
        top_n: 20,
      }
    }
  });

  // Stap 2: Scrape ontdekte pagina's
  const batchResult = await mastra.callApi({
    integrationName: 'olostep',
    api: 'batchScrape',
    payload: {
      data: {
        apiKey: process.env.OLOSTEP_API_KEY!,
        batch_array: mapResult.urls.slice(0, 10).map(url => ({ url })),
        formats: ['markdown'],
      }
    }
  });

  // Stap 3: Analyseer met agent
  const summary = await researchAgent.generate({
    messages: [{
      role: 'user',
      content: `Op basis van deze onderzoeksdata, geef een uitgebreide samenvatting van ${topic}`
    }]
  });

  return summary;
}
```

## Probleemoplossing

<AccordionGroup>
  <Accordion title="Authenticatie Mislukt">
    **Fout**: "Ongeldige API-sleutel"

    **Oplossingen**:

    * Controleer API-sleutel vanuit [dashboard](https://olostep.com/dashboard)
    * Zorg ervoor dat API-sleutel is ingesteld in omgevingsvariabele
    * Verifieer dat API-sleutel actief is
    * Controleer op extra spaties in API-sleutel
  </Accordion>

  <Accordion title="API Niet Gevonden">
    **Fout**: "API niet gevonden" of "Integratie niet geregistreerd"

    **Oplossingen**:

    * Zorg ervoor dat `registerApis()` wordt aangeroepen na het maken van integratie
    * Verifieer dat integratie is toegevoegd aan Mastra-config
    * Controleer dat integratienaam 'olostep' is
    * Herstart Mastra-server na wijzigingen
  </Accordion>

  <Accordion title="Scrape Geeft Lege Inhoud Terug">
    **Fout**: Inhoudsvelden zijn leeg

    **Oplossingen**:

    * Verhoog `wait_before_scraping` tijd
    * Controleer of website inloggen vereist
    * Probeer een ander formaat (HTML vs Markdown)
    * Verifieer dat URL toegankelijk is
    * Controleer of site geautomatiseerde toegang blokkeert
  </Accordion>

  <Accordion title="Snelheidslimiet Overschreden">
    **Fout**: "Snelheidslimiet overschreden"

    **Oplossingen**:

    * Spreid verzoeken met vertragingen
    * Gebruik batchverwerking in plaats van individuele scrapes
    * Upgrade je Olostep-plan
    * Controleer snelheidslimiet in dashboard
  </Accordion>

  <Accordion title="TypeScript Fouten">
    **Fout**: Module niet gevonden of typefouten

    **Oplossingen**:

    * Zorg ervoor dat `@mastra/core` is geïnstalleerd
    * Controleer TypeScript-versiecompatibiliteit
    * Verifieer dat alle afhankelijkheden zijn geïnstalleerd
    * Herbouw: `npm run build`
  </Accordion>
</AccordionGroup>

## Prijzen

Olostep rekent kosten op basis van API-gebruik, onafhankelijk van Mastra:

* **Scrapes**: Betaal per scrape
* **Batches**: Betaal per URL in batch
* **Crawls**: Betaal per gecrawlde pagina
* **Maps**: Betaal per map-operatie

Bekijk de huidige prijzen op [olostep.com/pricing](https://www.olostep.com/pricing).

## Ondersteuning

Hulp nodig met de Mastra-integratie?

<CardGroup cols={2}>
  <Card title="Documentatie" icon="book" href="https://docs.olostep.com">
    Blader door volledige API-documentatie
  </Card>

  <Card title="Ondersteuning E-mail" icon="envelope" href="mailto:info@olostep.com">
    E-mail: [info@olostep.com](mailto:info@olostep.com)
  </Card>

  <Card title="Mastra Docs" icon="robot" href="https://mastra.ai/docs">
    Leer over het Mastra-framework
  </Card>
</CardGroup>

## Gerelateerde Bronnen

<CardGroup cols={2}>
  <Card title="Scrapes API" icon="file-lines" href="/features/scrapes">
    Leer over de Scrapes eindpunt
  </Card>

  <Card title="Batches API" icon="layer-group" href="/features/batches">
    Leer over de Batches eindpunt
  </Card>

  <Card title="Crawls API" icon="spider-web" href="/features/crawls">
    Leer over de Crawls eindpunt
  </Card>

  <Card title="Maps API" icon="map" href="/features/maps">
    Leer over de Maps eindpunt
  </Card>

  <Card title="Zapier Integratie" icon="bolt" href="/integrations/zapier">
    Automatiseer met Zapier-workflows
  </Card>

  <Card title="LangChain Integratie" icon="link" href="/integrations/langchain">
    Bouw AI-agenten met LangChain
  </Card>

  <Card title="Mastra Website" icon="link" href="https://mastra.ai">
    Mastra platform
  </Card>
</CardGroup>

## Aan de Slag

Klaar om AI-agenten te bouwen met webscrapingmogelijkheden?

<Card title="Installeer Pakket" icon="download" href="https://www.npmjs.com/package/@olostep/mastra-tools">
  Installeer @olostep/mastra-tools van npm
</Card>

Bouw intelligente AI-agenten die webdata kunnen zoeken, extraheren en structureren met Olostep en Mastra!
