> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Wiki

> Read and write a markdown wiki backed by Git, the local filesystem, or Notion.

Read and write to a directory of markdown files. The provider exposes two tools: `query_wiki` for reading, `update_wiki` for writing. With a Git backend, writes auto-commit and push. With a Notion backend, writes sync to a Notion database.

```python theme={null}
from os import getenv
from agno.agent import Agent
from agno.context.wiki import WikiContextProvider
from agno.context.wiki.backend import GitBackend

wiki = WikiContextProvider(
    backend=GitBackend(
        repo_url="https://github.com/org/wiki.git",
        branch="main",
        github_token=getenv("GITHUB_TOKEN"),
        local_path="./demo-wiki-git",
    )
)

await wiki.asetup()

agent = Agent(
    model=...,
    tools=wiki.get_tools(),
)

await agent.arun("Add a page about our deployment process")
await wiki.aclose()
```

## Backends

**Git**

Auto-commits and pushes changes.

```python theme={null}
from os import getenv
from agno.context.wiki.backend import GitBackend

backend = GitBackend(
    repo_url="https://github.com/org/wiki.git",
    branch="main",
    github_token=getenv("GITHUB_TOKEN"),
    local_path="./demo-wiki-git",
)
wiki = WikiContextProvider(backend=backend)
```

**Filesystem**

Local directory, no Git.

```python theme={null}
from agno.context.wiki.backend import FileSystemBackend

backend = FileSystemBackend(path="./wiki")
wiki = WikiContextProvider(backend=backend)
```

**Notion**

Mirrors a Notion database. Each row becomes a local markdown page; writes push back to Notion, which stays the source of truth.

```shell theme={null}
uv pip install -U notion-client
```

```python theme={null}
from os import getenv
from agno.context.wiki.backend import NotionDatabaseBackend

backend = NotionDatabaseBackend(
    database_id=getenv("NOTION_DATABASE_ID"),
    token=getenv("NOTION_API_KEY"),
    local_path="./demo-wiki-notion",
)
wiki = WikiContextProvider(backend=backend)
```

`token` falls back to the `NOTION_API_KEY` environment variable. `NotionPageBackend` (nested page trees) is planned and raises `NotImplementedError` today. See the [Notion wiki example](https://github.com/agno-agi/agno/blob/main/cookbook/12_context/15a_wiki_notion.py).

## Configuration

| Parameter | Type | Default | Description |
| - | - | - | - |
| `backend` | `WikiBackend` | required | GitBackend, FileSystemBackend, or NotionDatabaseBackend. |
| `id` | `str` | `"wiki"` | Tools become `query_<id>` and `update_<id>`. |
| `web` | `ContextBackend` | `None` | Optional web backend for ingestion (fetch URL → write page). |
| `model` | `Model` | `None` | Model for sub-agents. |
| `read` | `bool` | `True` | Expose `query_wiki`. |
| `write` | `bool` | `True` | Expose `update_wiki`. |

## Tools Exposed

| Tool | Description |
| - | - |
| `query_wiki` | Search pages, read content, list structure. |
| `update_wiki` | Create pages, edit content. Auto-commits with Git backend. |

## Web Ingestion

Add a web backend to let the agent fetch URLs and write them as wiki pages:

```python theme={null}
from agno.context.web import ExaBackend

wiki = WikiContextProvider(
    backend=GitBackend(..., local_path="./demo-wiki-git"),
    web=ExaBackend(),
)

# Agent can now: "Add this article to the wiki: https://..."
```

`ExaBackend` requires the `exa-py` package (`uv pip install -U exa-py`) and the `EXA_API_KEY` environment variable. See [Web](https://agno-v2.mintlify.site/context-providers/providers/web.md) for other backends.

## Lifecycle Management

With GitBackend, `asetup()` clones the repo. Queries and updates run it automatically on first use; call it at startup to surface clone errors early:

```python theme={null}
await wiki.asetup()   # Clone repo
try:
    agent = Agent(model=..., tools=wiki.get_tools())
    await agent.arun("What do we have documented about deployments?")
finally:
    await wiki.aclose()
```

## Example queries

| Query | What happens |
| - | - |
| "What do we have documented about authentication?" | Searches wiki content |
| "Create a page about the new API endpoints" | Creates markdown file, commits |
| "Update the deployment guide with the new steps" | Edits file, commits |

## Resources

> **[Workspace Reference](https://agno-v2.mintlify.site/tools/toolkits/local/workspace.md)**
>
> Underlying file operations

> **[Cookbook Example](https://github.com/agno-agi/agno/blob/main/cookbook/12_context/15_wiki_git.py)**
>
> Git-backed wiki example


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.