PTENES
MODULE 1.2

🔑 Prerequisites & Installation

Now let’s get the tool running on your machine. This module is practical and step-by-step: what to install first, how to get the two free API keys, two ways to install (automatic and manual), where to paste the keys, and how to confirm everything worked—without spending anything.

7
Topics
40
Minutes
⬆
Beginner
🛠️
Practice
⬇️ Downloadthe project 📦 venvisolated environment ⚙️ pip installdependencies 📝 .envpaste the 2 keys ✅ Ready to run

Illustrative diagram — installation is a short staircase of steps: download, create the environment, install, configure the keys, and you’re ready.

Detailed content

1

🧰 What you need

Before running any command, gather three things. Having them ready before you begin prevents the most common beginner mistake: getting stuck halfway through installation because something basic was missing.

🐍
Python 3.9+

The language the tool runs on. Download it at python.org/downloads.

🔐
2 API keys

One from Perplexity and one from Gemini. You’ll get both in the next topics.

⌨️
A terminal

Command Prompt on Windows; Terminal on Mac/Linux. This is where you type commands.

⚠️ The Windows gotcha

When installing Python on Windows, there’s a checkbox that’s easy to overlook—and it causes half the problems beginners run into:

  • ✗Forgetting to check "Add Python to PATH" on the installer's first screen
  • ✗Result: the terminal doesn't "see" Python and returns a "command not found" error
  • ✗Fix: reinstall Python and check the box this time

💡 Tip — check the Python version

In the terminal, type python --version (or python3 --version). If you see 3.9 or higher, you’re ready. If you get an error, it means you still need to install it—or add it to PATH.

2

🔎 Perplexity Key

The first of the two keys comes from Perplexity — the AI that does the research (Phase 1). Without it, no documents are generated. The process takes about 2 minutes.

1

Access the API dashboard

Open perplexity.ai/settings/api in the browser.

2

Create an account (if you don't already have one)

It's free to get started. Just log in as usual.

3

Click "Generate API Key"

The key appears on the screen. It starts with pplx-. Copy it and save it.

🔑 What the key looks like

# formato (exemplo — a sua será diferente)
pplx-1a2b3c4d5e6f7g8h9i0j...

Treat this key like a password: anyone who has it can use your credit.

🛡️ Tip — required for Research

This is the key to the Phase 1 (Research). If it’s missing or incorrect, the tool won’t even start writing the documents—it stops right away with a key error.

3

✨ Gemini key

The second key comes from Google Gemini — the AI that writes the documents (Phase 2). It’s free to get started and you can get it from Google AI Studio in just a few clicks.

1

Go to Google AI Studio

Open aistudio.google.com/apikey.

2

Sign in with your Google account

Works with the same Google account you already use every day.

3

Click "Create API Key"

The key starts with AIzaSy. Copy it and save it with the other one.

✓ Now you have

  • ✓The Perplexity key (pplx-...)
  • ✓The Gemini key (AIzaSy...)
  • ✓Both stored in a safe place

✗ Avoid these mistakes

  • ✗Put the keys in the right places (each one goes in its own field)
  • ✗Copy with a space at the beginning or end
  • ✗Posting the key in a chat, screenshot, or public repository

💡 Tip — two accounts, two sites

The keys come from different websites (Perplexity and Google), and each has its own credits. Both offer a free plan so you can try them before spending any money.

4

🚀 Automatic installation

With the project downloaded, there’s a shortcut that does almost everything for you: a single command. It’s the recommended path if you don’t want to handle each step manually.

⌨️ The magic command

# na pasta do projeto
python setup.py

This command launches an assistant that sets up the entire environment all at once.

✓ What setup.py does for you

  • ✓Creates the virtual environment (an isolated "box" just for this project)
  • ✓Install all the dependencies that the tool needs
  • ✓Generates the .env file blank, ready for you to paste the keys

💡 Tip — if automatic mode fails

On some computers, the shortcut may fail (different Python version, permissions, etc.). That’s okay: the next topic shows the manual installation, which performs exactly the same steps, just one at a time.

5

🛠️ Manual installation

If you prefer to control each step — or if the automatic process failed — you can install it manually. They are four commands simple. Plus, you’ll understand what happens behind the scenes.

⌨️ Step-by-step in the terminal

# 1) Criar o ambiente virtual (a "caixa" isolada do projeto)
python3 -m venv venv

# 2) Ativar o ambiente
source venv/bin/activate        # Mac / Linux
.\venv\Scripts\activate         # Windows

# 3) Instalar as dependências
pip install -r requirements.txt

# 4) Criar o arquivo de chaves a partir do exemplo
cp .env.example .env

Run them in order. Step 2 varies depending on your system—use only the line that matches yours.

✓ What is a "venv"

  • ✓An isolated environment just for this project
  • ✓Prevents conflicts with other Python programs
  • ✓Keeps everything organized and easy to delete later

✗ The #1 beginner mistake

  • ✗Forgetting to activate the venv before using the tool
  • ✗Symptom: "module not found" error
  • ✗Fix: run the activation command from step 2 again

💡 Tip — always activate the venv first

Every time you open a new terminal to use the tool, run the activation command first. When the venv is active, you’ll usually see (venv) at the beginning of the line — that's the sign everything is working correctly.

6

📝 Configure the .env

The file .env is where your keys “go” in the program. Open it in a text editor and fill in both fields. This is the step that connects the tool to the AIs.

📄 What the .env should look like

# cole cada chave depois do = (sem aspas, sem espaços)
PERPLEXITY_API_KEY=pplx-1a2b3c4d5e6f7g8h9i0j...
GEMINI_API_KEY=AIzaSy1a2b3c4d5e6f7g8h9i0j...

Replace the examples with your actual keys. Save the file after editing.

✓ Do this

  • ✓Paste the key right after the =, no spaces
  • ✓One key per line, with exactly these names
  • ✓Save the file before running the tool

✗ Never do this

  • ✗Putting extra quotation marks or spaces around the key
  • ✗Rename or delete the field names
  • ✗Share or upload the .env to GitHub

🔒 Tip — .env is private

This file stores your keys in plain text. Never send it by email, chat, or public repository—anyone who has it can spend your credits. It should stay only on your machine.

7

✅ Confirm that it worked

Before spending a cent, it’s worth doing a simulation test. It confirms that the installation and keys are correct — without making any paid AI calls.

⌨️ The no-cost test (dry run)

# com o venv ativado
python -m strategy_factory.main run "Stripe" --dry-run

The flag --dry-run simulates the run: nothing is charged, and no real AI is called.

✓

Did it run without a key error?

Then everything is in order: Python, the environment, and .env configured. You’re ready for Module 1.3.

✗

Got a key error?

Go back to Topic 6: there's probably an extra space, a field name that was changed, or the file wasn't saved.

🎯 In short

If the dry run passed, the tool is installed and configured. In the next module, you’ll run it for real — through the web interface, without any commands — and generate your first report.

🔑 Module Summary

✓
Prerequisites — Python 3.9+, both keys, and a terminal; on Windows, check “Add Python to PATH”.
✓
Perplexity key — at perplexity.ai/settings/api; starts with pplx-; required for Research.
✓
Gemini key — at aistudio.google.com/apikey; starts with AIzaSy; required for Synthesis.
✓
Installation — automatic with python setup.py, or manual with venv + pip + cp .env.example .env.
✓
Configure the .env — paste both keys into the fields, with no spaces; never share the file.
✓
Confirm — run the dry-run for Stripe; if there’s no key error, you’re ready without spending anything.

Next Module:

1.3 — Your first report (web mode) — launch the web interface and generate your first strategy package with point-and-click, without commands.