Skip to main content

A library for agent and environment protocol interactions

Project description

Interaxions

A modern, extensible framework for orchestrating AI agents and environments on Kubernetes/Argo Workflows, inspired by HuggingFace Transformers.

Python 3.10+ License: MIT

โœจ Features

  • ๐ŸŽฏ Job-Based Configuration - Unified Job schema for complete workflow definition
  • ๐Ÿš€ Dynamic Loading - Load components from built-in, local, or remote Git repositories
  • ๐Ÿ”„ Unified API - All Auto* classes use consistent from_repo() interface
  • ๐Ÿ“ฆ Three-Layer Architecture - Scaffolds, Environments, and Workflows
  • ๐Ÿท๏ธ Version Control - Support for Git tags, branches, and commits
  • ๐Ÿ”’ Multi-Process Safe - File locks for concurrent access
  • ๐Ÿ’พ Smart Caching - Three-level cache system for optimal performance
  • ๐ŸŒ Flexible Sources - GitHub, GitLab, HuggingFace, OSS, or custom sources
  • โœ… Comprehensive Testing - 53 unit tests with pytest

๐Ÿš€ Quick Start

Installation

# Basic installation
pip install interaxions

# With optional dependencies
pip install interaxions[argo]  # Argo Workflows support
pip install interaxions[hf]    # HuggingFace datasets
pip install interaxions[oss]   # OSS storage support

# For development
pip install -e ".[dev]"

Basic Usage (Job-Based API)

from interaxions import AutoWorkflow
from interaxions.schemas import Job, Scaffold, Environment, Workflow, Runtime, LiteLLMModel

# Define a complete job configuration
job = Job(
    name="fix-django-bug",
    description="Fix Django bug using SWE-agent",
    tags=["swe-bench", "django"],
    labels={"priority": "high", "team": "research"},
    
    # Model configuration
    model=LiteLLMModel(
        type="litellm",
        provider="openai",
        model="gpt-4",
        base_url="https://api.openai.com/v1",
        api_key="your-api-key",
    ),
    
    # Scaffold (agent) configuration
    scaffold=Scaffold(
        repo_name_or_path="swe-agent",
        params={"max_iterations": 10},
    ),
    
    # Environment configuration
    environment=Environment(
        repo_name_or_path="swe-bench",
        environment_id="django__django-12345",
        source="hf",
        params={
            "dataset": "princeton-nlp/SWE-bench",
            "split": "test",
        },
    ),
    
    # Workflow configuration
    workflow=Workflow(
        repo_name_or_path="rollout-and-verify",
        params={},
    ),
    
    # Runtime configuration
    runtime=Runtime(
        namespace="experiments",
        service_account="argo-workflow",
        ttl_seconds_after_finished=3600,
    ),
)

# Create and submit workflow
workflow_template = AutoWorkflow.from_repo(job.workflow.repo_name_or_path)
workflow = workflow_template.create_workflow(job)
workflow.create()  # Submit to Argo

Quick API (One-Step Loading)

from interaxions import AutoScaffold, AutoEnvironment, AutoWorkflow

# Load scaffold
scaffold = AutoScaffold.from_repo("swe-agent")

# Load environment (unified API)
env = AutoEnvironment.from_repo(
    repo_name_or_path="swe-bench",
    environment_id="django__django-12345",
    source="hf",
    dataset="princeton-nlp/SWE-bench",
    split="test",
)

# Load workflow
workflow_template = AutoWorkflow.from_repo("rollout-and-verify")

๐Ÿ“š Core Concepts

1. Job - Unified Configuration

Job is the central schema that encapsulates all information needed to run a workflow:

from interaxions.schemas import Job

job = Job(
    # Metadata
    name="my-job",
    description="Job description",
    tags=["tag1", "tag2"],
    labels={"key": "value"},
    
    # Components (all use from_repo pattern)
    model=...,        # LLM configuration
    scaffold=...,     # Agent/scaffold configuration
    environment=...,  # Environment/data configuration  
    workflow=...,     # Workflow orchestration
    runtime=...,      # Kubernetes/Argo settings
)

2. Three-Layer Architecture

Scaffolds (formerly Agents)

  • High-level orchestration logic
  • Can manage single or multiple agents internally
  • Example: swe-agent

Environments

  • Test environments and evaluation datasets
  • Support HuggingFace, OSS, and custom sources
  • Example: swe-bench

Workflows

  • Define execution order and dependencies
  • Generate Argo Workflows
  • Example: rollout-and-verify

3. Dynamic Loading

All components use the from_repo() pattern:

# Built-in
component = Auto*.from_repo("component-name")

# Local path
component = Auto*.from_repo("./my-component")

# Remote repository (GitHub)
component = Auto*.from_repo("username/repo-name")

# With specific version
component = Auto*.from_repo("username/repo", revision="v1.0.0")

๐ŸŽจ Loading Sources

Built-in Components

from interaxions import AutoScaffold, AutoEnvironment, AutoWorkflow

# Load built-in components
scaffold = AutoScaffold.from_repo("swe-agent")
workflow = AutoWorkflow.from_repo("rollout-and-verify")

Environment Loading (Unified API)

from interaxions import AutoEnvironment

# From HuggingFace
env = AutoEnvironment.from_repo(
    repo_name_or_path="swe-bench",
    environment_id="django-123",
    source="hf",
    dataset="princeton-nlp/SWE-bench",
    split="test",
)

# From OSS
env = AutoEnvironment.from_repo(
    repo_name_or_path="swe-bench",
    environment_id="django-123",
    source="oss",
    dataset="swe-bench-data",
    split="test",
    oss_region="cn-hangzhou",
    oss_endpoint="oss-cn-hangzhou.aliyuncs.com",
    oss_access_key_id="your-key-id",
    oss_access_key_secret="your-secret",
)

