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.
โจ Features
- ๐ฏ XJob-Based Configuration - Unified
XJobschema for complete workflow definition - ๐ Dynamic Loading - Load components from built-in, local, or remote Git repositories
- ๐ Unified API - All
Auto*classes use consistentfrom_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, Gitea, or any Git service via
IX_ENDPOINT - โ Comprehensive Testing - 99 tests with 72% coverage
๐ Quick Start
Installation
# Basic installation
pip install interaxions
# With optional dependencies
pip install interaxions[hf] # HuggingFace datasets
pip install interaxions[oss] # OSS storage support
# For development
pip install -e ".[dev]"
Basic Usage (XJob-Based API)
from interaxions import AutoWorkflow
from interaxions.schemas import XJob, Scaffold, Environment, Workflow, Runtime, LiteLLMModel
# Define a complete job configuration
job = XJob(
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="astropy__astropy-12907",
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="astropy__astropy-12907",
source="hf",
dataset="princeton-nlp/SWE-bench",
split="test",
)
# Load workflow
workflow_template = AutoWorkflow.from_repo("rollout-and-verify")
๐ Core Concepts
1. XJob - Unified Configuration
XJob is the central schema that encapsulates all information needed to run a workflow:
from interaxions.schemas import XJob
job = XJob(
# Metadata
name="my-job",
description="XJob 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 unified from_repo() pattern:
# Built-in (by name, no path separators)
component = Auto*.from_repo("component-name")
component = Auto*.from_repo("swe-agent") # Uses default config
# Local path (contains /, ., or ~)
component = Auto*.from_repo("./my-component")
component = Auto*.from_repo("/absolute/path/to/component")
# Remote repository (Github/Gitlab)
component = Auto*.from_repo("username/repo-name")
# With specific version
component = Auto*.from_repo("username/repo", revision="v1.0.0")
Loading Logic:
- If name contains no path separators (
/,.,~) โ Try as built-in first - If built-in not found or path provided โ Load from filesystem/remote
- Built-in modules use default config; external modules require
config.yaml - Remote repositories (format:
username/repo) useIX_ENDPOINT(defaults to GitHub)
๐จ Loading Sources
Built-in Components
Built-in components are Python packages in interaxions/scaffolds/, interaxions/environments/, etc.
Two ways to load:
# Method 1: Direct import (for advanced customization)
from interaxions.scaffolds.swe_agent import SWEAgent, SWEAgentConfig
config = SWEAgentConfig(max_iterations=20)
scaffold = SWEAgent(config=config)
# Method 2: Unified interface (uses default config)
from interaxions import AutoScaffold, AutoWorkflow
scaffold = AutoScaffold.from_repo("swe-agent") # name only, no paths
workflow = AutoWorkflow.from_repo("rollout-and-verify")
Characteristics:
- โ
No
config.yamlneeded (config in Python code) - โ
Use simple name:
"swe-agent","swe-bench","rollout-and-verify" - โ Automatically use default configuration
- โ Cannot use paths:
"./swe-agent"will load from filesystem
External Components
External components are loaded from filesystem paths or remote repositories.
from interaxions import AutoScaffold
# From local directory
scaffold = AutoScaffold.from_repo("./my-custom-scaffold")
scaffold = AutoScaffold.from_repo("/absolute/path/to/scaffold")
# From remote Git repository (GitHub by default)
scaffold = AutoScaffold.from_repo("username/my-scaffold")
scaffold = AutoScaffold.from_repo("username/my-scaffold", revision="v1.0.0")
# From GitLab or other Git services (set IX_ENDPOINT)
# export IX_ENDPOINT=https://gitlab.com
scaffold = AutoScaffold.from_repo("username/my-scaffold")
Characteristics:
- โ
Must have
config.yamlfile - โ
Must have specific filename:
scaffold.py,env.py, orworkflow.py - โ
Can specify version via
revisionparameter - โ Supports Git tags, branches, commits
- โ
Uses
IX_ENDPOINTenv var to specify Git service (defaults to GitHub) - ๐ฆ Cached in
~/.interaxions/hub/
Built-in vs External Comparison
| Feature | Built-in | External |
|---|---|---|
| Loading | from_repo("swe-agent") |
from_repo("./my-scaffold") or from_repo("user/repo") |
| Location | interaxions/scaffolds/ |
Filesystem / Remote (GitHub/GitLab/etc.) |
| Config | Python code | config.yaml required |
| Versioning | Package version | Git revision (tags, branches, commits) |
| Git Service | N/A | Configurable via IX_ENDPOINT (default: GitHub) |
| Customization | Direct import + custom config | Via config.yaml |
| Use Case | Production-ready, battle-tested | Custom experiments, research |
Environment Loading (Unified API)
from interaxions import AutoEnvironment
# From HuggingFace
env = AutoEnvironment.from_repo(
repo_name_or_path="swe-bench",
environment_id="astropy__astropy-12907",
source="hf",
dataset="princeton-nlp/SWE-bench",
split="test",
)
# From OSS (optional dependency)
env = AutoEnvironment.from_repo(
repo_name_or_path="swe-bench",
environment_id="astropy__astropy-12907",
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("astropy__astropy-12907", "dataset", "test")
env2 = factory.get_from_hf("django__django-11039", "dataset", "test")
env3 = factory.get_from_hf("sympy__sympy-18199", "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 |
Git service endpoint for remote repos | https://github.com |
Using Custom Git Services
By default, remote repositories use GitHub. To use GitLab, Gitea, or enterprise Git:
# GitLab
export IX_ENDPOINT=https://gitlab.com
scaffold = AutoScaffold.from_repo("username/my-scaffold")
# โ Clones from https://gitlab.com/username/my-scaffold.git
# Enterprise GitLab
export IX_ENDPOINT=https://git.company.com
scaffold = AutoScaffold.from_repo("team/project")
# โ Clones from https://git.company.com/team/project.git
# Gitea
export IX_ENDPOINT=https://gitea.io
Note: The system automatically appends .git to repository paths.
Accessing Private Repositories
All Auto*.from_repo() methods support authentication for private repositories using username and token parameters:
from interaxions import AutoScaffold
# Load from private repository
scaffold = AutoScaffold.from_repo(
repo_name_or_path="company/private-agent",
username="your-username",
token="ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # GitHub PAT
)
# With custom Git service (GitLab)
import os
os.environ["IX_ENDPOINT"] = "https://gitlab.company.com"
scaffold = AutoScaffold.from_repo(
repo_name_or_path="team/private-agent",
username="gitlab-user",
token="glpat-xxxxxxxxxxxxxxxxxxxx" # GitLab token
)
# Best practice: Use environment variables
git_username = os.getenv("GIT_USERNAME")
git_token = os.getenv("GIT_TOKEN")
scaffold = AutoScaffold.from_repo(
repo_name_or_path="company/private-agent",
username=git_username,
token=git_token
)
Supported: AutoScaffold, AutoEnvironmentFactory, AutoEnvironment, AutoWorkflow
Authentication format: The system constructs URLs like https://username:token@host/repo.git, similar to:
git clone https://username:token@gitlab.company.com/test-user/Demo-Agent.git
Token generation:
- GitHub: https://github.com/settings/tokens (scope:
repo) - GitLab: Settings > Access Tokens (scope:
read_repository)
๐ฆ Creating Custom Components
Custom components are external modules loaded via filesystem paths or remote repositories.
See Repository Standards for detailed requirements.
Minimum Requirements
Scaffold Repository:
my-scaffold/
โโโ config.yaml # Required: type: my-scaffold, templates: {...}
โโโ scaffold.py # Required: Class inheriting from BaseScaffold
โโโ templates/ # Optional: Jinja2 templates
โโโ main.j2
Example config.yaml:
type: my-scaffold
image: my-scaffold:latest
templates:
main: templates/main.j2
sidecar: templates/sidecar.j2
Environment Repository:
my-environment/
โโโ config.yaml # Required: type: my-environment, templates: {...}
โโโ env.py # Required: Factory inheriting from BaseEnvironmentFactory
โโโ templates/ # Optional: Jinja2 templates
โโโ verify.j2
Example config.yaml:
type: my-environment
templates:
evaluation: templates/evaluation.j2
setup: templates/setup.j2
Workflow Repository:
my-workflow/
โโโ config.yaml # Required: type: my-workflow, templates: {...}
โโโ workflow.py # Required: Class inheriting from BaseWorkflow
โโโ templates/ # Optional: Jinja2 templates
โโโ main.j2
Example config.yaml:
type: my-workflow
templates:
main: templates/main.j2
verify: templates/verify.j2
Key Points:
- โ
config.yamlis required for external components - โ
Use specific filenames:
scaffold.py,env.py,workflow.py - โ
Classes must inherit from base classes:
BaseScaffold,BaseEnvironmentFactory,BaseWorkflow - โ
Implement required methods:
create_task()for scaffolds/environments,create_workflow()for workflows - โ
templates/directory is optional but recommended for all component types - โ
Templates in
config.yamlare loaded as strings (e.g.,templates/main.j2) - โ
Built-in components don't need
config.yaml(config in Python code)
๐งช Testing
# Run all tests (99 passed, 4 skipped)
pytest
# Run specific test categories
pytest -m unit # Unit tests
pytest -m integration # Integration tests
pytest -m e2e # End-to-end tests
# With coverage (currently 72%)
pytest --cov=interaxions --cov-report=html
# View coverage report
open htmlcov/index.html
Test Statistics:
- โ 99 tests passing
- โญ๏ธ 4 tests skipped (3 OSS optional dependency, 1 needs mock environment)
- ๐ 72% code coverage
- โก ~4s total runtime
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 (XJob, 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 (99 passed, 72% coverage)
โโโ unit/ # Unit tests (schemas, models)
โโโ integration/ # Integration tests (auto loading, factories)
โโโ e2e/ # End-to-end tests (full pipeline)
โโโ fixtures/ # Test data and mock repositories
โ โโโ mock_repos/ # Mock scaffold/workflow repos for testing
โ โโโ sample_data.py # Sample data generators
โโโ conftest.py # Shared fixtures and test configuration
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 (should see 99 passed, 4 skipped)
pytest
# Run specific test categories
pytest -m unit # Fast unit tests
pytest -m integration # Integration tests
pytest -m e2e # End-to-end tests
# Check coverage
pytest --cov=interaxions --cov-report=term
# Run examples
python examples/quickstart.py
# Build package
python -m build
# Check package
twine check dist/*
๐ Documentation
- Repository Standards - Complete guide for creating custom components
- Testing Guide - Comprehensive testing documentation
- Examples - Example implementations and tutorials
๐ค Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass:
pytest -m unit - Submit a pull request
๐ License
MIT License - see LICENSE for details
๐ Acknowledgments
- Inspired by HuggingFace Transformers
- Built on Hera for Argo Workflows
- Powered by Pydantic for data validation
๐ Links
- Homepage: https://github.com/Hambaobao/interaxions
- Issues: https://github.com/Hambaobao/interaxions/issues
- PyPI: Coming soon
Made with โค๏ธ for the AI agent research community
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file interaxions-0.0.5.post1.tar.gz.
File metadata
- Download URL: interaxions-0.0.5.post1.tar.gz
- Upload date:
- Size: 44.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09b24df0d5320629355fe27c150240ca2b92bfbaa831f2dcb02499ef51f0ee04
|
|
| MD5 |
b013e68ba7710744e3b620e629294805
|
|
| BLAKE2b-256 |
700fddc971662fe2040e4447c7a7467778b083f7c08277af05bc6d77931e651b
|
Provenance
The following attestation bundles were made for interaxions-0.0.5.post1.tar.gz:
Publisher:
python-publish.yaml on Hambaobao/interaxions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
interaxions-0.0.5.post1.tar.gz -
Subject digest:
09b24df0d5320629355fe27c150240ca2b92bfbaa831f2dcb02499ef51f0ee04 - Sigstore transparency entry: 780451258
- Sigstore integration time:
-
Permalink:
Hambaobao/interaxions@d23b2950b7de52625d692cf746d36f04072beb76 -
Branch / Tag:
refs/tags/v0.0.5.post1 - Owner: https://github.com/Hambaobao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yaml@d23b2950b7de52625d692cf746d36f04072beb76 -
Trigger Event:
push
-
Statement type:
File details
Details for the file interaxions-0.0.5.post1-py3-none-any.whl.
File metadata
- Download URL: interaxions-0.0.5.post1-py3-none-any.whl
- Upload date:
- Size: 45.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e23186b5eb5560fd876bfc1a5f9c19862a5eb5fa2baa8ddf3b45ae27f494483d
|
|
| MD5 |
cd0cc8d73a683789c347a81124b05f46
|
|
| BLAKE2b-256 |
08ac783c9e2511cfe58cffffa60e0102107b6cc702fb9b934f73583cdb879a16
|
Provenance
The following attestation bundles were made for interaxions-0.0.5.post1-py3-none-any.whl:
Publisher:
python-publish.yaml on Hambaobao/interaxions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
interaxions-0.0.5.post1-py3-none-any.whl -
Subject digest:
e23186b5eb5560fd876bfc1a5f9c19862a5eb5fa2baa8ddf3b45ae27f494483d - Sigstore transparency entry: 780451263
- Sigstore integration time:
-
Permalink:
Hambaobao/interaxions@d23b2950b7de52625d692cf746d36f04072beb76 -
Branch / Tag:
refs/tags/v0.0.5.post1 - Owner: https://github.com/Hambaobao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yaml@d23b2950b7de52625d692cf746d36f04072beb76 -
Trigger Event:
push
-
Statement type: