Development Guide
This guide is for developers who want to contribute to SimpleAgents or understand its internals.
Project Structure
SimpleAgents is a Rust workspace with multiple crates:
SimpleAgents/
├── crates/
│ ├── simple-agent-type/ # Core types and traits
│ ├── simple-agents-core/ # Client orchestration
│ ├── simple-agents-providers/ # Provider implementations
│ ├── simple-agents-router/ # Routing strategies
│ ├── simple-agents-cache/ # Cache implementations
│ ├── simple-agents-healing/ # JSON healing + schema coercion
│ ├── simple-agents-macros/ # Proc macros (PartialType)
│ ├── simple-agents-cli/ # CLI
│ ├── simple-agents-ffi/ # C ABI
│ ├── simple-agents-napi/ # Node bindings
│ └── simple-agents-py/ # Python bindings
├── docs/ # Documentation site
├── Cargo.toml # Workspace manifest
└── README.mdCrate Responsibilities (Quick Map)
simple-agent-type: contracts + shared types.simple-agents-core: client orchestration (routing, cache, healing, middleware).simple-agents-providers: provider integrations and utilities.simple-agents-router: routing strategies and resilience helpers.simple-agents-healing: JSON-ish parsing and schema coercion.simple-agents-cache: cache implementations.simple-agents-cli: CLI interface.simple-agents-ffi/simple-agents-napi/simple-agents-py: language bindings.simple-agents-macros: proc macros for partial streaming types.
Building
Prerequisites
- Rust 1.75 or later
- Cargo (comes with Rust)
Build All Crates
bash
cargo build --allBuild with Release Optimizations
bash
cargo build --all --releaseBuild Specific Crate
bash
cargo build -p simple-agents-core
cargo build -p simple-agents-providers
cargo build -p simple-agents-routerCheck Without Building
bash
cargo check --allTesting
Run All Tests
bash
cargo test --allRun Tests for Specific Crate
bash
cargo test -p simple-agents-core
cargo test -p simple-agents-providers
cargo test -p simple-agents-healingRun Cross-Language Contract Gates
bash
./scripts/run-binding-contracts.shRun Layered Binding Tests (unit/contract/live)
bash
make test-binding-layersThis runs unit + contract checks for Go/Node/Python by default, and runs live suites only when credentials are provided.
Run Workflow Runtime Benchmarks
bash
cargo bench -p simple-agents-workflow --bench runtime_benchmarksRun Tests with Output
bash
cargo test -- --nocaptureContributing
See the repository-level Contributing Guide for checklist discipline, required task-board updates, and skill-usage expectations.
Getting Started
- Fork the repository.
- Create a feature branch:
git checkout -b feature/my-feature. - Make your changes.
- Run tests:
cargo test --all. - Run clippy:
cargo clippy --all. - Run fmt:
cargo fmt --all. - Commit and open a PR.
Commit Message Format
Use conventional commits:
feat: add routing strategy
fix: handle schema coercion edge case
docs: update usage guidePull Request Checklist
- [ ] Tests pass (
cargo test --all) - [ ] No clippy warnings (
cargo clippy --all) - [ ] Code formatted (
cargo fmt --all) - [ ] Documentation updated
Code Style
Formatting
Use rustfmt with default settings:
bash
cargo fmt --allLinting
Use clippy with strict settings:
bash
cargo clippy --all -- -D warningsDocumentation
- Public APIs should include doc comments.
- Document panics, errors, and safety invariants.
- Provide usage examples for complex APIs.
Security Considerations
- Never log API keys; use
ApiKeyfor validation and exposure control. - Validate requests with
CompletionRequest::build(). - Use constant-time comparisons for secrets.
Debugging
Enable Logging
rust
use tracing_subscriber;
tracing_subscriber::fmt::init();Run with Logs
bash
RUST_LOG=debug cargo test
RUST_LOG=simple_agents=trace cargo runRelease Process
- Update version in all
Cargo.tomlfiles. - Update CHANGELOG.md.
- Run full test suite:
cargo test --all. - Build release:
cargo build --all --release. - Tag release:
git tag v0.x.0. - Push tags:
git push --tags. - Publish crates as needed.