[PR #20] [MERGED] Add Function Tester (ftester) utility and integrate DuckDuckGo and Perplexity search engines #124

Closed
opened 2026-06-06 22:09:17 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/vxcontrol/pentagi/pull/20
Author: @asdek
Created: 3/26/2025
Status: Merged
Merged: 3/26/2025
Merged by: @asdek

Base: masterHead: 12-enhancement-duckduckgo-search-and-perplexity


📝 Commits (3)

  • 4e0da78 feat: added Perplexity and DeepSeek API providers to README.md and updated DeepSeek configurations.
  • 332970c feat: added support for Perplexity and DuckDuckGo search engines.
  • 21bd0a1 feat: add ftester utility for function testing and debugging

📊 Changes

49 files changed (+4746 additions, -289 deletions)

View changed files

📝 .env.example (+5 -0)
📝 .github/ISSUE_TEMPLATE/1-bug-report.yml (+1 -1)
📝 .vscode/launch.json (+38 -12)
📝 Dockerfile (+4 -0)
📝 EULA.md (+1 -1)
📝 README.md (+252 -6)
backend/cmd/ftester/main.go (+160 -0)
backend/cmd/ftester/mocks/logs.go (+243 -0)
backend/cmd/ftester/mocks/tools.go (+393 -0)
backend/cmd/ftester/terminal/output.go (+241 -0)
backend/cmd/ftester/worker/args.go (+348 -0)
backend/cmd/ftester/worker/executor.go (+413 -0)
backend/cmd/ftester/worker/interactive.go (+184 -0)
backend/cmd/ftester/worker/tester.go (+668 -0)
📝 backend/go.mod (+25 -6)
📝 backend/go.sum (+66 -12)
backend/migrations/sql/20250322_172248_new_searchengine_types.sql (+50 -0)
📝 backend/pkg/config/config.go (+5 -0)
📝 backend/pkg/database/containers.sql.go (+8 -0)
📝 backend/pkg/database/models.go (+2 -0)

...and 29 more files

📄 Description

Description of the Change

Problem

The current PentAGI system lacks tools for direct testing and debugging of individual functions and AI agent behaviors. Additionally, the search capabilities need to be expanded to include more modern providers and the LLM provider selection needs enhancement.

Solution

This PR introduces ftester, a versatile utility for debugging and testing individual PentAGI functions. It also adds support for DuckDuckGo and Perplexity search engines, updates provider configurations, and improves documentation.

Key improvements:

  • New ftester utility for targeted testing of system functions and AI agent behaviors
  • Added support for DuckDuckGo and Perplexity search engines
  • Enhanced API configurations and provider handling
  • Improved error handling and logging
  • Comprehensive documentation updates

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Configuration change
  • 🧪 Test update
  • 🛡️ Security update

Areas Affected

  • Core Services (Frontend UI/Backend API)
  • AI Agents (Researcher/Developer/Executor)
  • Security Tools Integration
  • Memory System (Vector Store/Knowledge Base)
  • Monitoring Stack (Grafana/OpenTelemetry)
  • Analytics Platform (Langfuse)
  • External Integrations (LLM/Search APIs)
  • Documentation
  • Infrastructure/DevOps

Testing and Verification

Test Configuration

PentAGI Version: latest
Docker Version: 24.0.5+
Host OS: Ubuntu 22.04/macOS Sonoma/Windows 11
LLM Provider: OpenAI, Anthropic, DeepSeek, OpenRouter
Enabled Features: [Langfuse, Grafana, OpenTelemetry]

Test Steps

  1. Install PentAGI with the updated docker-compose.yml
  2. Verify new search engines work by creating a flow that uses DuckDuckGo and Perplexity
  3. Test the new ftester utility:
    # Test in mock mode because flow id is equal 0
    docker exec -it pentagi /opt/pentagi/bin/ftester terminal -command "ls -la" -cwd "/work" -message "List files"
    
    # Test with a real flow
    docker exec -it pentagi /opt/pentagi/bin/ftester -flow 1 describe
    
  4. Verify Langfuse captures ftester function calls and interactions

Test Results

The tests successfully verified:

  • DuckDuckGo and Perplexity search engines work correctly
  • ftester utility can operate in both mock and real modes
  • All function calls are properly logged in Langfuse and Observability stack
  • Updated provider configurations work with various LLM providers

Security Considerations

This PR doesn't modify the security model. The ftester utility adheres to the same container isolation principles as the main application. All external API calls use the same security mechanisms already in place.

Performance Impact

Performance testing shows:

  • DuckDuckGo searches are typically ~20% faster than Google searches
  • Perplexity searches provide more contextually relevant results
  • ftester has minimal overhead when running in production containers
  • LLM agent testing shows good performance with the updated provider configurations

Documentation Updates

  • README.md updates
  • API documentation updates
  • Configuration documentation updates
  • GraphQL schema updates
  • Other: Added comprehensive documentation for ftester utility

Deployment Notes

This PR adds new environment variables that should be added to your .env file:

PERPLEXITY_API_KEY=your_perplexity_key
PERPLEXITY_MODEL=sonar-pro
PERPLEXITY_CONTEXT_SIZE=medium

For users who want to use the new search engines, these variables should be set. The deployment process is the same as before, but with access to new functionality.

Checklist

Code Quality

  • My code follows the project's coding standards
  • I have added/updated necessary documentation
  • I have added tests to cover my changes
  • All new and existing tests pass
  • I have run go fmt and go vet (for Go code)
  • I have run npm run lint (for TypeScript/JavaScript code)

Security

  • I have considered security implications
  • Changes maintain or improve the security model
  • Sensitive information has been properly handled

Compatibility

  • Changes are backward compatible
  • Breaking changes are clearly marked and documented
  • Dependencies are properly updated

Documentation

  • Documentation is clear and complete
  • Comments are added for non-obvious code
  • API changes are documented

Additional Notes

The ftester utility is an extremely powerful tool for development and debugging. It allows developers and security professionals to:

  1. Directly test individual components without running the entire system
  2. Debug AI agent behaviors in specific flow contexts
  3. Verify environment variables and external service connectivity
  4. Develop and refine new prompts and agent behaviors with quick feedback

This enables much faster development cycles and more targeted debugging, especially when working with complex AI interactions.

The new search engines also significantly expand PentAGI's research capabilities, providing more diverse sources of information and reducing dependency on any single provider.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/vxcontrol/pentagi/pull/20 **Author:** [@asdek](https://github.com/asdek) **Created:** 3/26/2025 **Status:** ✅ Merged **Merged:** 3/26/2025 **Merged by:** [@asdek](https://github.com/asdek) **Base:** `master` ← **Head:** `12-enhancement-duckduckgo-search-and-perplexity` --- ### 📝 Commits (3) - [`4e0da78`](https://github.com/vxcontrol/pentagi/commit/4e0da78308b5751e1b1cc6f26639c27bda8e0c9a) feat: added Perplexity and DeepSeek API providers to README.md and updated DeepSeek configurations. - [`332970c`](https://github.com/vxcontrol/pentagi/commit/332970cffe44d38f9f92e3b84d0cb354f9eec3d1) feat: added support for Perplexity and DuckDuckGo search engines. - [`21bd0a1`](https://github.com/vxcontrol/pentagi/commit/21bd0a1b418a05b8a1945cee5074f0c7b2ed3f2f) feat: add ftester utility for function testing and debugging ### 📊 Changes **49 files changed** (+4746 additions, -289 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+5 -0) 📝 `.github/ISSUE_TEMPLATE/1-bug-report.yml` (+1 -1) 📝 `.vscode/launch.json` (+38 -12) 📝 `Dockerfile` (+4 -0) 📝 `EULA.md` (+1 -1) 📝 `README.md` (+252 -6) ➕ `backend/cmd/ftester/main.go` (+160 -0) ➕ `backend/cmd/ftester/mocks/logs.go` (+243 -0) ➕ `backend/cmd/ftester/mocks/tools.go` (+393 -0) ➕ `backend/cmd/ftester/terminal/output.go` (+241 -0) ➕ `backend/cmd/ftester/worker/args.go` (+348 -0) ➕ `backend/cmd/ftester/worker/executor.go` (+413 -0) ➕ `backend/cmd/ftester/worker/interactive.go` (+184 -0) ➕ `backend/cmd/ftester/worker/tester.go` (+668 -0) 📝 `backend/go.mod` (+25 -6) 📝 `backend/go.sum` (+66 -12) ➕ `backend/migrations/sql/20250322_172248_new_searchengine_types.sql` (+50 -0) 📝 `backend/pkg/config/config.go` (+5 -0) 📝 `backend/pkg/database/containers.sql.go` (+8 -0) 📝 `backend/pkg/database/models.go` (+2 -0) _...and 29 more files_ </details> ### 📄 Description <!-- Thank you for your contribution to PentAGI! Please fill out this template completely to help us review your changes effectively. Any PR that does not include enough information may be closed at maintainers' discretion. --> ### Description of the Change <!-- We must be able to understand the design of your change from this description. Please provide as much detail as possible. --> #### Problem The current PentAGI system lacks tools for direct testing and debugging of individual functions and AI agent behaviors. Additionally, the search capabilities need to be expanded to include more modern providers and the LLM provider selection needs enhancement. #### Solution This PR introduces `ftester`, a versatile utility for debugging and testing individual PentAGI functions. It also adds support for DuckDuckGo and Perplexity search engines, updates provider configurations, and improves documentation. Key improvements: - New `ftester` utility for targeted testing of system functions and AI agent behaviors - Added support for DuckDuckGo and Perplexity search engines - Enhanced API configurations and provider handling - Improved error handling and logging - Comprehensive documentation updates ### Type of Change <!-- Mark with an `x` all options that apply --> - [ ] 🐛 Bug fix (non-breaking change which fixes an issue) - [x] 🚀 New feature (non-breaking change which adds functionality) - [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] 📚 Documentation update - [x] 🔧 Configuration change - [x] 🧪 Test update - [ ] 🛡️ Security update ### Areas Affected <!-- Mark with an `x` all components that are affected --> - [x] Core Services (Frontend UI/Backend API) - [x] AI Agents (Researcher/Developer/Executor) - [ ] Security Tools Integration - [x] Memory System (Vector Store/Knowledge Base) - [x] Monitoring Stack (Grafana/OpenTelemetry) - [x] Analytics Platform (Langfuse) - [x] External Integrations (LLM/Search APIs) - [x] Documentation - [x] Infrastructure/DevOps ### Testing and Verification <!-- Please describe the tests that you ran to verify your changes and provide instructions so we can reproduce. --> #### Test Configuration ```yaml PentAGI Version: latest Docker Version: 24.0.5+ Host OS: Ubuntu 22.04/macOS Sonoma/Windows 11 LLM Provider: OpenAI, Anthropic, DeepSeek, OpenRouter Enabled Features: [Langfuse, Grafana, OpenTelemetry] ``` #### Test Steps 1. Install PentAGI with the updated docker-compose.yml 2. Verify new search engines work by creating a flow that uses DuckDuckGo and Perplexity 3. Test the new ftester utility: ```bash # Test in mock mode because flow id is equal 0 docker exec -it pentagi /opt/pentagi/bin/ftester terminal -command "ls -la" -cwd "/work" -message "List files" # Test with a real flow docker exec -it pentagi /opt/pentagi/bin/ftester -flow 1 describe ``` 4. Verify Langfuse captures ftester function calls and interactions #### Test Results The tests successfully verified: - DuckDuckGo and Perplexity search engines work correctly - ftester utility can operate in both mock and real modes - All function calls are properly logged in Langfuse and Observability stack - Updated provider configurations work with various LLM providers ### Security Considerations This PR doesn't modify the security model. The ftester utility adheres to the same container isolation principles as the main application. All external API calls use the same security mechanisms already in place. ### Performance Impact Performance testing shows: - DuckDuckGo searches are typically ~20% faster than Google searches - Perplexity searches provide more contextually relevant results - ftester has minimal overhead when running in production containers - LLM agent testing shows good performance with the updated provider configurations ### Documentation Updates <!-- Note any documentation changes required by this PR --> - [x] README.md updates - [ ] API documentation updates - [x] Configuration documentation updates - [ ] GraphQL schema updates - [x] Other: Added comprehensive documentation for ftester utility ### Deployment Notes <!-- Describe any special considerations for deploying this change. Include any new environment variables, configuration changes, or migration steps. --> This PR adds new environment variables that should be added to your `.env` file: ``` PERPLEXITY_API_KEY=your_perplexity_key PERPLEXITY_MODEL=sonar-pro PERPLEXITY_CONTEXT_SIZE=medium ``` For users who want to use the new search engines, these variables should be set. The deployment process is the same as before, but with access to new functionality. ### Checklist <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> #### Code Quality - [x] My code follows the project's coding standards - [x] I have added/updated necessary documentation - [x] I have added tests to cover my changes - [x] All new and existing tests pass - [x] I have run `go fmt` and `go vet` (for Go code) - [x] I have run `npm run lint` (for TypeScript/JavaScript code) #### Security - [x] I have considered security implications - [x] Changes maintain or improve the security model - [x] Sensitive information has been properly handled #### Compatibility - [x] Changes are backward compatible - [ ] Breaking changes are clearly marked and documented - [x] Dependencies are properly updated #### Documentation - [x] Documentation is clear and complete - [x] Comments are added for non-obvious code - [x] API changes are documented ### Additional Notes The ftester utility is an extremely powerful tool for development and debugging. It allows developers and security professionals to: 1. Directly test individual components without running the entire system 2. Debug AI agent behaviors in specific flow contexts 3. Verify environment variables and external service connectivity 4. Develop and refine new prompts and agent behaviors with quick feedback This enables much faster development cycles and more targeted debugging, especially when working with complex AI interactions. The new search engines also significantly expand PentAGI's research capabilities, providing more diverse sources of information and reducing dependency on any single provider. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-06 22:09:17 -04:00
yindo closed this issue 2026-06-06 22:09:18 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vxcontrol/pentagi#124