Agentbx
Project description
Agentbx: A Redis-Based Crystallographic Agent System
Overview
Agentbx is a Python-based system for managing crystallographic & electron microscopy computing using a Redis-backed agent architecture. It is designed for modular, distributed, and AI-integrated scientific computing, with a focus on clear separation of concerns and robust, persistent data handling.
Key Concepts & Architecture
Modular Separation: Agents, Clients, and Processors
- Agents (
src/agentbx/core/agents/):- Long-running services that listen to Redis streams for requests (e.g., geometry calculation, security management).
- Example:
AsyncGeometryAgentprocesses geometry calculation requests and returns results via Redis.
- Clients (
src/agentbx/core/clients/):- Optimizers and user-facing modules that submit requests to agents and update bundles (e.g., coordinate, B-factor, solvent optimizers).
- Follow PyTorch conventions for optimization (separate backward/step logic).
- Processors (
src/agentbx/processors/):- Stateless, single-responsibility modules for core scientific calculations (e.g., geometry, gradients, structure factors).
Redis as the Central Nervous System
- Bundles: All data (atomic models, gradients, results) are stored as versioned bundles in Redis.
- Streams: Agents and clients communicate via Redis streams for robust, asynchronous, and distributed operation.
No Internal Workflow Engine
- Workflow orchestration is now externalized: Instead of internal workflow management, users are encouraged to use modern orchestration tools like Prefect or LangGraph to coordinate multi-step pipelines and distributed jobs.
- Agentbx provides the building blocks (agents, clients, processors, bundles) for these workflows, but does not enforce or manage workflow logic internally.
Directory Structure
src/agentbx/
core/
agents/ # Agent services (e.g., AsyncGeometryAgent, AgentSecurityManager)
clients/ # Optimizers and user-facing modules (e.g., CoordinateOptimizer, BFactorOptimizer)
processors/ # Stateless scientific processors (e.g., geometry, gradients)
... # Redis manager, bundle base, config, etc.
Example: Multi-Process Usage
- Start an Agent (in one shell):
python -m agentbx.core.agents.async_geometry_agent # or use the provided example script
- Run a Client Optimizer (in another shell):
python examples/optimization_clients_example.py # or your own script using CoordinateOptimizer, BFactorOptimizer, etc.
- Monitor Redis:
- All communication and data flow through Redis, enabling robust, distributed, and restartable computation.
Integration with AI and External Orchestration
- AI Models: Easily integrate PyTorch/TensorFlow models as clients or processors.
- Orchestration: Use Prefect, LangGraph, or similar tools to build complex, multi-step scientific workflows using Agentbx as the computational backend.
Features
- Modular, single-responsibility agents and clients
- Persistent, versioned data bundles in Redis
- Stateless, testable processors for core scientific logic
- Seamless AI integration
- No internal workflow engine: bring your own orchestration
- Robust multi-process/multi-shell operation
Requirements
- Python 3.10+
- Redis
- CCTBX
- Pydantic
- Click
- Poetry
- (Optional) PyTorch/TensorFlow for AI integration
Installation
You can install Agentbx via [pip] from [PyPI]:
$ pip install agentbx
Or install with Redis support:
$ pip install agentbx[redis-agents]
Publishing to PyPI
To publish a new version to PyPI:
- Update the version using the sync script:
python scripts/sync_version.py 1.0.4
- Commit and push your changes.
- Ensure all tests pass and the package builds successfully.
- Publish to PyPI (requires credentials):
poetry publish --build
Getting Started
- See
examples/optimization_clients_example.pyfor a full demonstration of agent/client interaction and optimization. - See
whatsnext.txtfor a running development log and next steps. - For orchestration, see Prefect or LangGraph documentation for how to build workflows using Agentbx components.
Contributing
Contributions are welcome! Please see the CONTRIBUTING.md file for guidelines.
License
This project is licensed under the MIT License. See the LICENSE file for details.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentbx-1.1.0.tar.gz.
File metadata
- Download URL: agentbx-1.1.0.tar.gz
- Upload date:
- Size: 74.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a83df597958a94b047ef5d89a6d0c2605633e30d08396ea43957d6f7e4951faa
|
|
| MD5 |
688233340ed7a769a00cbc622df9a4d7
|
|
| BLAKE2b-256 |
12637546389572cc3128bb650b82ead7196be5b360635f79849d65646053d976
|
File details
Details for the file agentbx-1.1.0-py3-none-any.whl.
File metadata
- Download URL: agentbx-1.1.0-py3-none-any.whl
- Upload date:
- Size: 102.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2c55556e07d97799442b697063cc4779d18c9a30eb8320ccd77ca048ec8778c
|
|
| MD5 |
6bb021d86a77bbd5f5ae6ff01ecda0d5
|
|
| BLAKE2b-256 |
2ede0cf42814ccec963bc313d7440d748b2f67cc4d1b7f79b8bfa792f1fda5e8
|