Skip to main content

Simple coding agent.

Project description

CI Release PyPI Status Badge

Source Agent

A simple coding agent.

How it Works

Source Agent operates as a stateless entity, guided by clear directives and external context. Its behavior is primarily defined by AGENTS.md, which serves as the core system prompt. CHANGELOG.md provides essential historical context and sense-making rationale.


Prerequisites

  • Python 3.10 or higher
  • An API key from one of the supported AI providers (see Supported Providers)
  • Git (for .gitignore support)

Installation

Quick Start

# Clone the repository
git clone https://github.com/christopherwoodall/source-agent
cd source-agent

# Create virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install in development mode
pip install -e ".[developer]"

# Verify the installation
source-agent --help

Basic Usage

# Analyze the current codebase
source-agent --prompt "Analyze this codebase and identify potential improvements"

# Analyze with specific focus
source-agent --prompt "Review the authentication system for security issues"

Advanced Usage

# Use OpenAI with GPT-4
source-agent \
  --provider openai \
  --model gpt-4o \
  --temperature 0.1 \
  --prompt "Create unit tests for the utils.py file"

# Use Claude for code review
source-agent \
  --provider anthropic \
  --model claude-3-5-sonnet \
  --prompt "Review the error handling in this codebase"

Supported Providers

Source Agent supports multiple AI providers. Set the corresponding environment variable:

Provider Environment Variable
OpenRouter OPENROUTER_API_KEY
OpenAI OPENAI_API_KEY
Anthropic ANTHROPIC_API_KEY
Google GEMINI_API_KEY
Mistral MISTRAL_API_KEY
DeepSeek DEEPSEEK_API_KEY
Cerebras CEREBRAS_API_KEY
Groq GROQ_API_KEY
Vercel VERCEL_API_KEY
xAI XAI_API_KEY

Available Tools

Source Agent provides these built-in tools for code analysis:

  • ls - List files and directories (respects .gitignore)
  • cat - Read file contents with security checks
  • find - Find files by pattern (glob) in directory tree
  • grep - Search for text/regex in files
  • mkdir - Create directories
  • write - Write content to files

These tools are automatically available to the AI agent during analysis.


Core Architecture

  • Entry Point: src/source_agent/entrypoint.py - CLI interface with argument parsing
  • Agent Engine: src/source_agent/agents/code.py - OpenAI-compatible client with tool integration
  • System Prompt: AGENTS.md - Defines agent behavior, roles, and constraints

Project Structure

source-agent/
├── src/source_agent/
│   ├── entrypoint.py      # CLI interface
│   ├── agents/
│   │   └── code.py        # Main agent logic
│   └── tools/             # File system tools
├── AGENTS.md              # System prompt & behavior rules
└── CHANGELOG.md           # Development history

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

source_agent-0.0.9-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file source_agent-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: source_agent-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for source_agent-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 996a67ded4ee9be7c004de07b11f976dff9b25394149f89cfee40f7de489ea9f
MD5 f1b4f670de21a732ded0344c78f59b8a
BLAKE2b-256 6db77b3dbaa78bd29ddb631d2760d95c3c7de62cc1d9513ebcc91214eb7b3b15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page