Would SurrealDB be a bad idea?

I was fighting with supabase for my database with v3 of archon. I tried doing supabase locally then gave up. I have been super excited about surrealdb for a while and have implemented it in a couple of projects running it locally. I started converting archon over to it, still not working quite yet. But thought I would share some perplexity formed thinking.

Note: Written by Perplexity.AI Deepresearch

SurrealDB Integration Benefits for Archon: Present and Future

Archon’s evolution from a specialized RAG-based Agenteer to a comprehensive multi-agent framework presents an opportunity to reconsider its database architecture. While the current Supabase implementation has served well for initial development, SurrealDB’s multi-model capabilities offer several advantages worth exploring.

Immediate Benefits for Current Architecture

Native Multi-Model Database Consolidation

SurrealDB would replace the current Supabase implementation with a unified solution that natively handles all required data models without extensions. This consolidation brings together vector embeddings, document storage, relational data, and graph relationships within a single database system rather than relying on PostgreSQL extensions.

Enhanced RAG Performance and Flexibility

Native vector search capabilities with support for both HNSW and M-Tree vector indexes would directly enhance core RAG functionality. This could improve the relevance of returned documentation snippets, especially as the complexity of supported frameworks increases beyond the current implementation.

Simplified Query Operations

The current approach often requires complex SQL joins to navigate relationships. SurrealDB allows for more expressive and concise syntax:

Traditional SQL approach:

SELECT p.name, pr.name, pr.price
FROM person p
INNER JOIN order o ON p.id = o.person_id
LEFT JOIN product pr ON o.product_id = pr.id

SurrealDB approach:

SELECT name, ->order->product.{name, price} FROM person

This reduction in query complexity could significantly streamline codebase maintenance as documentation relationships grow more intricate.

Benefits for Future Development Roadmap

V5: Multi-Agent Workflow Enhancement

For the planned multi-agent coding workflow, SurrealDB’s graph capabilities provide natural modeling for inter-agent relationships. These could be represented as explicit edges in a graph, making it easier to manage complex workflows and visualize how different agents contribute to the final output.

V6-V10: Framework Expansion Support

SurrealDB’s hybrid schema approach (mixing “schemafull” and “schemaless” tables) perfectly aligns with Archon’s framework expansion goals. This flexibility maintains strict validation for critical structures while allowing framework-specific variations without requiring schema migrations for each new integration.

V11-V12: Autonomous Learning Infrastructure

The built-in SurrealML capabilities could support self-improvement mechanisms planned for later versions. Native vector search functionality would directly enhance sophisticated retrieval approaches, while the ability to version machine learning models would facilitate experimental improvements to code generation.

V13: MCP Agent Marketplace Foundation

For the ambitious marketplace, SurrealDB’s multi-model approach creates an ideal foundation with:

  • Graph structures for agent compatibility mapping
  • Document storage for flexible metadata
  • Vector search for semantic discovery
  • Time-series capabilities for marketplace analytics

Implementation Considerations

Several practical considerations should guide any migration decision:

  1. Performance Validation: Benchmark with Archon’s specific workloads, particularly RAG query patterns.

  2. Migration Complexity: Plan for restructuring data models, converting queries to SurrealQL, and updating application code.

  3. Deployment Flexibility: Choose between embedded mode (local development), distributed mode (production), or Surreal Cloud (managed infrastructure).

  4. Security Implementation: Align SurrealDB’s RBAC model with Archon’s existing security requirements.

Conclusion

SurrealDB represents a compelling database option particularly aligned with Archon’s evolution from specialized agent generator to comprehensive creation ecosystem. The most significant benefits come from unified handling of vectors, graphs, and flexible schemas—capabilities directly supporting Archon’s development roadmap.

While migration requires careful planning, the architectural advantages could significantly enhance development velocity and feature capabilities, particularly for the more ambitious components of Archon’s future versions.

1 Like

I was going to post links to the relevant SurrealDB Documentation but I am a new member so I can only link to two

[1] Getting started with SurrealDB Getting started with SurrealDB
[2] Vector Search | Reference guides Vector Search | Reference guides

1 Like

I really appreciate this suggestion and the deep dive you did! Perplexity seems to have hallucinated somewhat though because Archon doesn’t use any SQL queries with joins so I don’t think the queries themselves would be simplified. I still do think there is a lot of merit to this ideal! I haven’t used SurrealDB myself so I’d have to take a look.

Definitely let me know once you’ve converted it over and I’d love to take a look!

For sure, :slight_smile: I am a bit outside my wheel house so I thought it would be important to note it came from perplexity.

1 Like