Arc Memory API Reference

Welcome to the Arc Memory SDK API Reference. This section provides detailed documentation for the programmatic interfaces of Arc Memory, allowing you to integrate knowledge graph capabilities into your own applications and workflows.

Beta Release: Arc Memory SDK is currently in beta. We’re actively gathering feedback and improving the platform.

The Arc Memory API is designed to be intuitive and consistent, following Python best practices and providing comprehensive type hints for better IDE integration.

API Overview

Getting Started with the API

1

Installation

First, install Arc Memory:

pip install arc-memory
2

Import the library

from arc_memory import ArcMemory
3

Initialize Arc Memory

# Basic initialization
arc = ArcMemory()

# With custom options
arc = ArcMemory(
    repo_path="path/to/repo",
    output_path="path/to/output.db",
    github_token="your_github_token"
)
4

Use the API

# Build the knowledge graph
arc.build()

# Trace history for a file
history = arc.trace_file("path/to/file.py", line_number=42)

# Process the results
for item in history:
    print(f"Commit: {item.commit_hash}")
    print(f"Author: {item.author}")
    print(f"Date: {item.date}")
    print(f"Message: {item.message}")

API Sections

Core Functions

  • build(): Build a complete knowledge graph
  • build_incremental(): Update an existing graph
  • clean(): Remove existing graph data

Key Features

  • Multi-source data ingestion
  • Incremental builds for efficiency
  • Plugin system for extensibility

View Build Process API Documentation →

Complete Example

API Best Practices

Error Handling

Use try/except blocks to handle potential exceptions:

try:
    result = arc.build()
except arc_memory.GraphBuildError as e:
    print(f"Build failed: {e}")

Performance

For large repositories:

  • Use incremental builds
  • Limit query depth
  • Apply specific filters

Extensibility

Create custom plugins by implementing the IngestorPlugin interface:

@register_plugin
class MyPlugin(IngestorPlugin):
    def get_name(self):
        return "my-plugin"
    # ...

For detailed API documentation, explore the specific API sections linked above.