Batch Loading (Factory Pattern)

from interaxions import AutoEnvironmentFactory

# Load factory once
factory = AutoEnvironmentFactory.from_repo("swe-bench")

# Create multiple environments efficiently
env1 = factory.get_from_hf("django-123", "dataset", "test")
env2 = factory.get_from_hf("flask-456", "dataset", "test")
env3 = factory.get_from_hf("numpy-789", "dataset", "test")

๐Ÿ”ง Environment Variables (Optional)

All environment variables have sensible defaults and are optional:

Variable Description Default
IX_HOME Base directory for Interaxions data ~/.interaxions
IX_HUB_CACHE Cache directory for hub modules ~/.interaxions/hub
IX_OFFLINE Enable offline mode (no network) false
IX_ENDPOINT Custom Git endpoint for remote repos GitHub

Example:

export IX_HOME=/custom/path
export IX_OFFLINE=true

๐Ÿ“ฆ Creating Custom Components

See Repository Standards for detailed requirements.

Minimum Requirements

Scaffold Repository:

my-scaffold/
โ”œโ”€โ”€ config.yaml           # type: my-scaffold
โ”œโ”€โ”€ agent.py              # Class inheriting from BaseScaffold
โ””โ”€โ”€ templates/            # Optional Jinja2 templates
    โ””โ”€โ”€ main.j2

Environment Repository:

my-environment/
โ”œโ”€โ”€ config.yaml           # type: my-environment
โ””โ”€โ”€ env.py                # Factory inheriting from BaseEnvironmentFactory

Workflow Repository:

my-workflow/
โ”œโ”€โ”€ config.yaml           # type: my-workflow
โ””โ”€โ”€ workflow.py           # Class inheriting from BaseWorkflow

All components must implement:

  • from_repo(repo_name_or_path, revision) class method
  • create_task(job, **kwargs) or create_workflow(job, **kwargs) method

๐Ÿงช Testing

# Run unit tests (fast, reliable)
pytest -m unit

# Run all tests
pytest

# With coverage
pytest --cov=interaxions --cov-report=html

# View coverage report
open htmlcov/index.html

See tests/README.md for detailed testing documentation.

๐Ÿ“ Project Structure

interaxions/
โ”œโ”€โ”€ scaffolds/          # Agent scaffold implementations
โ”‚   โ”œโ”€โ”€ base_scaffold.py
โ”‚   โ””โ”€โ”€ swe_agent/
โ”œโ”€โ”€ environments/       # Environment implementations
โ”‚   โ”œโ”€โ”€ base_environment.py
โ”‚   โ””โ”€โ”€ swe_bench/
โ”œโ”€โ”€ workflows/          # Workflow implementations
โ”‚   โ”œโ”€โ”€ base_workflow.py
โ”‚   โ””โ”€โ”€ rollout_and_verify/
โ”œโ”€โ”€ schemas/            # Pydantic schemas (Job, Scaffold, etc.)
โ”‚   โ”œโ”€โ”€ job.py
โ”‚   โ””โ”€โ”€ models.py
โ””โ”€โ”€ hub/                # Dynamic loading system
    โ”œโ”€โ”€ auto.py         # Auto* classes
    โ”œโ”€โ”€ hub_manager.py  # Repository management
    โ””โ”€โ”€ constants.py    # Configuration

tests/                  # Comprehensive test suite
โ”œโ”€โ”€ unit/               # Unit tests (53 tests, all passing)
โ”œโ”€โ”€ integration/        # Integration tests
โ”œโ”€โ”€ e2e/                # End-to-end tests
โ””โ”€โ”€ conftest.py         # Shared fixtures

examples/               # Usage examples
โ””โ”€โ”€ quickstart.py       # Complete tutorial

๐Ÿ”„ Development Workflow

# Clone repository
git clone https://github.com/Hambaobao/interaxions.git
cd interaxions

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest -m unit

# Run examples
python examples/quickstart.py

# Build package
python -m build

# Check package
twine check dist/*

๐Ÿ“– Documentation

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass: pytest -m unit
  5. Submit a pull request

๐Ÿ“„ License

MIT License - see LICENSE for details

๐Ÿ™ Acknowledgments

๐Ÿ”— Links


Made with โค๏ธ for the AI agent research community

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

interaxions-0.0.1.post1.tar.gz (39.1 kB view details)

Uploaded Source

Built Distribution

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

interaxions-0.0.1.post1-py3-none-any.whl (39.7 kB view details)

Uploaded Python 3

File details

Details for the file interaxions-0.0.1.post1.tar.gz.

File metadata

  • Download URL: interaxions-0.0.1.post1.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for interaxions-0.0.1.post1.tar.gz
Algorithm Hash digest
SHA256 cb0aaa89ee3bb8319957210a801637266213250d2a2d2fd50296c1ac49187054
MD5 138a8c2e4a6a045f8af6133476b6f2ff
BLAKE2b-256 dc398efde270a74dde5e0c649c01c63621cdce992ebbd6c06d6290cc55d6e7fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for interaxions-0.0.1.post1.tar.gz:

Publisher: python-publish.yaml on Hambaobao/interaxions

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

File details

Details for the file interaxions-0.0.1.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for interaxions-0.0.1.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc295fe3e81eb8b478851bc85be8a7a9105d4ca7b478326e4965cd7e6a56a375
MD5 ae03f23edf24b0fd24493dd182914e56
BLAKE2b-256 5f24fdcad279feacabf5217e02103eeb0921f94d0b47cf6affa3a1eb0d1db9a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for interaxions-0.0.1.post1-py3-none-any.whl:

Publisher: python-publish.yaml on Hambaobao/interaxions

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