Installation ‐ ReAct Agent Patterm - fctr-id/okta-ai-agent GitHub Wiki
Complete setup instructions for testing the new ReAct (Reasoning + Acting) agent
Version: 1.1-beta
Branch: feature/one-react-agent
ℹ️ Note: This guide is for the experimental ReAct agent - a single AI agent that thinks and acts like an engineer, reading docs, writing code, testing, and debugging iteratively. This is different from Tako's multi-agent orchestration system.
The ReAct (Reasoning + Acting) agent is a single AI agent that operates differently from Tako's traditional multi-agent system:
- 🤔 Reasons about your query and plans an approach
- 📚 Reads Okta API documentation to understand endpoints
- 💻 Writes Python code to answer your question
- 🧪 Tests the code with sample data (LIMIT 3)
- 🐛 Debugs failures by analyzing errors and retrying
- ✅ Iterates until the code works correctly
- 📝 Generates production-ready script with full data
- Acts like a person: Thinks through problems step-by-step, debugs itself
- Works with smaller models: gemini-2.0-flash, claude-3.5-haiku, gpt-4o-mini
- Self-correcting: Sees errors, understands them, and fixes the code
- Production-ready output: Generates CSV files you can share
- Use ReAct for: Complex queries requiring API exploration, certificate analysis, or custom reporting
- Use Multi-Agent for: Standard queries, web UI experience, hybrid SQL + API mode
Before you begin installation, ensure you have the following:
- 🐍 Python 3.9+ - ReAct agent requires Python 3.9 or newer
- 🏢 Okta tenant with read-only admin access - You'll need API token with read permissions
- 🤖 Access to an AI provider - You'll need at least one of the following:
- Google Gemini (Vertex AI) - Recommended: Fast & Cheap
- Anthropic Claude
- OpenAI
- Azure OpenAI
⚠️ Note: The ReAct agent uses significantly more tokens (~200k-400k per query) compared to the standard multi-agent system. We recommend using cheaper models like gemini-2.0-flash-exp or claude-3.5-haiku.
git clone -b feature/one-react-agent https://github.com/fctr-id/okta-ai-agent
cd okta-ai-agent# Create virtual environment
python -m venv venv
# Activate virtual environment
.\venv\Scripts\Activate.ps1
# If you get an execution policy error, run this first:
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Install requirements
pip install -r requirements.txt# Copy the sample environment file
Copy-Item .env.sample .envEdit the .env file with your settings:
Required Configuration:
# 🔐 Okta Configuration
OKTA_CLIENT_ORGURL=https://your-okta-domain.okta.com
OKTA_API_TOKEN=your_okta_api_token_here
# 🧠 AI Provider (choose ONE)
AI_PROVIDER=vertex_ai # or anthropic, openai, azure
# 🌐 Vertex AI Configuration (Recommended - Fast & Cheap)
VERTEX_AI_SERVICE_ACCOUNT_FILE=C:\path\to\your\service-account.json
VERTEX_AI_REASONING_MODEL=gemini-2.0-flash-exp
VERTEX_AI_CODING_MODEL=gemini-2.0-flash-expAlternative AI Providers:
Anthropic Claude (Fast & Affordable):
AI_PROVIDER=anthropic
ANTHROPIC_API_KEY=your_anthropic_api_key_here
ANTHROPIC_REASONING_MODEL=claude-3-5-haiku-20241022
ANTHROPIC_CODING_MODEL=claude-3-5-haiku-20241022OpenAI (Slower but works):
AI_PROVIDER=openai
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_REASONING_MODEL=gpt-4o-mini
OPENAI_CODING_MODEL=gpt-4o-miniOptional Circuit Breaker Configuration:
# Prevents infinite loops (defaults are fine for testing)
REACT_AGENT_MAX_SQL_EXECUTIONS=5
REACT_AGENT_MAX_API_EXECUTIONS=20
REACT_AGENT_MAX_SCHEMA_LOADS=3
REACT_AGENT_MAX_ENDPOINT_FILTERS=10git clone -b feature/one-react-agent https://github.com/fctr-id/okta-ai-agent
cd okta-ai-agent# Create virtual environment
python3 -m venv venv
# Activate virtual environment
source venv/bin/activate
# Install requirements
pip install -r requirements.txt# Copy the sample environment file
cp .env.sample .envEdit the .env file with the same configuration as Windows (see above), but use Unix-style paths:
VERTEX_AI_SERVICE_ACCOUNT_FILE=/path/to/your/service-account.jsonThe ReAct agent runs as a command-line tool that generates Python scripts based on your queries.
Windows:
python scripts\okta_react_agent_test.py "Your query here"Linux/macOS:
python scripts/okta_react_agent_test.py "Your query here"# Simple user query
python scripts\okta_react_agent_test.py "List all active users"
# Application and certificate analysis
python scripts\okta_react_agent_test.py "Find all SAML applications and their certificate expiry dates"
# Multi-entity query
python scripts\okta_react_agent_test.py "List users who logged in during the last 10 days and fetch all their assigned applications and group memberships"
# Certificate compliance
python scripts\okta_react_agent_test.py "Find all apps with active certificates, get the certificate expiry dates, and identify which ones expire in the next 90 days"The ReAct agent will show its reasoning process:
🤔 Reasoning about query...
📚 Reading Okta API documentation...
💻 Writing test code...
🧪 Testing with sample data (LIMIT 3)...
✅ Test passed! Generating production code...
You'll see output like:
💾 Generated code saved to: c:\...\okta-ai-agent\src\core\data\okta_query_20251021_143022.py
▶️ To execute the script, run:
python c:\...\okta-ai-agent\src\core\data\okta_query_20251021_143022.py
📝 TEST SUMMARY
================================================================================
Query: Find all SAML applications and their certificate expiry dates
Status: ✅ SUCCESS
Time taken: 142.3s
Token usage: 236,124 input / 2,850 output / 238,974 total
Run the generated script to get your actual results:
Windows:
python src\core\data\okta_query_20251021_143022.pyLinux/macOS:
python src/core/data/okta_query_20251021_143022.pyThis will create a CSV file:
Results saved to: c:\...\okta-ai-agent\src\core\data\results_20251021_143025.csv
Total records: 47
Open the CSV file in Excel, Google Sheets, or any text editor:
Windows:
# Open in default CSV viewer
Invoke-Item src\core\data\results_20251021_143025.csv
# Or view in Excel
Start-Process excel.exe src\core\data\results_20251021_143025.csv
# Or view in Notepad
notepad src\core\data\results_20251021_143025.csvLinux/macOS:
# View with default CSV viewer
open src/core/data/results_20251021_143025.csv # macOS
xdg-open src/core/data/results_20251021_143025.csv # Linux
# Or view in terminal
cat src/core/data/results_20251021_143025.csv- Simple queries (1-2 API calls): 30-60 seconds
- Medium queries (3-5 API calls): 1-2 minutes
- Complex queries (6-10 API calls): 2-5 minutes
- Very complex queries (10+ API calls): 5-8 minutes
- Simple queries: 100k-200k tokens (~$0.05-0.20)
- Medium queries: 200k-300k tokens (~$0.20-0.40)
- Complex queries: 300k-500k tokens (~$0.40-1.00)
Costs assume gemini-2.0-flash-exp ($0.075/$0.30 per 1M tokens). OpenAI costs 10-20x higher.
-
Generated Python script:
src/core/data/okta_query_TIMESTAMP.py -
CSV results:
src/core/data/results_TIMESTAMP.csv - Both files include timestamps for easy tracking
Found a bug? Open an issue: https://github.com/fctr-id/okta-ai-agent/issues
Need help? Reach out to [email protected] or Slack me in the JAMF/Okta community
Want to contribute? PRs welcome on the feature/one-react-agent branch!
Have a query that failed? Share the query and error logs - it helps improve the agent!
🎉 You're All Set! The ReAct agent is now ready to explore your Okta environment with its reasoning and self-debugging capabilities. Start with simple queries and gradually explore more complex scenarios as you see how the agent thinks through problems.
🌟 © 2025 Fctr. All rights reserved. Made with ❤️ for the Okta community.
Not affiliated with Okta, Inc.