Axion Framework
  • Welcome to Axion Framework
  • Oreview
    • Overview: Axion Framework
    • Installation Guide: Axion Framework
  • BASICS
    • YAML Configuration Guide
    • Modular Architecture: Axion Framework
    • Swarm Behavior: Axion Framework
    • Dynamic Breeding in Axion Framework
    • Democratic Decision-Making in Axion Framework
  • Multi-Agent Collaboration in Axion Framework
  • AI Agent in Axion Framework
  • Reinforcement Learning (Self-Optimization) in Axion Framework
  • IPFS for Decentralized Messaging in Axion Framework
  • Integrations in Axion Framework
  • Database and Storage Integrations in Axion Framework
  • Blockchain Smart Contract Interaction in Axion Framework
  • Knowledge Graph Integration in Axion Framework
  • Advanced Use Cases with Axion Framework
  • API Documentation for Axion Framework
  • Glossary: Key Terms and Concepts
  • Output Overview
  • Security Practices
  • Roadmap
Powered by GitBook
On this page
Export as PDF

Database and Storage Integrations in Axion Framework

PreviousIntegrations in Axion FrameworkNextBlockchain Smart Contract Interaction in Axion Framework

Last updated 4 months ago

The Axion Framework provides robust integrations with a wide range of databases and storage solutions, allowing agents to manage structured and unstructured data effectively. From lightweight local storage to distributed vector databases, these integrations are tailored to enhance multi-agent systems' performance and scalability.


Supported Integrations

1. MongoDB Integration

MongoDB is a NoSQL database ideal for handling large, semi-structured datasets. It’s best suited for managing agent metadata, task logs, and configurations.

Key Features:

  • JSON-like document storage.

  • High-performance read/write operations.

  • Scalability for large-scale deployments.

Example: Storing Agent Metadata

from axion.integrations.mongodb_client import MongoDBClient

# Initialize MongoDB client
mongo_client = MongoDBClient(database="AxionDB")
doc_id = mongo_client.insert_document("agents", {"name": "Agent-1", "role": "worker", "status": "active"})
print(f"Agent metadata stored with ID: {doc_id}")

# Query agent metadata
agent_data = mongo_client.query_documents("agents", {"status": "active"})
print(f"Active agents: {agent_data}")

mongo_client.close_connection()

2. Neo4j Integration

Neo4j is a graph database optimized for storing relationships between entities, making it perfect for modeling agent interactions and swarm decision-making.

Key Features:

  • Graph-based data storage for relationships.

  • Cypher query language for advanced graph queries.

  • Scalable graph traversal.

Example: Modeling Agent Relationships

from axion.integrations.neo4j_client import Neo4jClient

# Connect to Neo4j
neo4j_client = Neo4jClient(uri="bolt://localhost:7687", user="neo4j", password="password")

# Add nodes and relationships
agent1_id = neo4j_client.create_node("Agent", {"name": "Agent-1", "role": "worker"})
agent2_id = neo4j_client.create_node("Agent", {"name": "Agent-2", "role": "manager"})
neo4j_client.create_relationship(agent1_id, agent2_id, "reports_to")

# Query the graph
relationships = neo4j_client.query_relationships("MATCH (a:Agent)-[r:reports_to]->(b:Agent) RETURN a, b")
print(f"Agent relationships: {relationships}")

neo4j_client.close()

3. Qdrant Integration

Qdrant is a vector database for storing and querying high-dimensional embeddings, enabling semantic search and clustering.

Key Features:

  • Semantic search for AI-driven tasks.

  • High-performance vector indexing.

  • Flexible storage for embeddings.

Example: Managing Embeddings for Semantic Search

from axion.integrations.qdrant_client import QdrantClient

# Initialize Qdrant client
qdrant_client = QdrantClient(collection_name="embeddings")

# Create a collection and add vectors
qdrant_client.create_collection(vector_size=128)
qdrant_client.add_vector(
    vector=[0.12, 0.45, 0.67, 0.89], 
    payload={"name": "Document A", "type": "report"}
)

# Perform semantic search
results = qdrant_client.search(vector=[0.12, 0.45, 0.67, 0.88], top=3)
print(f"Search results: {results}")

4. SQLite Integration

SQLite is a lightweight, serverless database ideal for temporary or local storage needs in resource-constrained environments.

Key Features:

  • File-based storage for simplicity.

  • No server setup required.

  • Ideal for small-scale data handling.

Example: Storing Local Logs

from axion.integrations.sqlite_client import SQLiteClient

# Initialize SQLite client
sqlite_client = SQLiteClient(database="local_logs.db")

# Create a table
sqlite_client.create_table(
    "task_logs", 
    columns="id INTEGER PRIMARY KEY, task_description TEXT, status TEXT, timestamp DATETIME DEFAULT CURRENT_TIMESTAMP"
)

# Insert a log
sqlite_client.insert_data(
    table="task_logs", 
    columns="task_description, status", 
    values="'Analyze market trends', 'completed'"
)

# Query logs
logs = sqlite_client.query_data("task_logs", "*")
print(f"Task logs: {logs}")

sqlite_client.close()

Choosing the Right Integration

Integration

Best Use Cases

Strengths

MongoDB

Metadata storage, task history

JSON flexibility, scalable performance

Neo4j

Knowledge graphs, relationships

Optimized for graph traversal and relationships

Qdrant

Embedding storage, AI search

Semantic clustering, high-performance indexing

SQLite

Local storage, small datasets

Lightweight, simple to set up