### Local Development Setup and Execution Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/github-action-indexer/README.md Clone the repository, install dependencies, set environment variables, and run the indexing and search commands locally. ```bash git clone https://github.com/augmentcode/auggie.git cd auggie/examples/typescript-sdk/context/github-action-indexer npm install export AUGMENT_API_TOKEN="your-token" export AUGMENT_API_URL="https://your-tenant.api.augmentcode.com/" export GITHUB_TOKEN="your-github-token" export GITHUB_REPOSITORY="owner/repo" export GITHUB_SHA="$(git rev-parse HEAD)" npm run index npm run search "authentication functions" npm run search "error handling" ``` -------------------------------- ### Install GitHub Action Indexer Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/README.md Installs dependencies for the GitHub Action Indexer example. ```bash npm run github-indexer:install ``` -------------------------------- ### Run FileSystem Context Example Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/README.md Executes the FileSystem Context example for local directory search via MCP protocol. Ensure Auggie CLI is installed and authenticated. ```bash npm run filesystem-context ``` -------------------------------- ### Running Auggie SDK Examples Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/README.md These bash commands show how to execute the provided Python examples. You can run a specific example, specify a custom workspace, or select a different model. ```bash # Run a specific example python basic_usage.py # Run with custom workspace python basic_usage.py --workspace /path/to/workspace # Run with different model python basic_usage.py --model gpt-4o ``` -------------------------------- ### Authenticate and Run Direct Context Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/direct_context/README.md Shows how to authenticate with Auggie and run the direct context example from the command line. ```bash # Authenticate auggie login # Run the example (from the context directory) cd examples/python-sdk/context python -m direct_context # Or run directly python direct_context/main.py ``` -------------------------------- ### Run Individual Example with Python SDK Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/user_examples/README.md Execute a specific Python example script from the command line. Ensure you are in the directory containing the script. ```bash python 01_quick_start.py ``` -------------------------------- ### Install SDK Dependencies Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/README.md Installs project dependencies for the TypeScript SDK context examples. ```bash cd examples/typescript-sdk/context npm install ``` -------------------------------- ### Run File Search Server Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/README.md Starts a REST API for semantic file search with AI summarization. The server runs locally on port 3000. ```bash python -m file_search_server . ``` -------------------------------- ### Authenticate and Run Direct Context Example Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/direct-context/README.md Use these commands to authenticate your Auggie client and then run the direct context example. ```bash # Authenticate auggie login # Run the example npx tsx examples/context/direct-context/index.ts ``` -------------------------------- ### Run Direct Context Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/README.md Executes the Direct Context example, which uses API-based indexing with semantic search and AI Q&A. ```bash python -m direct_context ``` -------------------------------- ### Install Auggie CLI Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/README.md Installs the Auggie CLI globally. This is a prerequisite for FileSystem Context examples. ```bash npm install -g @augmentcode/auggie@prerelease ``` -------------------------------- ### Run Direct Context Example Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/README.md Executes the Direct Context example, which uses API-based indexing with semantic search and AI Q&A. ```bash npm run direct-context ``` -------------------------------- ### Prompt Example: Documentation Generator Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/PROMPT_TO_CODE.md An example prompt for generating documentation for public functions and classes, including validation against the Google style guide. ```plaintext Analyze all public functions and classes in the src/ directory. For each one that's missing a docstring or has an incomplete docstring, generate comprehensive documentation including description, parameters, return values, and usage examples. Then validate that all docstrings follow Google style guide format. ``` -------------------------------- ### Run Prompt Enhancer Server Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/README.md Starts an HTTP server that enhances prompts with codebase context. The server runs locally on port 3001. ```bash python -m prompt_enhancer_server . ``` -------------------------------- ### Run Basic Usage Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/README.md Execute the basic_usage.py script to demonstrate fundamental SDK features. ```bash python basic_usage.py ``` -------------------------------- ### Quick Start with Auggie SDK Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/user_examples/user_guide.md Instantiate the Auggie agent and run a simple instruction. ```python from auggie_sdk import Auggie # Create an agent instance agent = Auggie() # Run a simple instruction response = agent.run("What is the capital of France?") print(response) # Output: Paris ``` -------------------------------- ### Install and Authenticate Auggie CLI Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/file_search_server/README.md Install the Auggie CLI globally and authenticate your account to use the service. ```bash npm install -g @augmentcode/auggie@prerelease auggie login ``` -------------------------------- ### Run Function Calling Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/FUNCTION_CALLING.md Navigate to the example directory and execute the Python script to test the function calling capabilities of the Auggie SDK. ```bash cd examples/python-sdk python3 function_calling_example.py ``` -------------------------------- ### Authenticate and Run Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/filesystem_context/README.md Authenticate with Auggie for AI features and then run the filesystem context example from the specified directory. Alternatively, you can run the main Python script directly. ```bash # Authenticate (for AI features) auggie login # Run the example (from the context directory) cd examples/python-sdk/context python -m filesystem_context # Or run directly python filesystem_context/main.py ``` -------------------------------- ### Run Examples Directly with tsx Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/README.md Executes TypeScript examples directly using tsx without installing project dependencies first. Note: dependencies will be downloaded on each run. ```bash npx tsx direct-context/index.ts ``` ```bash npx tsx filesystem-context/index.ts ``` ```bash npx tsx file-search-server/index.ts . ``` ```bash npx tsx prompt-enhancer-server/index.ts . ``` -------------------------------- ### Run FileSystem Context Example Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/filesystem-context/README.md Execute the filesystem context example script using tsx. This script demonstrates local directory search and AI-powered Q&A. ```bash npx tsx examples/context/filesystem-context/index.ts ``` -------------------------------- ### Install GitHub Action Indexer Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/github-action-indexer/README.md Use the npx command to install the indexer in your repository, which automatically sets up the workflow file, source files, and TypeScript configuration. ```bash # Install in current directory cd /path/to/your/repository npx @augment-samples/github-action-indexer install # Or specify the repository path npx @augment-samples/github-action-indexer install /path/to/your/repository ``` -------------------------------- ### Install Auggie SDK Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/README.md Install the Auggie Python SDK using pip. ```bash pip install auggie-sdk ``` -------------------------------- ### Auggie CLI Output Example Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/github-action-indexer/README.md Example output from the 'auggie token print' command, showing the format of the access token and tenant URL. ```json TOKEN={"accessToken":"your-token-here","tenantURL":"https://your-tenant.api.augmentcode.com/","scopes":["read","write"]} ``` -------------------------------- ### Run All Examples with Shell Script Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/user_examples/README.md Execute all provided Python example scripts using a shell script. This is a convenient way to test multiple functionalities. ```bash ./run_all.sh ``` -------------------------------- ### Run FileSystem Context Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/README.md Executes the FileSystem Context example for local directory search via MCP protocol. Ensure large directories are ignored to prevent timeouts. ```bash python -m filesystem_context ``` -------------------------------- ### Install Auggie CLI Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/filesystem_context/README.md Install the Auggie CLI tool. This command is used to verify the installation. ```bash auggie --version ``` -------------------------------- ### Install ACP Adapter Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/CLAUDE_CODE_CLIENT.md Install the Node.js ACP adapter globally using npm. ```bash npm install -g @zed-industries/claude-code-acp ``` -------------------------------- ### Install and Authenticate Auggie CLI Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/file-search-server/README.md Install the Auggie CLI globally and authenticate your account. This is a prerequisite for using the file search server. ```bash npm install -g @augmentcode/auggie@latest auggie login ``` -------------------------------- ### Install All Augment Commands Source: https://github.com/augmentcode/auggie/blob/main/examples/commands/README.md Installs all available Augment command templates from the GitHub repository into the local `~/.augment/commands` directory. ```bash mkdir -p ~/.augment/commands cd ~/.augment/commands curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/commands/code-review.md curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/commands/documentation.md curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/commands/tests.md curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/commands/bug-fix.md curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/commands/performance-optimization.md curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/commands/security-review.md ``` -------------------------------- ### Setup and Search with GitHub Action Indexer Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/github_action_indexer/README.md Steps to set up credentials and search an indexed repository locally using the CLI. Ensure you have unzipped the artifact and set the necessary environment variables. ```bash unzip ~/Downloads/index-state.zip -d .augment-index-state export AUGMENT_API_TOKEN="your-token" export AUGMENT_API_URL="https://your-tenant.api.augmentcode.com/" export BRANCH="main" # or whatever branch you indexed python -m github_action_indexer search "authentication functions" ``` -------------------------------- ### Sequential Workflow Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/README.md Demonstrates a sequential workflow using agent sessions, where each step builds upon the previous one. ```python with agent.session() as session: session("Step 1") session("Step 2 that builds on step 1") session("Step 3 that uses both") ``` -------------------------------- ### Start Prompt Enhancer Server Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/prompt_enhancer_server/README.md Start the prompt enhancer server by navigating to the context directory and running the Python module. Provide the workspace directory as an argument. ```bash cd examples/python-sdk/context python -m prompt_enhancer_server . ``` -------------------------------- ### Run ACP Example Usage Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/README.md Execute the acp_example_usage.py script to demonstrate the AuggieACPClient for persistent sessions with the Augment CLI. ```bash python acp_example_usage.py ``` -------------------------------- ### Run Session Usage Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/README.md Execute the session_usage.py script to demonstrate session management for conversation continuity. ```bash python session_usage.py ``` -------------------------------- ### Install Specific Augment Commands Source: https://github.com/augmentcode/auggie/blob/main/examples/commands/README.md Installs selected Augment command templates from the GitHub repository into the local `~/.augment/commands` directory. ```bash mkdir -p ~/.augment/commands cd ~/.augment/commands curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/commands/code-review.md curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/commands/documentation.md ``` -------------------------------- ### Install Auggie CLI Source: https://github.com/augmentcode/auggie/blob/main/README.md Install the Auggie CLI globally using npm. Node.js version 22 or higher is required. ```sh npm install -g @augmentcode/auggie@latest ``` -------------------------------- ### Install All Workflows (Bash) Source: https://github.com/augmentcode/auggie/blob/main/examples/workflows/README.md Installs all available Augment AI GitHub Actions workflows by downloading their YAML files. Ensure you are in the correct directory before running. ```bash mkdir -p .github/workflows cd .github/workflows curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/workflows/describe-pr.yml curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/workflows/pr-review.yml curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/workflows/on-demand-description.yml curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/workflows/on-demand-review.yml curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/workflows/release.yml curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/workflows/test-action.yml git add .github/workflows/ git commit -m "Add Augment AI workflows" git push ``` -------------------------------- ### Complete Agent Event Listener Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/AGENT_EVENT_LISTENER.md This example demonstrates how to implement all agent event listener methods to capture and process various agent outputs like messages, tool calls, and thoughts. ```python from auggie_sdk import Auggie from auggie_sdk.acp import AgentEventListener class MyListener(AgentEventListener): def on_agent_message_chunk(self, text: str) -> None: print(f"[CHUNK] {text}", end="", flush=True) def on_agent_message(self, message: str) -> None: print(f"\n[COMPLETE MESSAGE] {message}") def on_tool_call(self, tool_call_id: str, title: str, kind: str = None, status: str = None) -> None: print(f"\n[TOOL CALL] {title} (kind={kind}, status={status})") def on_tool_response(self, tool_call_id: str, status: str = None, content: Any = None) -> None: print(f"[TOOL RESPONSE] status={status}") def on_agent_thought(self, text: str) -> None: print(f"[THINKING] {text}") # Use the listener listener = MyListener() agent = Auggie(listener=listener) response = agent.run("Read the file test.py and count the lines") ``` -------------------------------- ### Run List PRs Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/README.md Execute the list_prs.py script to demonstrate working with GitHub Pull Requests using the SDK. ```bash python list_prs.py ``` -------------------------------- ### Function Calling Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/README.md Demonstrates how the agent can call predefined Python functions to perform specific tasks, returning structured results. ```python def run_tests(test_file: str) -> dict: """ Run tests from a test file. Args: test_file: Path to the test file """ # Your test logic return {"passed": 10, "failed": 2, "file": test_file} # Agent can call the function as needed result = agent.run( "Run tests in test_auth.py and analyze the results", return_type=dict, functions=[run_tests] ) ``` -------------------------------- ### Troubleshoot: Adapter not found Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/CLAUDE_CODE_CLIENT.md If you encounter a 'RuntimeError: npx not found', ensure Node.js is installed from nodejs.org. ```text RuntimeError: npx not found ``` -------------------------------- ### Searching the Index with CLI Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/github_action_indexer/README.md Demonstrates how to search the indexed repository using the command-line interface after navigating to the context examples directory. You can search for specific functionalities, patterns, or implementations. ```bash # From the context examples directory cd examples/python-sdk/context # Search for specific functionality python -m github_action_indexer search "authentication functions" # Search for error handling patterns python -m github_action_indexer search "error handling" # Search for specific implementations python -m github_action_indexer search "database queries" ``` -------------------------------- ### Example Search Output Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/github-action-indexer/README.md This is an example of the output format when searching the index, showing the search query, index status, and matching code chunks with file paths and line numbers. ```text Searching for: "authentication functions" Loading index state... Loaded index: 42 files indexed Last indexed commit: abc123def456 Branch: main Found 3 result(s): 📄 src/auth/login.ts Lines 15-28 ──────────────────────────────────────────────────────────── 15 │ export async function authenticateUser( 16 │ username: string, 17 │ password: string 18 │ ): Promise { 19 │ // Authentication logic... 20 │ } ``` -------------------------------- ### Install Specific Workflows (Bash) Source: https://github.com/augmentcode/auggie/blob/main/examples/workflows/README.md Installs selected Augment AI GitHub Actions workflows by downloading their YAML files. This is useful if you only need certain functionalities. ```bash mkdir -p .github/workflows cd .github/workflows curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/workflows/describe-pr.yml curl -O https://raw.githubusercontent.com/augmentcode/auggie/main/examples/workflows/pr-review.yml git add .github/workflows/ git commit -m "Add Augment AI workflows" git push ``` -------------------------------- ### Start Prompt Enhancer Server Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/prompt-enhancer-server/README.md Start the prompt enhancer server using npx and tsx, providing the workspace directory as an argument. This command initiates the server that will process and enhance prompts. ```bash npx tsx examples/context/prompt-enhancer-server/index.ts . ``` -------------------------------- ### Run the File Search Server Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/file-search-server/README.md Execute the file search server example using Node.js with tsx. Provide the directory to search as an argument. ```bash npx tsx examples/context/file-search-server/index.ts . ``` -------------------------------- ### Conditional Logic Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/README.md Illustrates conditional logic based on an agent's response, demonstrating how to handle different scenarios. ```python exists = agent("Does file exist?", bool) if exists: agent("Process existing file") else: agent("Create new file") ``` -------------------------------- ### Session Continuity Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/CLAUDE_CODE_CLIENT.md Demonstrates how messages sent to the same client instance maintain conversational context. ```python client = ClaudeCodeACPClient() client.start() # First message client.send_message("My favorite color is blue") # Second message - remembers the context response = client.send_message("What is my favorite color?") print(response) # Will mention "blue" client.stop() ``` -------------------------------- ### Login to Auggie Source: https://github.com/augmentcode/auggie/blob/main/README.md Authenticate with Auggie to use its services. This command should be run after installation. ```sh auggie login ``` -------------------------------- ### Initialize and Use AuggieACPClient Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/ARCHITECTURE.md Demonstrates initializing AuggieACPClient with model, workspace, and listener, then starting it and sending a message. This client directly implements the ACP protocol. ```python from auggie_sdk.acp import AuggieACPClient client = AuggieACPClient( model="claude-3-5-sonnet-latest", # CLI arg workspace_root="/path/to/workspace", # CLI arg listener=MyEventListener() # ACP feature ) client.start() # ACP: initialize + newSession response = client.send_message("...") # ACP: prompt → returns str client.clear_context() # ACP: clear client.stop() # Cleanup ``` -------------------------------- ### Local Testing Setup and Execution Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/github-action-indexer/README.md Set environment variables to configure the AugmentCode indexer for local testing and then run the indexing and search commands using npm. ```bash # Set up environment export AUGMENT_API_TOKEN="your-token" export AUGMENT_API_URL="https://your-tenant.api.augmentcode.com/" export GITHUB_TOKEN="your-github-token" export GITHUB_REPOSITORY="owner/repo" export GITHUB_SHA="$(git rev-parse HEAD)" # Run indexing npm run index # Test search npm run search "your search query" ``` -------------------------------- ### Execute Augment Commands Source: https://github.com/augmentcode/auggie/blob/main/examples/commands/README.md Demonstrates how to execute installed Augment commands using the `auggie` CLI tool, specifying the command and the target file or directory. ```bash auggie "/code-review src/main.py" auggie "/documentation src/utils.py" auggie "/tests src/api/" ``` -------------------------------- ### Agent Thinking Process Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/AGENT_EVENT_LISTENER.md Shows how to capture the agent's internal reasoning before it takes action. Useful for understanding decision-making and debugging. ```text on_agent_thought("I need to first read the README.md file using the view tool") on_agent_thought("Then I'll analyze the content and create a summary") ``` -------------------------------- ### Error Handling Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/CLAUDE_CODE_CLIENT.md Implement try-except blocks to catch and handle potential errors during client operation. ```python from auggie_sdk.acp import ClaudeCodeACPClient try: client = ClaudeCodeACPClient() client.start() response = client.send_message("Hello!") client.stop() except ValueError as e: print(f"Configuration error: {e}") except RuntimeError as e: print(f"Runtime error: {e}") except TimeoutError as e: print(f"Timeout: {e}") ``` -------------------------------- ### Error Handling Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/README.md Illustrates how to handle potential errors during agent execution using try-except blocks for specific Auggie SDK exceptions. ```python from auggie_sdk.exceptions import AugmentCLIError, AugmentParseError try: result = agent("Complex task", int) except AugmentParseError: print("Could not parse result") except AugmentCLIError: print("Agent execution failed") ``` -------------------------------- ### Iteration with Structured Data Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/README.md Shows how to iterate over structured data returned by the agent, processing items based on their properties. ```python @dataclass class FileInfo: path: str size: int files = agent("Analyze files", list[FileInfo]) for file in files: if file.size > 1000: agent(f"Optimize {file.path}") ``` -------------------------------- ### Run File Search Server Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/README.md Starts the File Search Server, a REST API for semantic file search with AI summarization. Requires Auggie CLI. ```bash npm run file-search-server [workspace-directory] ``` -------------------------------- ### Agent Library Simple One-off Request Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/SESSION_CONTINUITY.md Example of using the Agent Library for a simple, one-off request. This is suitable when session continuity or real-time streaming is not required. ```python from auggie_sdk import Auggie agent = Auggie() result = agent.run("What is 2 + 2?", return_type=int) print(result) ``` -------------------------------- ### Run Prompt Enhancer Server Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/README.md Starts the Prompt Enhancer Server, an HTTP server that enhances prompts with codebase context. Requires Auggie CLI. ```bash npm run prompt-enhancer-server [workspace-directory] ``` -------------------------------- ### Generate Security Analysis Workflow Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/PROMPT_TO_CODE.md Converts a prompt for security analysis into a Python SDK program. This example demonstrates sequential stages, conditional logic, and iteration. ```python #!/usr/bin/env python3 """ Security analysis workflow for Python files. """ from auggie_sdk import Auggie from dataclasses import dataclass from typing import List @dataclass class SecurityIssue: file: str severity: str description: str line_number: int def main(): agent = Auggie(workspace_root=".", model="claude-3-5-sonnet-latest") # Stage 1: Get list of Python files files = agent("List all Python files in src/ directory", list[str]) print(f"Found {len(files)} Python files to analyze") # Stage 2: Analyze each file for security issues all_issues: List[SecurityIssue] = [] with agent.session() as session: for file in files: issues = session( f"Analyze {file} for security vulnerabilities. " f"Return a list of issues found.", list[SecurityIssue] ) all_issues.extend(issues) print(f"Found {len(all_issues)} total security issues") # Stage 3: Create report agent(f"Create a security report in security_report.md summarizing " f"the {len(all_issues)} issues found across {len(files)} files") # Stage 4: Generate fixes for critical issues critical_issues = [i for i in all_issues if i.severity == "critical"] if critical_issues: print(f"Found {len(critical_issues)} critical issues - generating fixes") with agent.session() as session: for issue in critical_issues: session( f"Create a fix for the critical security issue in {issue.file} " f"at line {issue.line_number}: {issue.description}" ) else: print("No critical issues found!") if __name__ == "__main__": main() ``` -------------------------------- ### Install Augment Indexer into Target Repository Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/github_action_indexer/README.md Use this command to copy the Augment indexer code and necessary configuration files into your target repository for production use. This includes the indexer source, workflow file, and updates to `.gitignore`. ```bash # From the auggie repo, install into your target repository cd examples/python-sdk/context python -m github_action_indexer install /path/to/your/repo ``` -------------------------------- ### Tool Call Notification Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/AGENT_EVENT_LISTENER.md Demonstrates receiving a notification when the agent initiates a tool call. This includes details like the tool's ID, title, kind, and status. ```python on_tool_call( tool_call_id="tc_001", title="view", kind="read", status="pending" ) ``` -------------------------------- ### Agent Message Chunking Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/AGENT_EVENT_LISTENER.md Illustrates how the agent streams response messages in chunks. Use this to display partial responses as they arrive, similar to live typing. ```text on_agent_message_chunk("The ") on_agent_message_chunk("answer ") on_agent_message_chunk("is ") on_agent_message_chunk("4.") ``` -------------------------------- ### Complete Agent Message Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/AGENT_EVENT_LISTENER.md Shows receiving the agent's full response message after all chunks have been processed. Use this for logging or processing the entire output. ```text on_agent_message("The answer is 4.") ``` -------------------------------- ### Run Auggie in Project Directory Source: https://github.com/augmentcode/auggie/blob/main/README.md Execute Auggie within your project directory. An optional initial prompt can be provided to guide Auggie's actions. ```sh cd /path/to/your/project auggie "optional initial prompt" ``` -------------------------------- ### Automatic Session Continuity Example Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/ARCHITECTURE.md Demonstrates how the agent automatically remembers context across multiple runs without explicit session management. This is a key benefit of the long-running session model. ```python agent.run("Create a function") agent.run("Test it") # Automatically remembers context ``` -------------------------------- ### Adding Function Calling to Generated Code Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/PROMPT_TO_CODE.md Illustrates how to add custom functions to be used by the agent within a generated SDK program, similar to the initial function calling example. ```python def run_tests(file: str) -> dict: """Run tests for a file.""" # Your implementation return {"passed": 10, "failed": 0} result = agent.run( "Run tests and analyze results", return_type=dict, functions=[run_tests] ) ``` -------------------------------- ### Prompt Example: Code Refactoring Pipeline Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/PROMPT_TO_CODE.md An example prompt for refactoring long functions in a codebase, including running tests after refactoring and logging changes. ```plaintext Find all functions in the codebase that are longer than 50 lines. For each one, analyze if it can be broken down into smaller functions. If yes, refactor it into multiple well-named functions with clear responsibilities. After each refactoring, run the existing tests to ensure nothing broke. Keep a log of all refactorings performed. ``` -------------------------------- ### Command-Line Usage Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/PROMPT_TO_CODE.md Illustrates the command-line interface for the prompt_to_code.py script, showing available arguments for help, output path, model selection, and workspace. ```bash usage: prompt_to_code.py [-h] [-o OUTPUT] [-m MODEL] [-w WORKSPACE] prompt_file Convert a complex prompt into an Augment SDK program positional arguments: prompt_file Path to the file containing the prompt to convert optional arguments: -h, --help show this help message and exit -o OUTPUT, --output OUTPUT Output file path for the generated program (default: auto-generated) -m MODEL, --model MODEL Model to use for conversion (default: claude-3-5-sonnet-latest) -w WORKSPACE, --workspace WORKSPACE Workspace root directory (default: current directory) ``` -------------------------------- ### Sequential Stages with Sessions Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/PROMPT_TO_CODE.md Demonstrates how to use `agent.session()` to manage sequential steps where each step builds upon the previous one. ```python with agent.session() as session: session("Step 1: Create the base structure") session("Step 2: Add features to what we just created") session("Step 3: Test everything we built") ``` -------------------------------- ### Clear Context Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/CLAUDE_CODE_CLIENT.md Resets the agent's conversational context, starting a new session. ```python client.clear_context() # Restarts the agent with a new session ``` -------------------------------- ### Client Usage with Context Manager Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/CLAUDE_CODE_CLIENT.md Utilize the ClaudeCodeACPClient as a context manager for automatic start and stop operations. ```python from auggie_sdk.acp import ClaudeCodeACPClient with ClaudeCodeACPClient() as client: response = client.send_message("Write a hello world function in Python") print(response) ``` -------------------------------- ### Index and Search Your Own Repository Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/github_action_indexer/README.md Adapt the indexing and search commands for your own GitHub repository. Replace placeholders with your repository details and desired search queries. ```bash # Set to any repo you have access to export GITHUB_REPOSITORY="your-username/your-repo" export GITHUB_SHA="main" # or a specific commit SHA python -m github_action_indexer index python -m github_action_indexer search "your search query" ``` -------------------------------- ### Simple Script Template with Auggie SDK Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/README.md Use this template for basic Auggie agent interactions. It shows how to initialize the agent and perform a single instruction. ```python #!/usr/bin/env python3 """ Description of what this script does. """ from auggie_sdk import Auggie def main(): # Create agent agent = Auggie(workspace_root=".", model="claude-3-5-sonnet-latest") # Your workflow here result = agent("Your instruction") print(f"Result: {result}") if __name__ == "__main__": main() ``` -------------------------------- ### Get Staged Git Changes Source: https://github.com/augmentcode/auggie/blob/main/plugin_marketplace/code-review/agents/local-analyzer.md Shows changes that have been staged in the index but not yet committed, relative to the current HEAD. ```bash git diff --staged ``` -------------------------------- ### Get Full Git Diff Against Origin/Main Source: https://github.com/augmentcode/auggie/blob/main/plugin_marketplace/code-review/agents/local-analyzer.md Retrieves the complete diff of committed changes between the current HEAD and origin/main. ```bash git diff origin/main...HEAD ``` -------------------------------- ### Agent Library Session Usage Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/SESSION_CONTINUITY.md Demonstrates how to use sessions with the Agent Library. Remember to use the session context manager to maintain state across calls. ```python with agent.session() as session: session.run("Step 1") session.run("Step 2") ``` -------------------------------- ### Get Unstaged Git Changes Source: https://github.com/augmentcode/auggie/blob/main/plugin_marketplace/code-review/agents/local-analyzer.md Displays unstaged changes in the working tree compared to the index, representing uncommitted work-in-progress. ```bash git diff ``` -------------------------------- ### Health Check API Endpoint Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/prompt_enhancer_server/README.md Send a GET request to the /health endpoint to check if the prompt enhancer server is running and responsive. ```bash curl "http://localhost:3001/health" ``` -------------------------------- ### Exclude Directories in .gitignore/.augmentignore Source: https://github.com/augmentcode/auggie/blob/main/examples/typescript-sdk/context/README.md Example content for a .gitignore or .augmentignore file to exclude large directories during indexing, preventing timeouts in FileSystem Context. ```bash # .gitignore or .augmentignore node_modules/ dist/ *.log .DS_Store ``` -------------------------------- ### Run File Search Server Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/file_search_server/README.md Execute the file search server from the context directory or directly. ```bash # From the context directory cd examples/python-sdk/context python -m file_search_server . # Or run directly python file_search_server/main.py . ``` -------------------------------- ### Prompt to Code with Custom Workspace Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/docs/PROMPT_TO_CODE.md Specify a custom workspace directory for the conversion process. ```bash python prompt_to_code.py my_prompt.txt --workspace /path/to/workspace ``` -------------------------------- ### Ignore Files in FileSystem Context Source: https://github.com/augmentcode/auggie/blob/main/examples/python-sdk/context/README.md Example of lines to add to a .gitignore or .augmentignore file to exclude directories and files from indexing in the FileSystem Context. ```bash # .gitignore or .augmentignore node_modules/ dist/ *.log .DS_Store __pycache__/ *.pyc ```