Architecture
Storage Structure
The storage layer uses three main tables:1. tasks_table
Stores all tasks with complete execution history and artifacts:task_id(UUID, primary key)context_id(UUID, foreign key to contexts_table)status(enum: pending, running, completed, failed, input_required)history(JSONB array of execution steps)artifacts(JSONB object for task outputs)created_at,updated_at(timestamps)
2. contexts_table
Maintains context metadata and message history:context_id(UUID, primary key)messages(JSONB array of conversation messages)metadata(JSONB object for custom data)created_at,updated_at(timestamps)
3. task_feedback_table
Optional feedback storage for tasks:feedback_id(UUID, primary key)task_id(UUID, foreign key to tasks_table)feedback(text)rating(integer, 1-5)metadata(JSONB object)created_at(timestamp)
Configuration
Environment Variables
Configure PostgreSQL connection via environment variables (see.env.example):
Agent Configuration
No additional configuration needed in your agent code. Storage is configured via environment variables:Setting Up PostgreSQL
Local Development
Using Docker (Recommended)
Using Local PostgreSQL
-
Install PostgreSQL:
-
Create database and user:
-
Set environment variable:
Cloud Deployment
Neon (Serverless PostgreSQL)
- Create account at neon.tech
- Create a new project
- Copy the connection string
- Set environment variable:
Database Migrations
Bindu uses Alembic for database migrations.Running Migrations
Migrations run automatically on startup by default. To disable:Manual Migration Commands
Migration Files
Located inalembic/versions/:
20251207_0001_initial_schema.py- Initial database schema20250614_0001_add_webhook_configs_table.py- Webhook configurations- Additional migrations as needed