Skip to content

Latest commit

 

History

History
135 lines (90 loc) · 2.46 KB

File metadata and controls

135 lines (90 loc) · 2.46 KB

Setup Guide

Quick Start

1. Get API Keys

OpenAI API Key

  1. Go to OpenAI Platform
  2. Sign up or log in
  3. Click "Create new secret key"
  4. Copy your API key

Tavily API Key

  1. Go to Tavily
  2. Sign up for a free account
  3. Navigate to API Keys section
  4. Copy your API key

2. Configure Environment

# Copy the example environment file
cp .env.example .env

# Edit .env and add your API keys
nano .env  # or use your preferred editor

3. Install Dependencies

npm install

4. Run the Agent

npm start

Customization

Change Research Topic

Edit deep_agent.ts and modify the user message:

content: "Research about [YOUR TOPIC] and create a detailed report";

Adjust Model Settings

In deep_agent.ts:

model: new ChatOpenAI({
  modelName: "gpt-4o-mini",  // Change to gpt-4, gpt-3.5-turbo, etc.
  temperature: 0,             // 0 = deterministic, 1 = creative
}),

Configure FilesystemBackend

Customize file system operations:

backend: new FilesystemBackend({
  rootDir: ".", // Change working directory
  virtualMode: true, // Enable/disable safe mode
});

Modify System Prompt

Edit the researchInstructions variable in deep_agent.ts to change agent behavior.

Built-in Tools

FilesystemBackend provides these tools automatically:

  • ls - List files with metadata
  • read_file - Read files with line numbers
  • write_file - Create new files
  • edit_file - Edit existing files
  • glob - Find files by pattern
  • grep - Search file contents

Troubleshooting

"API key not found" error

  • Check that your .env file exists
  • Verify API keys are correct
  • Ensure no extra spaces in .env file

"Recursion limit reached" error

  • Increase recursionLimit in deep_agent.ts
  • Simplify the research task
  • Check that tools are working correctly

File creation errors

  • Ensure you have write permissions
  • Check that file paths are relative
  • Verify disk space is available

Development

Watch Mode

Run in development mode with auto-reload:

npm run dev

TypeScript Compilation

Compile TypeScript to JavaScript:

npx tsc

Next Steps

  • Customize the system prompt for your use case
  • Add new tools in the tools/ directory
  • Experiment with different OpenAI models
  • Adjust search parameters in search_tool.ts

Happy researching! 🚀