Skip to content

Commit c2d38e6

Browse files
include frontmatter
1 parent 9a69c05 commit c2d38e6

34 files changed

+307
-19
lines changed

check-links.py

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import asyncio
2+
from playwright.async_api import async_playwright
3+
from urllib.parse import urljoin, urldefrag
4+
from collections import deque
5+
import aiofiles
6+
7+
BASE_URL = "http://localhost:8000"
8+
LOG_FILE = "visited.log"
9+
BROKEN_FILE = "broken-links.txt"
10+
CONTENTS_FILE = "contents.txt"
11+
12+
13+
async def check_page(page, source_url):
14+
url = page.url
15+
html = await page.content()
16+
17+
# Save page content
18+
async with aiofiles.open(CONTENTS_FILE, "a") as f:
19+
await f.write(html)
20+
21+
# Check for 404
22+
if "<h1>404 - Not found</h1>" in html:
23+
async with aiofiles.open(BROKEN_FILE, "a") as f:
24+
await f.write(f"[404] {url} (linked from {source_url})\n")
25+
26+
# Broken image sources
27+
bad_imgs = await page.eval_on_selector_all(
28+
"img[src]",
29+
"""els => els
30+
.map(e => ({ src: e.src, complete: e.complete, naturalWidth: e.naturalWidth }))
31+
.filter(e => !e.complete || e.naturalWidth === 0)
32+
.map(e => e.src)""",
33+
)
34+
if bad_imgs:
35+
async with aiofiles.open(BROKEN_FILE, "a") as f:
36+
for img in bad_imgs:
37+
await f.write(f"[Broken IMG] {img} on {url}\n")
38+
39+
# Check anchor hrefs
40+
anchors = await page.eval_on_selector_all("a[href]", "els => els.map(e => e.href)")
41+
for link in anchors:
42+
link_url, _ = urldefrag(urljoin(url, link))
43+
if not link_url.startswith(BASE_URL):
44+
continue
45+
try:
46+
res = await page.context.request.get(link_url)
47+
if res.status >= 400:
48+
async with aiofiles.open(BROKEN_FILE, "a") as f:
49+
await f.write(
50+
f"[Broken LINK] {link_url} on {url} (status {res.status})\n"
51+
)
52+
except Exception as e:
53+
async with aiofiles.open(BROKEN_FILE, "a") as f:
54+
await f.write(f"[Broken LINK] {link_url} on {url} (error {e})\n")
55+
56+
57+
async def crawl(base_url):
58+
visited = set()
59+
queue = deque([(base_url, "(start)")])
60+
61+
async with async_playwright() as p:
62+
browser = await p.chromium.launch()
63+
context = await browser.new_context()
64+
page = await context.new_page()
65+
66+
async with aiofiles.open(LOG_FILE, "w") as log_file:
67+
while queue:
68+
raw_url, source_url = queue.popleft()
69+
url, _ = urldefrag(raw_url)
70+
71+
if url in visited or not url.startswith(base_url):
72+
continue
73+
visited.add(url)
74+
75+
try:
76+
await page.goto(url)
77+
await check_page(page, source_url)
78+
await log_file.write(url + "\n")
79+
await log_file.flush()
80+
81+
links = await page.eval_on_selector_all(
82+
"a[href]", "els => els.map(e => e.href)"
83+
)
84+
for link in links:
85+
abs_link, _ = urldefrag(urljoin(url, link))
86+
if abs_link.startswith(base_url) and abs_link not in visited:
87+
queue.append((abs_link, url))
88+
89+
except Exception as e:
90+
print(f"Error visiting {url}: {e}")
91+
92+
await browser.close()
93+
94+
95+
if __name__ == "__main__":
96+
asyncio.run(crawl(BASE_URL))

docs/explorer/api/annotations.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Annotations
3+
description: Learn how to annotate traces in Explorer to add context and structure
4+
---
5+
16
# Annotations
27

38
<div class='subtitle'>Learn how to annotate traces in Explorer to add context and structure</div>
@@ -8,7 +13,7 @@ Annotations provide additional context, facilitating collaboration and agent err
813

914
<figure class='wide'>
1015

11-
<img src="site:assets/annotated-trace.png" alt="An annotated trace" style="width: 100%;">
16+
<img src="site:explorer/assets/annotated-trace.png" alt="An annotated trace" style="width: 100%;">
1217

1318
<figcaption>An annotated trace in Explorer</figcaption>
1419

docs/explorer/api/sdk-installation.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: SDK Installation
3+
description: Installing the Invariant SDK for Python
4+
---
5+
16
# SDK Installation
27

