NeuronAI
GitHubForumNewsletterMonitoring
  • Getting Started
    • Introduction
  • Getting Started
  • Agent
  • Tools
  • Streaming
  • Structured Output
  • Attachments (Documents & Images)
  • Advanced
    • RAG
    • MCP Connector
    • Logging & Monitoring
    • Error Handling
  • Asynchronous Processing
  • Components
    • AI provider
    • Chat History & Memory
    • Embeddings Provider
    • Vector Store
    • Post Processor
    • Data loader
  • Workflow
    • Getting Started
    • Node, Edge & State
  • Human In The Loop
  • Persistence
  • Resources
    • Guides & Tutorials
    • GitHub
    • Example Projects
Powered by GitBook
On this page
  • When to use Persistence
  • InMemoryPersistence
  • FilePersistence

Persistence

When we talk about persistence in NeuronAI, we're talking about the system's ability to capture and preserve the complete state of a running workflow at any moment. This includes:

  • All variables and their current values

  • The exact execution position – which node is active, which have completed, which are waiting

  • Context and metadata – timestamps, user information, decision history

  • Error states and retry counters – so failures can be handled gracefully

Think of it like a sophisticated "save game" feature, but for business processes. At any point, when an interruption is asked from a node, NeuronAI create a snapshot of your workflow's state and store it in the persistence layer. Later – whether that's seconds, hours, or weeks – the workflow can be restored to exactly that moment and continue as if nothing happened.

As usual in Neuron the Workflow persistence layer is built on top of a common interface so it's extensible and interchangeable. Below the supported persistence layer.

When to use Persistence

Persistence comes into play when you intend to use interruption. The persistence component requires to decalre also a workflow ID.

InMemoryPersistence

It keep data in memory only for the current execution cycle.

$workflow = new SimpleWorkflow(
    new InMemoryPersistence(), 
    'CUSTOM_ID'
);

FilePersistence

It will store the Workflow data and state into a local file.

$workflow = new SimpleWorkflow(
    new FilePersistence(__DIR__), 
    'CUSTOM_ID'
);
PreviousHuman In The LoopNextGuides & Tutorials

Last updated 1 day ago