Thank you for your interest in contributing to FastroAI! This guide will get you started quickly.
# Clone and setup
git clone https://github.com/benavlabs/fastroai.git
cd fastroai
uv sync
# Verify installation
uv run pytest
uv run mypy fastroai
uv run ruff checkFastroAI is a lightweight AI orchestration library built on PydanticAI. It provides production-ready primitives for building AI applications.
fastroai/
├── agent/ # FastroAgent - PydanticAI wrapper with cost tracking
├── pipelines/ # DAG-based workflow orchestration
├── tools/ # @safe_tool decorator and toolsets
├── tracing/ # Tracer protocol and implementations
└── usage/ # CostCalculator with microcents precision
Key Design Principles:
- Stateless agents (conversation history is caller-managed)
- Integer microcents for billing (avoids floating-point errors)
- Protocol-based tracing (implement
Tracerfor any backend) - Type-safe contexts throughout pipelines
- Read the CLAUDE.md - contains detailed architecture and patterns
- Use existing patterns - look at similar code for consistency
- Write tests first - especially for new functionality
- Understand the component you're modifying
# Standard library
from typing import Any, Optional
# Third-party
from pydantic import BaseModel
from pydantic_ai import Agent
# Local
from fastroai.agent import FastroAgent
from fastroai.usage import CostCalculator| Type of Change | Location |
|---|---|
| Agent functionality | agent/agent.py |
| Response/request schemas | agent/schemas.py |
| Pipeline steps | pipelines/base.py |
| Pipeline execution | pipelines/executor.py |
| Tool decorators | tools/decorators.py |
| Tracer implementations | tracing/tracer.py |
| Cost calculation | usage/calculator.py |
# Format code
uv run ruff format .
# Lint and auto-fix
uv run ruff check --fix .
# Run tests
uv run pytest
# With coverage
uv run pytest --cov=fastroai
# Type checking
uv run mypy fastroai
# All checks (run before submitting PR)
uv run ruff format . && uv run ruff check --fix . && uv run mypy fastroai && uv run pytestTests use pytest-asyncio with asyncio_mode = "auto". Mock PydanticAI agents using model="test" or TestModel().
- Create feature branch:
git checkout -b feature/your-feature - Make changes following the architecture principles
- Add tests for new functionality
- Run all checks (format, lint, mypy, pytest)
- Submit PR with clear description
- Add method to
FastroAgentclass (agent/agent.py) - Update
ChatResponseschema if needed (agent/schemas.py) - Add tests (
tests/test_agent.py) - Update documentation
- Update
BaseSteporPipelineclass (pipelines/) - Update
StepUsage/PipelineUsageif tracking new metrics - Add tests (
tests/test_pipeline.py) - Update documentation
- Create new class implementing
Tracerprotocol (tracing/tracer.py) - Add tests (
tests/test_tracing.py) - Export from
__init__.pyif public - Add documentation
- Use integer arithmetic for cost calculations (microcents)
- Keep functions pure when possible (easier to test)
- Use TYPE_CHECKING imports for type hints that would create circular deps
- Stream large responses instead of loading everything into memory
- Documentation: Check the docs folder
- Issues: Create a GitHub issue for bugs/features
- Discussions: Use GitHub Discussions for questions
Please follow our Code of Conduct to maintain a welcoming environment.
Quick Reference:
- Stateless agents, integer microcents, protocol-based tracing
- Test everything, respect existing patterns
- Run
uv run ruff format . && uv run ruff check --fix . && uv run mypy fastroai && uv run pytestbefore submitting
Thank you for contributing to FastroAI!