Skip to content

Postgres Checkpointer

The Postgres Checkpointer is a tool designed to help your automation workflows remember their progress. It acts like a “save point” for your processes, storing information in a PostgreSQL database so you can stop a task and pick it up exactly where you left off. This ensures that no data is lost and your automations remain continuous, even if they are interrupted.

How it Works

When your workflow runs, the Postgres Checkpointer saves a snapshot of the current state and data into a PostgreSQL database. It connects to your database using a secure connection URL and stores the checkpoint in a specific table.

If a workflow needs to pause or restart, the checkpointer allows you to retrieve the saved state, ensuring that the process continues from the exact point where it stopped. This is especially useful for long-running tasks or workflows that need to maintain context over time. The component handles all the database interactions automatically, so you can focus on building your automation without worrying about the underlying storage details.

Connection & Credentials

This component requires configuring a credential in the Nappai panel before interacting with the external service:

  1. Go to the Credentials section in your Nappai panel.
  2. Create a new credential of the Postgres type and fill in the required fields (Server URL, Port, Username, Password, Database Name).
  3. In your workflow, select the saved credential in the Database URL input field of this node.

Inputs

  • Database URL: The database connection URL for Postgres.

Outputs

The Postgres Checkpointer produces a Checkpointer output. This output represents the saved state and confirmation that the checkpoint was created successfully. You can use this output to pass the checkpoint information to other components that need to access the saved data or verify the checkpoint status.

Output Data Example (JSON)json

{ “checkpoint_id”: “550e8400-e29b-41d4-a716-446655440000”, “session_id”: “main_workflow_run”, “state_data”: { “current_step”: “process_data”, “items_processed”: 150, “timestamp”: “2024-05-20T10:30:00Z” }, “success”: true }

Connectivity

This component is typically used in workflows that require state persistence, such as AI agents, long-running data pipelines, or processes that need to handle interruptions gracefully. The Checkpointer output is usually connected to subsequent components that need to read the saved state, verify checkpoint success, or manage session continuity.

Usage Example

Imagine you have a workflow that processes a large batch of customer records. As the workflow runs, the Postgres Checkpointer saves the progress periodically. If the system is restarted or the process is paused, you can use the saved checkpoint to resume processing from the last saved point, ensuring that no records are skipped or duplicated.

Tips and Best Practices

  • Ensure your PostgreSQL database is accessible from the Nappai environment to avoid connection errors.
  • Use descriptive session IDs to distinguish between different workflow runs and make it easier to manage checkpoints.
  • Monitor the database table to manage the size of stored checkpoints and prevent excessive storage usage.
  • Verify that the connection URL includes all necessary credentials to ensure secure and reliable access.

Security Considerations

  • The Database URL contains sensitive credentials. Ensure that this URL is kept secure and is not shared with unauthorized users.
  • Configure your PostgreSQL server to reject unauthorized access and use strong passwords for database credentials.
  • Regularly review access logs to detect any unauthorized attempts to interact with your database.