38
<div class='subtitle'>Installing the Invariant SDK for Python</div>

docs/explorer/api/uploading-traces/file-uploads.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: File Uploads
3+
description: Upload datasets to Explorer via the browser
4+
---
5+
16
# File Uploads
27

38
<div class='subtitle'>Upload datasets to Explorer via the browser</div>
@@ -8,7 +13,7 @@ Apart from API-based uploads, you can also upload datasets to Explorer using the
813

914
To upload a dataset to Explorer, navigate to the [home page](https://explorer.invariantlabs.ai) and click on the `New Dataset` button. This will open the file upload dialog.
1015

11-
![File Upload Dialog](site:assets/explorer-create-dataset.png)
16+
![File Upload Dialog](site:explorer/assets/explorer-create-dataset.png)
1217

1318
Click on the `Choose a File` button and select the dataset file from your local machine. Once the file is selected, click on the `Create` button to start the upload process.
1419

docs/explorer/benchmarks.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Benchmarks
3+
description: Submit your own AI agent to be included in a benchmark comparison
4+
---
5+
16
# Benchmarks
27

38
<div class='subtitle'>Submit your own AI agent to be included in a benchmark comparison</div>
@@ -10,7 +15,7 @@ This document outlines the datasets and benchmarks that are currently available,
1015

1116
A benchmark is a collection of tasks and environment of a particular domain, that can be used to evaluate the performance of an AI agent system. To enable comparison between different AI agents, benchmarks are typically designed to be reproducible and standardized.
1217

13-
To facilitate the comparison of AI agents, Invariant hosts a number of popular benchmarks and respective AI agent results on the <img class='inline-invariant' src="/assets/logo.svg"/> [Invariant Explorer](https://explorer.invariantlabs.ai).
18+
To facilitate the comparison of AI agents, Invariant hosts a number of popular benchmarks and respective AI agent results on the <img class='inline-invariant' src="site:/assets/logo.svg"/> [Invariant Explorer](https://explorer.invariantlabs.ai).
1419

1520
<figure>
1621

docs/explorer/search.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Search
3+
description: Use Explorer Search to quickly find and filter traces
4+
---
5+
16
# Search
27

38
<div class='subtitle'>Use Explorer Search to quickly find and filter traces</div>

docs/explorer/self-hosted.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Self-Host Explorer
3+
description: Use the self-hosted version of Explorer for local use
4+
---
5+
16
# Self-Host Explorer
27

38
<div class='subtitle'>Use the self-hosted version of Explorer for local use</div>

docs/gateway/agent-integrations/browser-use.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Browser Use Integration
3+
description: Use Gateway with <code>browser-use</code>
4+
---
5+
16
# Browser Use Integration
27

38
<div class='subtitle'>Use Gateway with <code>browser-use</code></div>

docs/gateway/agent-integrations/microsoft-autogen.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Microsoft AutoGen Integration
3+
description: Integrate Gateway with AutoGen
4+
---
5+
16
# Microsoft AutoGen Integration
27

38
<div class='subtitle'>Integrate Gateway with AutoGen</div>

docs/gateway/agent-integrations/openai-agents-sdk.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: OpenAI Agents SDK
3+
description: Use Gateway with the Agents SDK
4+
---
5+
16
# OpenAI Agents SDK
27

38
<div class='subtitle'>Use Gateway with the Agents SDK</div>

docs/gateway/agent-integrations/openai-swarm.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: OpenAI Swarm Integration
3+
description: Use Gateway with OpenAI Swarm
4+
---
5+
16
# OpenAI Swarm Integration
27

38
<div class='subtitle'>Use Gateway with OpenAI Swarm</div>

docs/gateway/agent-integrations/openhands.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: OpenHands Integration
3+
description: Use Gateway with OpenHands
4+
---
5+
16
# OpenHands Integration
27

38
<div class='subtitle'>Use Gateway with OpenHands</div>
@@ -31,7 +36,7 @@ Enable the `Advanced Options` toggle under settings and update the `Base URL` to
3136
https://explorer.invariantlabs.ai/api/v1/gateway/{add-your-dataset-name-here}/openai
3237
```
3338

34-
<img src="site:assets/openhands-integration.png" style="height: 400px !important; display: block; margin: 0 auto;"/>
39+
<img src="site:gateway/assets/openhands-integration.png" style="height: 400px !important; display: block; margin: 0 auto;"/>
3540

3641
> **Note:** Do not include the curly braces `{}`.
3742

docs/gateway/agent-integrations/swe-agent.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: SWE-agent Integration
3+
description: Use Gateway with SWE-agent
4+
---
5+
16
# SWE-agent Integration
27

38
<div class='subtitle'>Use Gateway with SWE-agent</div>

docs/gateway/llm-provider-integrations/anthropic.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Anthropic Integration
3+
description: Using Invariant Gateway with Anthropic
4+
---
5+
16
# Anthropic Integration
27

38
<div class='subtitle'>Using Invariant Gateway with Anthropic</div>

docs/gateway/llm-provider-integrations/openai.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: OpenAI Integration
3+
description: Using Invariant Gateway with OpenAI
4+
---
5+
16
# OpenAI Integration
27

38
<div class='subtitle'>Using Invariant Gateway with OpenAI</div>

docs/gateway/self-hosted.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Consider any of the following chapters next, to learn more about how to integrat
7676
<span class='tile-description'>Streamline the development and debugging of SWE-agent applications with the Gateway.</span>
7777
</a>
7878

79-
<a href="agent-integrations/browser-use" class='tile'>
79+
<a href="../agent-integrations/browser-use" class='tile'>
8080
<span class='tile-title'>Browser Use Integration →</span>
8181
<span class='tile-description'>Optimize and troubleshoot your Browser Use applications with Invariant Gateway.</span>
8282
</a>

docs/guardrails/code-validation.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Code Validation
3+
description: Secure the code that your agent generates and executes.
4+
---
5+
16
# Code Validation
27

38
<div class='subtitle'>

docs/guardrails/computer-use.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Computer Use Agents
3+
description: Guardrail the actions of computer use agents, to enable safe UI interfacing.
4+
---
5+
16
# Computer Use Agents
27

38
<div class='subtitle'>

docs/guardrails/copyright.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: Copyrighted Content
3+
---
4+
15
# Copyrighted Content
26
<div class='subtitle'>
37
{subheading}

docs/guardrails/dataflow-rules.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Dataflow Rules
3+
description: Secure the dataflow of your agentic system, to ensure that sensitive data never leaves the system through unintended channels.
4+
---
5+
16
# Dataflow Rules
27

38
<div class='subtitle'>

docs/guardrails/images.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Images
3+
description: Secure images given to, or produced by, your agentic system.
4+
---
5+
16
# Images
27

38
<div class='subtitle'>

docs/guardrails/loops.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Loop Detection
3+
description: Detect and prevent infinite loops in your agentic system.
4+
---
5+
16

27
# Loop Detection
38

docs/guardrails/moderation.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: Moderated and Toxic Content
3+
---
4+
15
# Moderated and Toxic Content
26
<div class='subtitle'>
37
{subheading}

docs/guardrails/pii.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: PII Detection
3+
description: Detect and manage PII in traces.
4+
---
5+
16
# PII Detection
27
<div class='subtitle'>
38
Detect and manage PII in traces.

docs/guardrails/prompt-injections.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: Jailbreaks and Prompt Injections
3+
---
4+
15
# Jailbreaks and Prompt Injections
26
<div class='subtitle'>
37
{subheading}

docs/guardrails/secrets.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: Secret Tokens and Credentials
3+
---
4+
15
# Secret Tokens and Credentials
26
<div class='subtitle'>
37
{subheading}

docs/guardrails/tool-calls.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Tool Calls
3+
description: Guardrail the function and tool calls of your agentic system.
4+
---
5+
16
# Tool Calls
27

38
<div class='subtitle'>

docs/testing/running/pytest-compatibility.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: `pytest` Compatibility
3+
description: Use 'testing' as part of your existing pytest test suite.
4+
---
5+
16
# `pytest` Compatibility
27

38
<div class='subtitle'>Use <code>testing</code> as part of your existing <code>pytest</code> test suite.</div>

docs/testing/running/visual-debugging.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Visual Debugging
3+
description: Use Explorer to view test failures and debug your agent.
4+
---
5+
16
# Visual Debugging
27

38
<div class='subtitle'>Use Explorer to view test failures and debug your agent.</div>

docs/testing/writing/integrate.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Integrate Your Agent
3+
description: Get your agent ready for testing
4+
---
5+
16
# Integrate Your Agent
27

38
<div class='subtitle'>Get your agent ready for testing</div>

docs/testing/writing/matchers.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Matchers
3+
description: Test with custom checkers and LLM-based evaluation
4+
---
5+
16
# Matchers
27

38
<div class='subtitle'>Test with custom checkers and LLM-based evaluation</div>

0 commit comments

Comments
 (0)