Available Examples
Direct Context
API-based indexing and search
FileSystem Context
Local directory search
File Search Server
REST API for code search
Prompt Enhancer Server
Context-aware prompt enhancement
GitHub Action Indexer
CI/CD repository indexing
Getting the Examples
All example code is available in the Auggie repository. To access the examples:Prerequisites
Before running the examples:-
Runtime - One of the following:
- TypeScript: Node.js 18+
- Python: Python 3.10+
-
Auggie CLI - Required for FileSystem Context examples
-
Authentication - Required for all examples
This creates a session file at
~/.augment/session.jsonwith your API token. Alternatively, set environment variables:
Setup
Install dependencies:Simple Examples
Get started quickly with these basic examples that demonstrate core SDK functionality.Direct Context
Demonstrates indexing files from any source and performing semantic searches with AI-powered question answering. Quick Start:FileSystem Context
Shows how to search a local directory using automatic file discovery via the MCP protocol. Prerequisites:- Auggie CLI must be installed and in your PATH
- Authentication via
auggie loginorAUGMENT_API_TOKENenvironment variable - A
.gitignoreor.augmentignorefile in the workspace directory to excludenode_modules/and other large directories
node_modules/), make sure you have a .gitignore or .augmentignore file that excludes them.
Quick Start:
Developer Tools
Build production-ready applications with these server examples.File Search Server
A REST API server that provides semantic file search with AI-powered summarization. Prerequisites: Auggie CLI must be installed and in your PATH. Quick Start:Prompt Enhancer Server
An HTTP server that automatically enriches user prompts with relevant codebase context. Prerequisites: Auggie CLI must be installed and in your PATH. Quick Start:CI/CD Integration
Integrate the SDK into your continuous integration workflows.GitHub Action Indexer
Automatically index your GitHub repositories with zero-question setup and incremental updates. Perfect for CI/CD workflows and keeping your codebase searchable. Key Features:- 🔄 Incremental indexing - Only processes changed files for efficiency
- 💾 Smart caching - Persists index state between runs
- 🚀 30-second setup - From zero to running GitHub Action
- Indexes your codebase automatically on every push
- Updates incrementally using GitHub’s Compare API
- Caches index state for fast subsequent runs
- Handles large repositories with optimized performance settings
- Keeping your codebase searchable and up-to-date
- CI/CD workflows that need codebase understanding
- Teams wanting automatic repository indexing
- Projects with frequent commits (incremental updates are fast)
Troubleshooting
MCP Timeout in FileSystem Context
Problem: The FileSystem Context example times out during indexing. Cause: The workspace directory contains too many files (e.g.,node_modules/ with 45,000+ files).
Solution: Create a .gitignore or .augmentignore file in the workspace directory to exclude large directories:
.gitignore and .augmentignore patterns and will skip excluded files during indexing.
Authentication Errors
Problem:Error: API key is required for searchAndAsk() or ValueError: API credentials are required
Cause: The SDK cannot find your authentication credentials.
Solution: Run auggie login to authenticate, or set the AUGMENT_API_TOKEN and AUGMENT_API_URL environment variables.