Skip to main content

Open Science Assistant (OSA)

An extensible AI assistant platform for open science projects, built with LangGraph/LangChain and FastAPI.

Overview

OSA provides domain-specific AI assistants for open science tools with:

  • HED Assistant: Hierarchical Event Descriptors for neuroimaging annotation
  • BIDS Assistant: Brain Imaging Data Structure
  • EEGLAB Assistant: EEG analysis toolbox
  • NEMAR Assistant: BIDS-formatted EEG, MEG, and iEEG dataset discovery

Features:

  • YAML-driven community registry - add a new assistant with just a config file
  • Modular tool system for document retrieval, validation, and code execution
  • Multi-source knowledge bases (GitHub, OpenALEX, Discourse forums, mailing lists)
  • Embeddable chat widget for any website
  • Production-ready observability via LangFuse

Installation

# From PyPI
pip install open-science-assistant

# Or with uv (recommended)
uv pip install open-science-assistant

Development Setup

# Clone and install in development mode
git clone https://github.com/OpenScience-Collective/osa.git
cd osa
uv sync --extra dev

# Install pre-commit hooks
uv run pre-commit install

Quick Start

CLI Usage

# Set up your API key
# Anthropic (what the platform itself runs on): https://platform.claude.com/settings/keys
# OpenRouter (still supported for BYOK): https://openrouter.ai/keys
osa init

# Ask the HED assistant a question
osa ask -a hed "What is HED?"

# Start an interactive chat session
osa chat -a hed

# Show all commands
osa --help

API Server

Requires server dependencies: pip install 'open-science-assistant[server]'

# Start the API server
osa serve

# Or with uvicorn directly
uv run uvicorn src.api.main:app --reload --port 38528

Configuration

# Show current config
osa config show

# Set API keys for BYOK (Bring Your Own Key)
osa config set --anthropic-key sk-ant-...
osa config set --openrouter-key sk-or-v1-...

# Override API URL per-command
osa ask -a hed "What is HED?" --api-url https://api.osc.earth/osa-dev

Deployment

OSA can be deployed via Docker:

# Pull and run
docker pull ghcr.io/openscience-collective/osa:latest
docker run -d --name osa -p 38528:38528 \
  -e ANTHROPIC_API_KEY=your-key \
  ghcr.io/openscience-collective/osa:latest

# Check health
curl http://localhost:38528/health

See deploy/DEPLOYMENT_ARCHITECTURE.md for detailed deployment options including Apache reverse proxy and BYOK configuration.

Community Registry

OSA uses a YAML-driven registry to configure community assistants. Each community has a config.yaml that declares its documentation, system prompt, knowledge sources, and specialized tools.

# Directory structure
src/assistants/
    hed/config.yaml      # HED assistant configuration
    bids/config.yaml     # BIDS assistant

Adding a New Community

  1. Create src/assistants/my-tool/config.yaml:
id: my-tool
name: My Tool
description: A research tool for neuroscience
status: available

# By default, every community runs on the shared Claude Platform key.
# Optional: only set these if the community funds its own usage instead.
# Set the named environment variable on your backend server.
# anthropic_api_key_env_var: "ANTHROPIC_API_KEY_MY_TOOL"
# openrouter_api_key_env_var: "OPENROUTER_API_KEY_MY_TOOL"

system_prompt: |
  You are a technical assistant for {name}.
  {preloaded_docs_section}
  {available_docs_section}

documentation:
  - title: Getting Started
    url: https://my-tool.org/docs
    source_url: https://raw.githubusercontent.com/org/my-tool/main/docs/intro.md
    preload: true

github:
  repos:
    - org/my-tool
  1. (Optional) If you set either key env var, export it on your backend:
export ANTHROPIC_API_KEY_MY_TOOL="sk-ant-..."
# or, for a community that funds OpenRouter usage instead
export OPENROUTER_API_KEY_MY_TOOL="sk-or-v1-..."
  1. Validate your configuration:
uv run osa validate src/assistants/my-tool/config.yaml
  1. Start the server - the /{community-id}/ask endpoint is auto-created.

For the full guide, see the community registry documentation.

To let a community's model write and run Python in the reader's own browser (execute_code, a client tool), see docs/community-browser-runtime.md: the extensions.client_tools and runtime.python config keys, the lock overlay for wheels Pyodide does not ship, the embedding page's Content-Security-Policy, and the measured first-load cost.

To customize a community's widget (title, greeting, suggested questions, logo, and its colors: the surface, the text on it, the accent used on the white panel, and the reader's own message bubble), see docs/community-widget.md.

Documentation

Full documentation is available at docs.osc.earth/osa.

Development

# Run tests with coverage
uv run pytest --cov

# Format code
uv run ruff check --fix . && uv run ruff format .

License

MIT

Metadata

Release files for open-science-assistant 0.8.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for open-science-assistant 0.8.16
File Size Uploaded Provenance Actions
open_science_assistant-0.8.16.tar.gz 2.6 MB With provenance Details for open_science_assistant-0.8.16.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for open-science-assistant 0.8.16
File Interpreter ABI Platform Actions
open_science_assistant-0.8.16-py3-none-any.whl Python 3 none any Details for open_science_assistant-0.8.16-py3-none-any.whl

Total release size: 3.6 MB

Release files / open_science_assistant-0.8.16.tar.gz

Download URL open_science_assistant-0.8.16.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
22d0d165a14e09e5bd2c69f9932454e5bb7a0aa15a35f50cc8d899e78e0a5ecd
BLAKE2b-256 checksum
How to use checksums
3d35cac3656887998ea3e455671842bbac8c08dc9b9a300a27a9113bb3cf7687
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / open_science_assistant-0.8.16-py3-none-any.whl

Download URL open_science_assistant-0.8.16-py3-none-any.whl
Size 994.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5717bbcc8430ea65d96c8a8838b82ad80a526c5c147cd319eb14297e7a3d0dd
BLAKE2b-256 checksum
How to use checksums
5709e98e63ce9018cea78a2fff84c6369654ed2b9fa9c76d8e89c0240611e535
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Security for open-science-assistant 0.8.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for open_science_assistant-0.8.16.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.16 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page