https://github.com/7etsuo/tetsuo-dox-agent
A powerful research assistant that leverages Large Language Models to provide technically-focused, well-researched answers with robust citations. Built on a graph-based architecture, the agent drafts answers, performs critical self-reflection, conducts research, and iteratively improves responses based on discovered information.
https://github.com/7etsuo/tetsuo-dox-agent
Last synced: 3 months ago
JSON representation
A powerful research assistant that leverages Large Language Models to provide technically-focused, well-researched answers with robust citations. Built on a graph-based architecture, the agent drafts answers, performs critical self-reflection, conducts research, and iteratively improves responses based on discovered information.
- Host: GitHub
- URL: https://github.com/7etsuo/tetsuo-dox-agent
- Owner: 7etsuo
- Created: 2024-12-28T06:01:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-28T13:19:14.000Z (over 1 year ago)
- Last Synced: 2025-04-12T03:43:30.824Z (about 1 year ago)
- Language: Python
- Size: 85.9 KB
- Stars: 28
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tetsuo Dox Agent

[](https://discord.gg/tetsuo-ai)
[](https://www.tetsuo.ai)
**$TETSUO Token on Solana**
`Contract Address: 8i51XNNpGaKaj4G4nDdmQh95v4FKAxw8mhtaRoKd9tE8`
## Overview
Tetsuo Dox Agent is a research agent, designed for technically-focused responses with citations. Built on a graph-based architecture.

The agent:
- Drafts detailed, technically accurate answers
- Performs systematic self-reflection and validation
- Conducts thorough research across multiple sources
- Iteratively refines responses based on discovered information
- Maintains strict citation standards for factual claims
## Key Features
- **Technical Focus**: Delivers purely factual, technical information without ethical commentary
- **Iterative Refinement**: Automatically improves answers through multiple rounds of:
- Self-reflection and critique
- Web-based research
- Content revision
- Citation verification
- **Research Integration**: Leverages Tavily Search API for real-time fact-checking and research
- **Structured Output**:
- Primary response (250-word default limit)
- Numbered citations [1], [2], etc.
- Complete reference list with URLs and publication dates
- Research queries and self-reflections (in verbose mode)
- **Quality Controls**:
- Automatic fact verification
- Citation management
- Self-critique for information gaps
- Technical accuracy verification
## Prerequisites
- Python 3.13
- Poetry for dependency management
- OpenAI API key (GPT-4 access required)
- Tavily API key
## Installation
1. Clone the repository:
```bash
git clone https://github.com/7etsuo/tetsuo-dox-agent.git
cd dox-agent
```
2. Install dependencies with Poetry:
```bash
# Initialize Poetry environment with Python 3.13
poetry env use python3.13
# Install dependencies
poetry install
```
3. Set up environment variables by creating a `.env` file:
```env
# Required Configuration
OPENAI_API_KEY=your_openai_key_here # Required: OpenAI API key with GPT-4 access
TAVILY_API_KEY=your_tavily_key_here # Required: Tavily API key for research
# Optional Configuration
MAX_ITERATIONS=3 # Optional: Number of research-revise cycles (default: 3)
MODEL_NAME=gpt-4-turbo-preview # Optional: OpenAI model choice
MAX_RESULTS=5 # Optional: Maximum search results per query
# Optional LangSmith Integration
LANGCHAIN_API_KEY=your_langsmith_key # Optional: For LangSmith tracing
LANGCHAIN_TRACING_V2=true # Optional: Enable LangSmith tracing
LANGCHAIN_PROJECT=your_project_name # Optional: LangSmith project name
```
### Docker installation
1. Build the Docker image:
```bash
docker-compose build
```
2. Set up environment variables in `.env` file (same as standard installation)
3. Run the agent using Docker:
```bash
docker-compose run --rm dox-agent "Your question here"
```
## Usage

### Basic Command
Basic usage with default settings:
```bash
poetry run dox-agent "Your technical question here"
```
### Advanced Options
Customize the agent's behavior:
```bash
# Enable verbose output (includes reflections and research queries)
poetry run dox-agent --verbose "Your question"
# Customize iterations and model
poetry run dox-agent --max-iterations 4 --model gpt-4 "Your question"
# Save full response to JSON file
poetry run dox-agent --save-output results.json "Your question"
```
### Command Line Options
- `-m, --max-iterations`: Maximum research-revise cycles
- `-l, --model`: OpenAI model selection (default: gpt-4-turbo-preview)
- `-r, --max-results`: Maximum search results per query
- `-w, --word-limit`: Word limit for answers (default: 250)
- `-v, --verbose`: Enable detailed output including reflections
- `-s, --save-output`: Save complete response to JSON file
- `--help`: Display help message
### Output Format
Standard output includes:
- Technical response (within word limit)
- Numbered citations [1]
- Reference list with:
- Author (when available)
- Title
- Publication/Website
- URL
- Publication Date
Verbose output (-v) adds:
- Self-reflection on response quality
- Identified knowledge gaps
- Research queries
- Search results summary
## Project Structure
```
dox_agent/
├── __init__.py
├── __main__.py
├── chains.py # Chain definitions
├── cli.py # Command line interface
├── config/ # Configuration and settings
│ ├── __init__.py
│ ├── constants.py
│ └── settings.py
├── exceptions.py # Custom exceptions
├── graph/ # Graph-based architecture
│ ├── __init__.py
│ ├── builder.py
│ └── nodes.py
├── models/ # Pydantic models
│ ├── __init__.py
│ ├── answer.py
│ └── reflection.py
├── prompts.py # Prompt templates
├── tools/ # Search tools
│ ├── __init__.py
│ └── search.py
└── types.py # Type definitions
```
## Architecture Overview
The system operates through a graph-based architecture with three primary stages:
1. **Initial Draft**
- Analyzes the question
- Generates initial technical response
- Performs self-critique
2. **Research Phase**
- Generates targeted search queries
- Executes web searches
- Collects and processes results
3. **Revision Phase**
- Incorporates new information
- Updates citations
- Refines technical accuracy
- Maintains word limit
This process iterates according to the max_iterations setting or until optimal quality is achieved.
## Development
### Setting Up Development Environment
1. Clone and install as described above
2. Install development dependencies:
```bash
poetry install --with dev
```
### Adding New Features
1. **New Models**
- Add Pydantic models in `models/`
- Update type hints accordingly
2. **New Tools**
- Implement tool classes in `tools/`
- Register in tools registry if applicable
3. **New Graph Nodes**
- Add nodes in `graph/nodes.py`
- Update graph builder in `graph/builder.py`
### Code Style
- Follow PEP 8 guidelines
- Use type hints
- Include docstrings for public interfaces
- Keep functions focused and modular
### Testing
```bash
# Run test suite (TODO: Add comprehensive tests)
poetry run pytest
# Run with coverage
poetry run pytest --cov=dox_agent
```
## Contributing
1. Fork the repository
2. Create your feature branch:
```bash
git checkout -b feature/your-feature-name
```
3. Commit your changes:
```bash
git commit -m 'Add some feature'
```
4. Push to the branch:
```bash
git push origin feature/your-feature-name
```
5. Open a Pull Request
### Pull Request Guidelines
- Include test cases for new features
- Update documentation as needed
- Follow existing code style
- One feature/fix per PR
## Acknowledgments
- Built with [LangChain](https://github.com/langchain-ai/langchain)
- Uses [LangGraph](https://github.com/langchain-ai/langgraph) for workflow management
- Search powered by [Tavily](https://tavily.com/)
- Developed with [OpenAI](https://openai.com/) GPT-4 technology
## Support
- Open an issue for bugs or feature requests
- Check existing issues before creating new ones