mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-20 23:57:11 -04:00
[PR #75] [CLOSED] feat: added graphiti integration #143
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vxcontrol/pentagi/pull/75
Author: @zavgorodnii
Created: 10/30/2025
Status: ❌ Closed
Base:
master← Head:feat/grafiti📝 Commits (2)
b2ab874feat: added graphiti integrationdd9cf49Merge branch 'master' into feat/grafiti📊 Changes
14 files changed (+502 additions, -153 deletions)
View changed files
📝
.env.example(+11 -0)📝
backend/go.mod(+1 -0)📝
backend/go.sum(+2 -0)📝
backend/pkg/config/config.go(+5 -0)➕
backend/pkg/graphiti/client.go(+62 -0)📝
backend/pkg/providers/performer.go(+160 -0)📝
backend/pkg/providers/provider.go(+3 -1)📝
backend/pkg/providers/providers.go(+78 -60)➕
backend/pkg/templates/graphiti/agent_response.tmpl(+4 -0)➕
backend/pkg/templates/graphiti/tool_execution.tmpl(+9 -0)📝
backend/pkg/templates/templates.go(+12 -0)📝
docker-compose.yml(+70 -0)📝
frontend/package-lock.json(+84 -91)📝
frontend/package.json(+1 -1)📄 Description
Description of the Change
Problem
PentAGI currently relies on vector-based semantic search (pgvector) for memory and knowledge storage. While effective for similarity matching, this approach lacks the ability to capture and query explicit relationships between entities such as tools, targets, vulnerabilities, and techniques. As a result, the system cannot answer complex questions like "What tools have been successful against Apache servers?" or "Show me the sequence of actions that led to privilege escalation."
Solution
This PR integrates Graphiti, a temporal knowledge graph system powered by Neo4j, to provide advanced semantic understanding and relationship tracking for AI agent operations. The integration uses a custom vxcontrol fork (pentagi-graphiti) that includes specialized entity and edge types for pentesting purposes.
Key Implementation Details:
Client Wrapper (
pkg/graphiti/client.go): Provides a simplified, non-blocking interface to the Graphiti API with health checks, timeout protection, and graceful degradation when disabled or unavailable.Provider Integration (
pkg/providers/performer.go): Automatically captures two types of events:Templates (
pkg/templates/graphiti/): Two templates format captured data:agent_response.tmpl: Structures agent outputs with contexttool_execution.tmpl: Captures tool details including barrier function classificationInfrastructure (
docker-compose.yml): Adds Neo4j (graph database) and Graphiti (API layer) services with proper health checks and dependencies.Configuration: Three new environment variables control the feature:
GRAPHITI_ENABLED(default: false) - Feature flagGRAPHITI_URL- Graphiti API endpointGRAPHITI_TIMEOUT- Operation timeout in secondsThe integration is designed to be completely optional and non-intrusive. When disabled or when operations fail, the system logs warnings but continues normal operation without interruption.
Closes #
Type of Change
Areas Affected
Testing and Verification
Test Configuration
Test Steps
GRAPHITI_ENABLED=truein.envfiledocker build -t graphiti-pentagi:latestdocker compose up -ddocker compose logs graphitihttp://localhost:7474and verify graph dataGRAPHITI_ENABLED=falseto verify graceful degradationTest Results
Security Considerations
New Security Requirements:
Recommendations:
NEO4J_PASSWORDin production deploymentsNo Changes To:
Performance Impact
Resource Usage:
Latency:
Documentation Updates
README.md updates
API documentation updates
Configuration documentation updates
backend/docs/config.mdGraphQL schema updates
[] Other
Deployment Notes
New Environment Variables Required:
Pre-Deployment Steps:
Build the pentagi-graphiti Docker image:
Add environment variables to
.envfileStart services:
docker compose up -dOptional Configuration:
GRAPHITI_ENABLED=false)Rollback:
GRAPHITI_ENABLED=falseto disableChecklist
Code Quality
go fmtandgo vet(for Go code)npm run lint(for TypeScript/JavaScript code)Security
Compatibility
Documentation
Additional Notes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.