9.2 KiB
Contributing to TensorZero
Thank you for your interest in contributing to TensorZero!
TensorZero aims to power the next generation of AI applications. We'd love to collaborate with you to make this vision a reality.
Tip
In addition to community contributions, we're also hiring in NYC (in-person only). See our open roles.
License
TensorZero is licensed under the Apache 2.0 license. By contributing to this repository, you agree to license your contributions under the same license.
Community & Support
Slack and Discord
Join our community on Slack or Discord to chat with the team and other contributors.
GitHub
We use GitHub Issues to track bugs and feature requests. For general questions, technical support, and conversations not directly related to code, please use GitHub Discussions.
Contributions
Tip
See the
good-first-issuelabel for simpler issues that might be a good starting point for new contributors.
Code
For small changes (i.e. a few lines of code), feel free to open a PR directly.
For larger changes, please communicate with us first to avoid duplicate work or wasted effort. You can start a discussion (GitHub, Slack, or Discord) or open an issue as a starting point. The team will be happy to provide feedback and guidance.
At this time, we don't assign issues to new external contributors (in the past, most people we assigned issues to never submitted a PR). Please submit a PR directly once you're ready to start working on an issue.
Tip
See the "Technical Guide" section below for more details on building and testing TensorZero.
Documentation
The content for our documentation lives in the docs/ directory.
For small changes (e.g. typos), feel free to open a PR directly.
For larger changes, please communicate with us first to avoid duplicate work or wasted effort. You can start a discussion (GitHub, Slack, or Discord) or open an issue as a starting point.
Content — Examples, Tutorials, etc.
We'd love to collaborate on examples, tutorials, and other content that showcases how to build AI applications with TensorZero.
For content contributed directly to our repository, please follow the same process as code contributions.
For external content (e.g. blog posts, videos, social media content), we're excited to support and amplify your work. Share your content in our community channels (Slack and Discord), tag us on social media, or reach out if you'd like technical review or feedback before publishing.
We're happy to provide guidance and support for both types of content to help you create high-quality resources for the TensorZero community.
Integrations
We're open to exploring integrations with other projects and tools (both open-source and commercial). Reach out if you're interested in collaborating.
Security
If you discover a security vulnerability, please email us at security@tensorzero.com.
Other
Did you have something else in mind? Reach out on Slack or Discord and let us know.
Technical Guide
Setup
- Install Rust (1.80+) →
- Install
cargo-deny→ - Install
cargo-nextest→ - Install
pre-commit→ - Enable
pre-commitin your repository:pre-commit install - Install Docker →
- Install
uv→ - Install Python (3.10+) (e.g.
uv python install 3.10+ ) - Install Node.js (we use v24.13.0) and
npm→ - Install pnpm
npm install -g pnpm@10.15.0→
macOS users: If you see Rust build errors about missing dynamic libraries for Python, set up a Python virtual environment at tensorzero/.venv (e.g. uv venv from the tensorzero directory)
This ensures the correct Python libraries are available for the build.
Tests
Rust Unit Tests
cargo test-unit
Rust E2E Tests with ClickHouse
-
Launch the test containers
docker compose -f crates/tensorzero-core/tests/e2e/docker-compose.yml up --wait -
Set the relevant environment variables (
TENSORZERO_CLICKHOUSE_URLand model provider API keys likeOPENAI_API_KEY,ANTHROPIC_API_KEY, etc.). See the credential docs for the full list. -
Launch the gateway in testing mode
cargo run-e2e -
Run the E2E tests
cargo test-e2e
Tip
The E2E tests involve every supported model provider, so you need every possible credential to run the entire test suite.
If your changes don't affect every provider, you can run a subset of tests with
cargo test-e2e xyz, which will only run tests withxyzin their name.
Rust E2E Tests with Postgres
-
Launch the test containers
docker compose -f crates/tensorzero-core/tests/e2e/docker-compose.yml up --wait -
Set the relevant environment variables (
TENSORZERO_CLICKHOUSE_URLand model provider API keys likeOPENAI_API_KEY,ANTHROPIC_API_KEY, etc.). See the credential docs for the full list. -
Launch the gateway in testing mode
cargo run-e2e-postgres -
Run the E2E tests
TENSORZERO_INTERNAL_TEST_OBSERVABILITY_BACKEND=postgres cargo test-e2e
Python
-
Launch ClickHouse and the gateway in E2E testing mode (see above).
-
Go to the relevant directory (e.g.
cd clients/python) -
Install the Python dependencies. We recommend using
uv.uv sync -
Run the tests
uv run pytest -
Run the type checker
uv pip install pyright uv run pyright -
Run the formatter
uv pip install ruff uv run ruff format --check . uv run ruff check --output-format=github --extend-select I .
TensorZero UI
The UI depends on ClickHouse and other TensorZero components.
For development, we recommend running the TensorZero Gateway and ClickHouse as containers.
We also provide fixtures in ui/fixtures/.
To set it up, follow these steps from the repository's root directory:
-
Install dependencies:
pnpm install -
Build the internal N-API client for TensorZero using
pnpm -r build. If you have changed your Rust code, you may also have to runpnpm build-bindings. -
Create a
ui/fixtures/.envfollowing theui/fixtures/.env.example. -
Create a
ui/.envfollowing theui/.env.example, or set the environment variables from that file in your shell before running the dev script. -
Launch the dependencies:
# For local development without R2 credentials (downloads via public HTTP): TENSORZERO_DOWNLOAD_FIXTURES_WITHOUT_CREDENTIALS=1 docker compose -f ui/fixtures/docker-compose.yml up --build --force-recreate # With R2 credentials (faster S3 sync, used in CI): docker compose -f ui/fixtures/docker-compose.yml up --build --force-recreateYou can omit the
--build --force-recreateflags to skip the build step, but they ensure you're using the latest gateway. -
Launch the development server:
pnpm ui:dev
Separately, you can run headless tests with pnpm ui:test and Playwright tests with pnpm ui:test:e2e (the latter will require a pnpm exec playwright install).
We also maintain a Docker Compose for e2e tests ui/fixtures/docker-compose.e2e.yml that is used in CI for the Playwright tests. This file uses a different configuration that mandates credentials for image fetching.
Autopilot Tests (Internal Only)
Note
The Autopilot feature depends on a closed-source internal API. The tests in
ui/e2e_tests/autopilot/require access to the privateautopilotrepository and cannot be run by external contributors. These tests are excluded by default and run in CI via repository dispatch from the autopilot repo.
For internal contributors with access to the autopilot repository, see ui/AGENTS.md for detailed instructions on running the autopilot development environment and tests.
Advanced
- To test batch and optimization workflows without real provider APIs, spin up the
mock-provider-apiand setTENSORZERO_INTERNAL_MOCK_PROVIDER_API=http://localhost:3030when running the gateway. - If your code affects the serialization of stored data, batch tests might fail because they'll rely on an older serialization of the request. In such cases, you might need to clear the database and re-run the tests. The TensorZero Team can clean up the cache by running
TRUNCATE TABLE tensorzero_e2e_tests.BatchModelInference; TRUNCATE TABLE tensorzero_e2e_tests.BatchRequest;in the ClickHouse Cloud clusterdev-tensorzero-e2e-tests.
Thanks again for your interest in contributing to TensorZero! We're excited to see what you build.