Graphiti provides temporal knowledge graph capabilities for PentAGI, automatically extracting and storing structured knowledge from agent interactions. Built on Neo4j, it enables semantic memory, relationship tracking, and contextual understanding of penetration testing operations.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/vxcontrol/pentagi/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Graphiti is a specialized knowledge graph system that enhances PentAGI’s AI agents with:- Semantic Memory: Store relationships between tools, targets, vulnerabilities, and techniques
- Contextual Understanding: Track how different pentesting actions relate over time
- Knowledge Reuse: Learn from past penetration tests and apply insights to new assessments
- Advanced Querying: Search for complex patterns like “What tools were effective against similar targets?”
- Temporal Context: Maintain time-based relationships between entities and events
Architecture
The Graphiti stack consists of:- Graphiti Service: REST API for knowledge graph operations (port 8000)
- Neo4j Database: Graph database for storing entities and relationships (ports 7474, 7687)
- Custom Entity Types: Pentesting-specific nodes and edges
- Automatic Capture: Integration with PentAGI agent pipeline
Setup
Configure Environment Variables
Edit your
.env file with Graphiti settings:.env
Graphiti uses an LLM for entity extraction. Currently requires OpenAI API access via
OPEN_AI_KEY.Configuration
Environment Variables
Key configuration options for Graphiti:| Variable | Description | Default |
|---|---|---|
GRAPHITI_ENABLED | Enable knowledge graph | true |
GRAPHITI_TIMEOUT | API request timeout (seconds) | 30 |
GRAPHITI_URL | Graphiti service endpoint | http://graphiti:8000 |
GRAPHITI_MODEL_NAME | LLM for entity extraction | gpt-5-mini |
NEO4J_URI | Neo4j connection string | bolt://neo4j:7687 |
NEO4J_USER | Neo4j username | neo4j |
NEO4J_PASSWORD | Neo4j password | devpassword |
NEO4J_DATABASE | Neo4j database name | neo4j |
Resource Limits
The Neo4j container is configured with:docker-compose-graphiti.yml
shm_sizefor better query performance- Heap size via Neo4j environment variables
- Volume size for data storage
What Gets Stored
When enabled, Graphiti automatically captures:Agent Responses
All agent reasoning, analysis, and decisions:- Primary agent conclusions
- Specialist agent recommendations
- Decision-making rationale
- Strategic insights
Tool Executions
Commands executed and their outcomes:- Tools used (nmap, sqlmap, metasploit, etc.)
- Command parameters and options
- Execution results and outputs
- Success/failure status
Context Information
Hierarchical task context:- Flow identifiers and objectives
- Task and subtask relationships
- Agent assignments and roles
- Temporal sequences
Extracted Entities
Pentesting-specific entities:- Targets: Hosts, IPs, domains, services
- Vulnerabilities: CVEs, exploits, weaknesses
- Tools: Security utilities and frameworks
- Techniques: Attack methods and procedures
- Findings: Discovered information and artifacts
Relationships
Semantic connections between entities:- Target → Has Service
- Vulnerability → Affects Target
- Tool → Discovers Vulnerability
- Technique → Exploits Vulnerability
- Agent → Uses Tool
Usage
Automatic Knowledge Capture
Graphiti integrates seamlessly with PentAGI’s agent pipeline. No manual intervention required:- Agent executes a tool (e.g.,
nmap -sV target.com) - Results are captured by the framework
- Graphiti extracts entities (target.com, open ports, services)
- Relationships are created in the knowledge graph
- Context is stored with temporal information
Querying the Knowledge Graph
Access knowledge via Neo4j Browser or Cypher queries:Example Queries
Find all vulnerabilities discovered on a target:API Access
Graphiti provides a REST API for programmatic access:Knowledge Graph Structure
Node Types
Pentesting-specific entity types:- Target: Hosts, IPs, domains being tested
- Service: Running services (HTTP, SSH, etc.)
- Vulnerability: Security weaknesses
- Tool: Security testing utilities
- Technique: Attack methodologies
- Finding: Discovered artifacts
- Agent: AI agents performing tasks
- Task: Testing objectives
Edge Types
Relationship types between nodes:- HAS_SERVICE: Target → Service
- HAS_VULNERABILITY: Target → Vulnerability
- EXPLOITS: Tool → Vulnerability
- DISCOVERS: Tool → Finding
- USES: Agent → Tool
- AFFECTS: Vulnerability → Target
- PART_OF: Task → Flow
- DEPENDS_ON: Task → Task
Temporal Properties
All relationships include temporal context:created_at: When relationship was establishedupdated_at: Last modification timestampvalid_from: Start of validity periodvalid_to: End of validity period (optional)
Services
Graphiti Service
Knowledge graph API:docker-compose-graphiti.yml
Neo4j Database
Graph database engine:docker-compose-graphiti.yml
Troubleshooting
Graphiti Not Responding
Check service health:Neo4j Connection Issues
Verify database is accessible:Entity Extraction Failing
Debug LLM integration:Performance Issues
Optimize Neo4j configuration:-
Increase shared memory:
-
Create indexes on frequently queried properties:
- Monitor query performance in Neo4j Browser
Data Not Appearing
Verify PentAGI integration:Best Practices
Data Management
- Regularly backup Neo4j data volume
- Archive old knowledge graphs periodically
- Clean up test data before production use
- Monitor database size and growth rate
- Use indexes for performance optimization
Entity Design
- Use consistent naming conventions
- Normalize entity properties
- Avoid redundant relationships
- Include relevant metadata
- Document custom entity types
Query Optimization
- Use indexed properties in WHERE clauses
- Limit result sets appropriately
- Avoid Cartesian products in queries
- Profile slow queries with EXPLAIN
- Cache frequently-used patterns
Security
- Change default Neo4j password immediately
- Restrict Neo4j ports to localhost
- Use strong authentication in production
- Enable Neo4j encryption (TLS/SSL)
- Audit access logs regularly
Advanced Usage
Custom Entity Types
Extend Graphiti with custom entities by modifying the vxcontrol/pentagi-graphiti fork.Temporal Queries
Query knowledge at specific time points:Graph Analytics
Use Neo4j Graph Data Science library:Integration with Other Tools
Export knowledge graph data:Related Documentation
- Neo4j - Graph database configuration
- Memory Systems - AI agent memory architecture
- Agent Architecture - Multi-agent system design