A library for agent and environment protocol interactions
Project description
Interaxions
A lightweight, extensible framework for orchestrating AI agents and evaluation environments on Kubernetes/Argo Workflows, inspired by HuggingFace Transformers.
โจ Features
- ๐ฏ XJob-Based Configuration โ Minimal, framework-neutral
XJobschema - ๐ Dynamic Loading โ Load components from local paths or remote Git repositories via
Auto*classes - ๐ Unified Entry File โ Every repository exposes a single
ix.pyentry point - ๐ฆ Three-Layer Architecture โ Scaffolds, Environments, and Workflows as peers
- ๐ท๏ธ Version Control โ Git tags, branches, and commit hashes
- ๐ Multi-Process Safe โ File locking for concurrent cache access
- ๐พ Smart Caching โ Three-level cache for optimal performance
- ๐ Flexible Git Sources โ GitHub, GitLab, Gitea, or any Git service via
IX_ENDPOINT
๐ Quick Start
Installation
# Core
pip install interaxions
# With OSS storage support
pip install interaxions[oss]
# For development
pip install -e ".[dev]"
Defining a Job
XJob is the single source of truth for a unit of work. All component
configurations (scaffold, environment, model, โฆ) live inside
workflow.params โ the workflow itself defines and validates what it needs.
from interaxions import AutoWorkflow
from interaxions.schemas import XJob, WorkflowConfig, RuntimeConfig
job = XJob(
name="fix-django-bug",
description="Run SWE-agent on a SWE-bench instance",
tags=["swe-bench", "django"],
labels={"priority": "high", "team": "research"},
workflow=WorkflowConfig(
repo_name_or_path="Qwen-Agent-Hub/SWE-rollout-verify-postprocess-workflow",
revision="v1.0.0",
params={
# Each workflow defines its own params schema
"scaffold": {
"repo_name_or_path": "Qwen-Agent-Hub/SWE-agent",
"revision": "v1.0.0",
"params": {"max_iterations": 50},
},
"environment": {
"repo_name_or_path": "Qwen-Agent-Hub/SWE-bench",
"revision": "v1.0.0",
"id": "django__django-12345",
"params": {"fix_hack": True},
},
"model": {
"type": "litellm",
"provider": "openai",
"model": "gpt-4o",
"base_url": "https://api.openai.com/v1",
"api_key": "sk-...",
},
},
),
runtime=RuntimeConfig(
namespace="experiments",
service_account="argo-workflow",
ttl_seconds_after_finished=3600,
extra_params={
"labels": {"env": "prod"},
"node_selector": {"gpu": "true"},
},
),
)
# Submit to Argo
workflow_template = AutoWorkflow.from_repo(
job.workflow.repo_name_or_path,
revision=job.workflow.revision,
)
argo_workflow = workflow_template.create_workflow(job)
argo_workflow.create()
๐ Core Concepts
XJob โ Framework-Neutral Configuration
XJob carries only what is universally required:
| Field | Type | Description |
|---|---|---|
job_id |
str (auto) |
Unique identifier (UUID, auto-generated) |
name |
str |
Human-readable name |
tags / labels |
list / dict |
Metadata for search and filtering |
workflow |
WorkflowConfig |
Which workflow repo to load + all workflow-specific params |
runtime |
RuntimeConfig |
Kubernetes / Argo Workflows settings |
extra_params |
dict |
Arbitrary job-level extras (optional) |
Design principle: XJob makes no assumptions about what a workflow needs.
All component configs go into workflow.params; the workflow validates them
with its own Pydantic model.
Three-Layer Architecture
XJob
โโโ workflow.params
โโโ scaffold โ AutoScaffold โ BaseScaffold.create_task()
โโโ environmentโ AutoEnvironmentโ BaseEnvironment.get() + create_task()
โโโ model โ workflow-defined
Scaffold (BaseScaffold)
- Wraps an AI agent (e.g. SWE-agent)
- Implements
create_task(job, environment) โ hera.Task
Environment (BaseEnvironment)
- Wraps a benchmark / evaluation dataset
- Implements
get(id) โ Environment(pure data) andcreate_task(job, environment) โ hera.Task - Credentials (OSS keys, API tokens) are read from environment variables, never passed as parameters
Workflow (BaseWorkflow)
- Orchestrates scaffolds and environments into a full Argo Workflow DAG
- Implements
create_workflow(job) โ hera.Workflow - Defines and validates its own
workflow.paramsschema
Auto Classes โ Dynamic Loading
All three Auto classes share the same interface:
from interaxions import AutoScaffold, AutoEnvironment, AutoWorkflow
# From a remote Git repository (uses IX_ENDPOINT, default: GitHub)
scaffold = AutoScaffold.from_repo("username/swe-agent", revision="v1.0.0")
env_task = AutoEnvironment.from_repo("username/swe-bench", revision="v2.0.0")
workflow = AutoWorkflow.from_repo("username/swe-rollout-verify")
# From a local path (for development / testing)
scaffold = AutoScaffold.from_repo("./my-agent")
env_task = AutoEnvironment.from_repo("/abs/path/to/my-bench")
workflow = AutoWorkflow.from_repo("./my-workflow")
# Private repositories
scaffold = AutoScaffold.from_repo(
"company/private-agent",
username="your-username",
token="ghp_xxxx", # or read from env var
)
Loading rules:
- If the path contains
/,., or~โ treated as a filesystem path or remoteorg/repo - Simple names without path separators are treated as remote
org/repo(withIX_ENDPOINTas host) - Results are cached; pinned revisions (
revision="v1.0.0") are cache-hit on repeat calls
Repository Structure
Every ix-hub repository must contain:
my-component/
โโโ config.yaml # Required โ repo metadata
โโโ ix.py # Required โ exactly one class inheriting from the base class
config.yaml minimum:
repo_type: scaffold # or: environment | workflow
type: my-component # arbitrary identifier, becomes config.type
ix.py pattern (scaffold example):
from interaxions.scaffolds.base_scaffold import BaseScaffold, BaseScaffoldConfig
class MyScaffoldConfig(BaseScaffoldConfig):
type: str = "my-scaffold"
image: str = "my-agent:latest"
class MyScaffold(BaseScaffold):
config_class = MyScaffoldConfig
config: MyScaffoldConfig
def create_task(self, job, environment, **kwargs):
...
ix.py pattern (environment example):
import os
from interaxions.environments.base_environment import BaseEnvironment, BaseEnvironmentConfig
from interaxions.schemas.task import Environment
class MyBenchConfig(BaseEnvironmentConfig):
type: str = "my-bench"
class MyBench(BaseEnvironment):
config_class = MyBenchConfig
def get(self, id: str) -> Environment:
# Read credentials from environment variables
oss_key = os.environ["OSS_ACCESS_KEY_ID"]
data = load_from_oss(id, oss_key)
return Environment(id=id, type=self.config.type, data=data)
def create_task(self, job, environment, **kwargs):
...
ix.py pattern (workflow example):
from pydantic import BaseModel
from interaxions.hub import AutoScaffold, AutoEnvironment
from interaxions.schemas import ScaffoldConfig, EnvironmentConfig
from interaxions.schemas.task import Environment
from interaxions.workflows.base_workflow import BaseWorkflow, BaseWorkflowConfig
class MyWorkflowParams(BaseModel):
scaffold: ScaffoldConfig
environment: EnvironmentConfig
class MyWorkflowConfig(BaseWorkflowConfig):
type: str = "my-workflow"
class MyWorkflow(BaseWorkflow):
config_class = MyWorkflowConfig
def create_workflow(self, job, **kwargs):
params = MyWorkflowParams(**job.workflow.params)
scaffold = AutoScaffold.from_repo(params.scaffold.repo_name_or_path)
env_task = AutoEnvironment.from_repo(params.environment.repo_name_or_path)
env: Environment = env_task.get(params.environment.id)
scaffold_task = scaffold.create_task(job, env)
verify_task = env_task.create_task(job, env)
with hera.Workflow(name=..., namespace=job.runtime.namespace) as wf:
scaffold_task >> verify_task
return wf
๐ง Environment Variables
| Variable | Description | Default |
|---|---|---|
IX_HOME |
Base directory for Interaxions data | ~/.interaxions |
IX_HUB_CACHE |
Cache directory for hub modules | ~/.interaxions/hub |
IX_OFFLINE |
Disable all network access | false |
IX_ENDPOINT |
Git service base URL for remote repos | https://github.com |
Component credentials (OSS keys, HF tokens, API keys) are not stored
in XJob. Environment repo maintainers read them from their own environment
variables at runtime.
๐ฆ Schema Reference
WorkflowConfig
WorkflowConfig(
repo_name_or_path="org/repo", # required
revision="v1.0.0", # optional Git ref
username=None, # optional auth
token=None, # optional auth
params={}, # workflow-defined; shape is up to the workflow
)
RuntimeConfig
RuntimeConfig(
namespace="experiments", # required Kubernetes namespace
service_account=None, # optional
image_pull_policy="IfNotPresent",
active_deadline_seconds=None,
ttl_seconds_after_finished=None,
extra_params={
"labels": {...},
"annotations": {...},
"node_selector": {...},
"tolerations": [...],
"priority_class_name": "...",
},
)
ScaffoldConfig / EnvironmentConfig
Standard vocabulary types you can use inside workflow.params:
from interaxions.schemas import ScaffoldConfig, EnvironmentConfig
scaffold_cfg = ScaffoldConfig(
repo_name_or_path="org/swe-agent",
revision="v1.0.0",
params={"max_iterations": 50},
)
env_cfg = EnvironmentConfig(
repo_name_or_path="org/swe-bench",
id="django__django-12345", # required instance id
params={"fix_hack": True},
)
Environment (data carrier)
Returned by BaseEnvironment.get(id):
from interaxions.schemas.task import Environment
env = env_task.get("django__django-12345")
env.id # "django__django-12345"
env.type # "swe-bench"
env.data # {"problem_statement": "...", "repo": "...", ...}
Workflows can define typed subclasses for safe field access:
class SWEEnvironment(Environment):
fix_hack: bool = False
@classmethod
def from_environment(cls, env: Environment, env_config: EnvironmentConfig) -> "SWEEnvironment":
return cls(
id=env.id, type=env.type, data=env.data,
fix_hack=env_config.params.get("fix_hack", False),
)
๐งช Testing
# Run all tests
pytest
# By category
pytest -m unit # Fast isolated unit tests
pytest -m integration # Component loading tests (local repos)
pytest -m e2e # End-to-end pipeline tests
# With coverage
pytest --cov=interaxions --cov-report=html
open htmlcov/index.html
The test suite uses local mock repositories in tests/fixtures/mock_repos/
(no network access required):
| Mock Repo | Entry Class | Purpose |
|---|---|---|
test-scaffold/ |
TestScaffold |
Test AutoScaffold loading |
test-environment/ |
TestEnvironment |
Test AutoEnvironment loading + get() |
test-workflow/ |
TestWorkflow |
Test AutoWorkflow loading + template loading |
๐ Project Structure
interaxions/
โโโ scaffolds/
โ โโโ base_scaffold.py # BaseScaffold + BaseScaffoldConfig
โ โโโ __init__.py
โโโ environments/
โ โโโ base_environment.py # BaseEnvironment + BaseEnvironmentConfig
โ โโโ __init__.py
โโโ workflows/
โ โโโ base_workflow.py # BaseWorkflow + BaseWorkflowConfig
โ โโโ __init__.py
โโโ schemas/
โ โโโ job.py # XJob
โ โโโ workflow.py # WorkflowConfig
โ โโโ runtime.py # RuntimeConfig
โ โโโ scaffold.py # ScaffoldConfig
โ โโโ environment.py # EnvironmentConfig
โ โโโ task.py # Environment (data carrier)
โ โโโ models.py # OpenAIModel, AnthropicModel, LiteLLMModel
โโโ hub/
โโโ auto.py # AutoScaffold, AutoEnvironment, AutoWorkflow
โโโ hub_manager.py # Git clone / checkout / caching
โโโ constants.py
tests/
โโโ unit/ # Schema and model unit tests
โโโ integration/ # Auto* loading tests (local mock repos)
โโโ e2e/ # Full pipeline tests
โโโ fixtures/
โ โโโ mock_repos/
โ โโโ test-scaffold/ # ix.py + config.yaml
โ โโโ test-environment/ # ix.py + config.yaml
โ โโโ test-workflow/ # ix.py + config.yaml + templates/
โโโ conftest.py
๐ Development
# Setup
git clone https://github.com/Hambaobao/interaxions.git
cd interaxions
pip install -e ".[dev]"
# Test
pytest -m unit # fastest
pytest # all tests
# Coverage
pytest --cov=interaxions --cov-report=term-missing
๐ Documentation
- Repository Standards โ How to create custom
ix-hubrepos - XJob User Guide โ Detailed XJob usage patterns
๐ค Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass:
pytest - 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
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.10.tar.gz.
File metadata
- Download URL: interaxions-0.0.10.tar.gz
- Upload date:
- Size: 46.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3ac88ed2f01abbcaa58b7e9b62a4fb7e74ca1c1894c8939750d0470681b80e1
|
|
| MD5 |
022c48b71a8acce15720ea128d8fe147
|
|
| BLAKE2b-256 |
a0c199e4244af72b529bff96ef2f5d089f98e5d12354250f900530fae3afd73e
|
Provenance
The following attestation bundles were made for interaxions-0.0.10.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.10.tar.gz -
Subject digest:
f3ac88ed2f01abbcaa58b7e9b62a4fb7e74ca1c1894c8939750d0470681b80e1 - Sigstore transparency entry: 1015989317
- Sigstore integration time:
-
Permalink:
Hambaobao/interaxions@7c3575c20577e686089029861041b9dd3322eb3d -
Branch / Tag:
refs/tags/v0.0.10 - Owner: https://github.com/Hambaobao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yaml@7c3575c20577e686089029861041b9dd3322eb3d -
Trigger Event:
push
-
Statement type:
File details
Details for the file interaxions-0.0.10-py3-none-any.whl.
File metadata
- Download URL: interaxions-0.0.10-py3-none-any.whl
- Upload date:
- Size: 34.4 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 |
83562269a2c576885c90bd8524acecaa73678e70c9eef5590ef3c0333f7522a3
|
|
| MD5 |
1b9276ae06c1c1f0686b55e8e7023b8e
|
|
| BLAKE2b-256 |
26b6c6ca3cd75d350f6d551feff9592eac343419f74c45fb18d4a806bbcb3f16
|
Provenance
The following attestation bundles were made for interaxions-0.0.10-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.10-py3-none-any.whl -
Subject digest:
83562269a2c576885c90bd8524acecaa73678e70c9eef5590ef3c0333f7522a3 - Sigstore transparency entry: 1015989330
- Sigstore integration time:
-
Permalink:
Hambaobao/interaxions@7c3575c20577e686089029861041b9dd3322eb3d -
Branch / Tag:
refs/tags/v0.0.10 - Owner: https://github.com/Hambaobao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yaml@7c3575c20577e686089029861041b9dd3322eb3d -
Trigger Event:
push
-
Statement type: