Knowledge Graph Integration
Example Workflow
Add Knowledge to the Graph
Copy
Copy
from src.utils.knowledge_graph import KnowledgeGraph # Initialize the Knowledge Graph knowledge_graph = KnowledgeGraph() # Add a concept knowledge_graph.add_concept("AI Agent", {"role": "worker", "status": "active"}) # Add a relationship between concepts knowledge_graph.add_relationship("AI Agent", "Swarm", "belongs_to")
Query the Knowledge Graph
Copy
Copy
# Query a concept result = knowledge_graph.query_concept("AI Agent") print(f"Attributes of AI Agent: {result}") # Query relationships relationships = knowledge_graph.query_relationships("AI Agent") print(f"Relationships of AI Agent: {relationships}")
Visualize the Knowledge Graph
Copy
Copy
# Visualize the graph knowledge_graph.visualize_graph(output_path="knowledge_graph.png") print("Knowledge graph saved as knowledge_graph.png")
Benefits of Knowledge Graphs in Wingman
Enhanced Reasoning Agents can use structured knowledge to make more informed decisions.
Collaboration Agents can share knowledge across the swarm, improving collective performance.
Persistent Memory Knowledge graphs serve as a long-term memory for agents.
Best Practices
Use Attributes Effectively Add meaningful attributes to concepts for better querying and reasoning.
Structure Relationships Clearly Define relationships that reflect real-world connections (e.g., "belongs_to", "depends_on").
Regular Updates Periodically update the graph to reflect the latest knowledge and task history.
Last updated