Backend system for managing agentic transport logistics using FastAPI and agent-based modeling.
- Python 3.10 or higher
- Poetry (recommended) or pip
- Node.js (for semantic-release, optional for local dev)
- Install dependencies:
poetry install- Install pre-commit hooks:
poetry run pre-commit install
poetry run pre-commit install --hook-type commit-msg- Make validation script executable:
chmod +x scripts/validate-commit.sh# 1) Install dependencies
poetry install
# 2) (Optional) Install pre-commit hooks for local checks
poetry run pre-commit install
poetry run pre-commit install --hook-type commit-msg
# 3) Start the backend (empty world; load or generate a map via WebSocket actions)
poetry run python -m world.sim.runner --host 0.0.0.0 --port 8000 --log-level INFOEndpoints:
- WebSocket:
ws://localhost:8000/ws - Health:
http://localhost:8000/health
poetry run pytestThe project uses pre-commit hooks to ensure code quality:
- ruff: Linting and formatting
- mypy: Static type checking
- Various fixers: Trailing whitespace, end-of-file, etc.
Run manually:
poetry run pre-commit run --all-filespoetry run pytest --covspine/
├── agents/ # Agent implementations (vehicles, coordinators)
├── core/ # Core primitives (FSM, IDs, messages)
├── world/ # World graph and simulation
└── tests/ # Test suite
- FastAPI: High-performance async web framework
- Pydantic v2: Data validation and settings management
- NumPy & SciPy: Map generation (Delaunay triangulation, spatial queries)
- orjson: Fast JSON serialization for WebSocket messages
- Poetry: Dependency management
This project uses Conventional Commits and Semantic Versioning.
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Types:
feat: New feature (→ minor version bump)fix: Bug fix (→ patch version bump)docs: Documentation changesstyle: Code style/formattingrefactor: Code refactoringperf: Performance improvementtest: Testing changesbuild: Build system changesci: CI/CD changeschore: Other changes
Examples:
git commit -m "feat: add vehicle telemetry tracking"
git commit -m "fix: correct route calculation bug"
git commit -m "docs: update API documentation"Branches must follow: <type>/<description>
git checkout -b feat/add-user-authentication
git checkout -b fix/vehicle-routing-bug
git checkout -b docs/update-readmeVersions are automatically managed by semantic-release:
- Runs on every push to
main - Analyzes commit messages to determine version bump
- Updates
pyproject.tomlversion - Creates GitHub release with changelog
- Generates
CHANGELOG.md
You don't need to manually bump versions!
# Build and run with Docker Compose
docker-compose up --build
# Run in background
docker-compose up -d
# View logs
docker-compose logs -f spine-backendSet environment variables in .env file or directly:
# Custom port and log level
SPINE_PORT=8080 SPINE_LOG_LEVEL=DEBUG docker-compose upThe application will be available at:
- WebSocket:
ws://localhost:8000/ws - Health Check:
http://localhost:8000/health
For detailed Docker documentation, see Docker Containerization.
See CONTRIBUTING.md for detailed guidelines.
Quick start:
- Create a feature branch following naming convention:
feat/your-feature - Make changes with conventional commits:
feat: add your feature - Ensure tests pass:
poetry run pytest - Pre-commit hooks will validate commits automatically
- Submit a pull request to
main