Skip to main content

Stateful AI agents with editable memory blocks and persistent storage

Project description

Asterix

Stateful AI agents with editable memory blocks and persistent storage.

Note: Asterix is in Beta (v0.2.1). Core features are stable and production-ready. Enhanced features and optimizations are in active development.

Asterix is a lightweight Python library for building AI agents that can remember, learn, and persist their state across sessions. No servers required - just pip install and start building.

Python 3.10+ License: MIT


Features

  • Editable Memory Blocks - Agents can read and write their own memory via built-in tools
  • Persistent Storage - State saves across sessions (JSON/SQLite backends)
  • Semantic Search - Qdrant Cloud integration for long-term memory retrieval
  • Enhanced Tool System - Easy decorator pattern with parameter validation, retry logic, and categories
  • Custom System Prompts - Override the base system prompt for specialized agent behavior
  • Tool Call Callbacks - Before/after hooks for human-in-the-loop approval and audit logging
  • Step-by-Step Progress Callbacks - Stream heartbeat loop progress via on_step callback
  • Conversation History API - Retrieve conversation history with get_history(limit=)
  • Auto-Documentation - Tools automatically generate markdown/JSON documentation
  • Smart Error Handling - Helpful error messages with suggestions and context
  • Multi-Model Support - Works with Gemini, Groq, OpenAI, and extensible to others
  • No Server Required - Pure Python library, runs anywhere

Quick Start

Installation

pip install asterix-agent

Or with UV (faster):

uv pip install asterix-agent

Basic Usage

from asterix import Agent, BlockConfig

# Create an agent with custom memory blocks
agent = Agent(
    blocks={
        "task": BlockConfig(size=1500, priority=1),
        "notes": BlockConfig(size=1000, priority=2)
    },
    model="gemini/gemini-2.5-flash"  # Default model
)

# Chat with your agent
response = agent.chat("Hello! Remember that I prefer Python over JavaScript.")
print(response)

# Agent automatically updates its memory
# Memory persists across conversations

Add Custom Tools

@agent.tool(name="read_file", description="Read a file from disk")
def read_file(filepath: str) -> str:
    with open(filepath, 'r') as f:
        return f.read()

# Now your agent can read files
response = agent.chat("Read config.yaml and summarize the settings")

Save & Load State

# Save agent state
agent.save_state()

# Later session - load previous state
agent = Agent.load_state("agent_id")
agent.chat("What were we discussing?")  # Remembers everything!

Documentation

Comprehensive documentation is available in the docs/ directory:

Core Concepts

  • Memory System - How agent memory works (blocks, archival, conversation search)
  • Tool System - Creating and using tools (validation, categories, retry logic)
  • Storage Backends - State persistence (JSON, SQLite, custom backends)
  • Configuration - Environment variables, YAML, and Python configuration

Guides

Quick Links


Examples

Complete working examples in examples/:

# Clone and setup
git clone https://github.com/adityasarade/Asterix.git
cd Asterix && pip install -e .

# Run examples
python examples/basic_chat.py              # Simple conversation
python examples/custom_tools.py            # Tool registration
python examples/persistent_agent.py        # JSON persistence
python examples/persistent_agent_sqlite.py # SQLite persistence
python examples/cli_agent.py               # Full-featured CLI

See the Examples Guide for detailed walkthroughs.


🧪 Testing

pip install -e ".[dev]"
pytest --cov=asterix --cov-report=html

Project Status

Current Version: 0.2.1 (Beta)

Roadmap:

  • Core agent implementation
  • Memory tools system
  • State persistence (JSON & SQLite)
  • Qdrant integration
  • Enhanced tool system with validation
  • Auto-documentation
  • Multi-model support (Gemini, Groq, OpenAI)
  • OSCAR integration (callbacks, system prompts, history API)
  • Gemini SDK migration (google-genai v1.x)
  • Vertex AI support (dual-mode Gemini auth)
  • Performance optimizations
  • Advanced monitoring
  • Streaming responses
  • Multi-agent collaboration
  • Additional backends (Redis, PostgreSQL)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -m 'Add your feature')
  4. Push to the branch (git push origin feature/your-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments


Support


So that everyone can build better agents without worrying about memory (Let's hope OpenAI doesn't make this library meaningless)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asterix_agent-0.2.1.tar.gz (120.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asterix_agent-0.2.1-py3-none-any.whl (79.2 kB view details)

Uploaded Python 3

File details

Details for the file asterix_agent-0.2.1.tar.gz.

File metadata

  • Download URL: asterix_agent-0.2.1.tar.gz
  • Upload date:
  • Size: 120.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for asterix_agent-0.2.1.tar.gz
Algorithm Hash digest
SHA256 22864f998582b42b68b2bb177100d230aec1bbc6755f6924c0221e6cd866ef17
MD5 ea97c593f5083c53d5d6893b04611dc2
BLAKE2b-256 7ae61b3cee9f103a124862f3f32b646d1553e79ae65720301f3b81a720fdb355

See more details on using hashes here.

File details

Details for the file asterix_agent-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: asterix_agent-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 79.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for asterix_agent-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2decf843ed7c194cc579cd65090555c2e1822e54e2bb29330ba6a2bafc8ba2cc
MD5 fd85c5b41723ba861e1ba875b2e0a606
BLAKE2b-256 4291b99416c3b7ac574ab6ab970a33c8b9b3925c8c8c6666ddbad77aaa07bea0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page