Why Storage Matters
Bindu’s task-first architecture depends on persistent state. Tasks move through states —submitted, working, input-required, completed — and that state needs to live somewhere durable.
| Without storage | With Bindu storage |
|---|---|
| Tasks are lost on restart | Tasks persist across restarts |
| No conversation history | Full message history per task |
| Artifacts disappear after response | Artifacts stored and retrievable |
| Multi-turn conversations break | Context preserved across turns |
| Fine for local scripts | Required for production agents |
Bindu defaults to in-memory storage for local development. Switch to PostgreSQL for
production. The storage backend is configured in
agent_config.json — your agent
code does not change.How Bindu Storage Works
Bindu abstracts storage behind a consistent interface. You choose the backend in config; the rest of the system — TaskManager, workers, context handling — works the same regardless.The Storage Model
Bindu stores three categories of data:- Tasks — state, messages, metadata, and lifecycle history
- Contexts — shared conversation context across multiple tasks
- Artifacts — outputs produced by the agent (text, files, structured data)
Tasks
Every task and its full state history, messages, and metadata.
Contexts
Shared context that spans multiple tasks in a conversation.
Artifacts
Agent outputs stored and retrievable by task ID.
Backends
Bindu supports two storage backends:| Memory | PostgreSQL | |
|---|---|---|
| Setup | None | Requires PostgreSQL instance |
| Persistence | Lost on restart | Survives restarts |
| Scalability | Single process | Multi-instance, distributed |
| Use case | Local development | Production |
| Config | "type": "memory" | "type": "postgres" |
Configuration
Storage is configured inagent_config.json. No changes to your agent code are needed when switching backends.
Memory (Development)
PostgreSQL (Production)
The
STORAGE__URL environment variable takes precedence over the value in
agent_config.json. Use environment variables in production to keep credentials out
of your config files.The Storage Lifecycle
Storage is used throughout the task lifecycle. Here is how it fits into a complete request: Every state transition is written to storage. If the agent restarts mid-task, the task can be recovered and resumed from its last known state.Working with Tasks
Tasks are the primary unit of storage. Each task has a unique ID and carries its full history.Retrieving a Task
Listing Tasks
Contexts
Contexts allow multiple tasks to share a common conversation thread. When a caller provides acontextId, Bindu links the task to that context and preserves the shared history.
contextId. They survive restarts when using PostgreSQL.
PostgreSQL Setup
For production deployments, you need a running PostgreSQL instance.Docker (Quick Start)
Environment Variables
Schema
Bindu manages its own schema. On first startup with PostgreSQL configured, it creates the necessary tables:Real-World Use Cases
Multi-turn conversations
Multi-turn conversations
A user starts a research task, the agent asks a clarifying question, and the user
responds. With persistent storage, the task resumes from
input-required state
with full context intact — even if the agent restarted between turns.Long-running tasks
Long-running tasks
A data analysis task that takes several minutes. The client submits the task, gets
a
task_id immediately, and polls for completion. Storage keeps the task alive
across the entire execution window.Audit and replay
Audit and replay
Every task stores its full message history and state transitions. You can retrieve
any past task by ID and inspect exactly what happened, when, and what the agent
produced.
Multi-instance deployments
Multi-instance deployments
With PostgreSQL, multiple instances of the same agent share a single storage
backend. Any instance can pick up a task from the queue and write results back to
the same store.
Security Best Practices
Use Environment Variables
Never put database credentials in
agent_config.json. Use STORAGE__URL as an
environment variable and keep it out of version control.Restrict Database Access
The Bindu agent only needs read/write access to its own tables. Use a dedicated
database user with minimal permissions.