Skip to main content

A Python SDK and CLI for building agent rollouts and managing LLM post-training workflows on Osmosis.

Project description

Osmosis

Platform PyPI Python Codecov License Docs

osmosis-ai

⚠️ Warning: osmosis-ai is still in active development. APIs may change between versions.

Python SDK and CLI for Osmosis AI, a platform for training LLMs with reinforcement learning. Implement an AgentWorkflow in Python, add a concrete Grader for evaluation runs and managed training runs, submit evaluation runs with the CLI, then submit training runs from an Osmosis workspace directory.

Quick start

Step What you do
Define agents One AgentWorkflow subclass (+ optional AgentWorkflowConfig) in your repo. The training/evaluation entrypoint must also expose a concrete Grader (typically with a GraderConfig).
Layout Use a rollout pack directory under rollouts/<name>/ when loading by rollout name; the CLI adds that directory to sys.path.
Workspace directory Create or open a workspace in the Osmosis Platform, then clone the repository created there.
Check workspace osmosis doctor — run from the workspace directory so platform commands resolve the repository from the origin remote. Add --fix to restore missing scaffold paths.
Evaluate osmosis eval submit configs/eval/<name>.toml — submit an evaluation run using the same platform dataset naming as training runs.

Example repository: osmosis-remote-rollout-example (reference server usage - align with current SDK exports when upgrading).

Documentation index: docs/README.md

Agent-friendly CLI output

The osmosis CLI keeps Rich as the default output for humans, but every public command also speaks structured JSON and low-noise plain text for AI agents, CI/CD, and shell automation. Put these global output flags before the command:

osmosis dataset list                         # human-friendly Rich table
osmosis --json dataset list                  # recommended for AI agents and CI/CD
osmosis --plain dataset list                 # low-noise text for shell pipelines

JSON is the stable machine contract: every successful response includes schema_version: 1; list envelopes include items, total_count, has_more, and next_offset; detail envelopes include data; operation envelopes include status, operation, optional resource, and optional next_steps_structured. Errors are JSON-structured on stderr with code, message, details, optional request_id, plus the command path and SDK cli_version.

Plain mode is for humans and simple shell pipelines, not a strict schema. --json and --plain are global flags parsed before subcommands; prefer osmosis --json <command> or osmosis --plain <command> over the default Rich output in non-interactive environments. Command-local --output always means a file path, not a format selector, so osmosis dataset download my-dataset --output ./data.jsonl works in every mode.

In JSON or plain mode, interactive commands fail fast with INTERACTIVE_REQUIRED unless a non-interactive flow exists, typically by passing --yes or --token. OSMOSIS_TOKEN is verify-only across the CLI: it activates authentication for the current process but is never written to the on-disk credentials store, never revoked, and never deletes existing credentials.

Workspace Directory Flow

Create or open a workspace in the Osmosis Platform, clone the repository created there, then run CLI commands from that workspace directory.

git clone <repo-url>
cd <repo>
osmosis auth login
osmosis doctor
osmosis template apply multiply              # or add your rollout under rollouts/
cp configs/training/default.toml configs/training/<run>.toml
$EDITOR configs/training/<run>.toml          # set rollout, dataset, and model_path
git add rollouts configs data
git commit -m "configure training run"
git push
osmosis train submit configs/training/<run>.toml

Platform-scoped commands derive scope from the workspace directory's origin remote and send X-Osmosis-Git: namespace/repo_name. The CLI does not store or send a workspace ID for commands scoped by the workspace directory.

Before submitting training runs from CI, push the repository and authenticate with a token:

export OSMOSIS_TOKEN=<token>
osmosis train submit configs/training/<run>.toml --yes

Installation

Requires Python 3.12+. For development setup, see CONTRIBUTING.md.

  • An LLM API key (e.g., OpenAI, Anthropic, Groq) — required for osmosis eval rubric (LLM-as-judge) when using hosted models. See supported providers.
  • Osmosis account (optional) — needed for osmosis auth login and platform-backed commands such as datasets, models, and training runs. Sign up at platform.osmosis.ai.

pip

pip install osmosis-ai            # Core SDK
pip install osmosis-ai[server]    # + FastAPI rollout server (pulls in platform extra)
pip install osmosis-ai[full]      # Same as [server] (all packaged optional features)

uv

uv add osmosis-ai                 # Core SDK
uv add osmosis-ai[server]         # + FastAPI rollout server (pulls in platform extra)
uv add osmosis-ai[full]           # Same as [server] (all packaged optional features)

Testing and evaluation

Contributing

See CONTRIBUTING.md for development setup, testing, linting, and PR guidelines.

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osmosis_ai-0.2.25.tar.gz (161.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

osmosis_ai-0.2.25-py3-none-any.whl (206.0 kB view details)

Uploaded Python 3

File details

Details for the file osmosis_ai-0.2.25.tar.gz.

File metadata

  • Download URL: osmosis_ai-0.2.25.tar.gz
  • Upload date:
  • Size: 161.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for osmosis_ai-0.2.25.tar.gz
Algorithm Hash digest
SHA256 60cc9b85b6c3a779883772f6244fd572e6fcdaad116090046fc1268135ba3ab3
MD5 8d96823b3b9c3e94a09ecdcacf38cd8c
BLAKE2b-256 9264e5999ff3eb0c8c1077528ce739f92242001588a4b33a7c3dc530c557945f

See more details on using hashes here.

Provenance

The following attestation bundles were made for osmosis_ai-0.2.25.tar.gz:

Publisher: publish.yml on Osmosis-AI/osmosis-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file osmosis_ai-0.2.25-py3-none-any.whl.

File metadata

  • Download URL: osmosis_ai-0.2.25-py3-none-any.whl
  • Upload date:
  • Size: 206.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for osmosis_ai-0.2.25-py3-none-any.whl
Algorithm Hash digest
SHA256 0e8e4a1e3cc51ca0cd5b09e3aba34547f78dedabad9492fce0c34a9bfd5dbcde
MD5 62eb3a5cfffcadcc39be081d012b49dd
BLAKE2b-256 7889b90c165791f721d6bb65b73fa6964b4d2280df28afeadbc9426552c033ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for osmosis_ai-0.2.25-py3-none-any.whl:

Publisher: publish.yml on Osmosis-AI/osmosis-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page