agentic_fabric.core.decomposer

Framework decomposition - auto-detect and select AI framework.

This module provides the core capability of agentic-fabric: declaring fabric agents once and running them on CrewAI, LangGraph, or Strands depending on what’s installed. It also supports single-agent CLI runners for simpler tasks.

Usage: from agentic_fabric.core.decomposer import get_runner, detect_framework

# Auto-detect best framework for multi-agent
framework = detect_framework()

# Get runner for that framework
runner = get_runner(framework)

# Or let it auto-select
runner = get_runner()  # Uses best available

# Get single-agent CLI runner
from agentic_fabric.core.decomposer import get_cli_runner
runner = get_cli_runner("aider")

Module Contents

Functions

is_framework_available

Check if a framework is installed and importable.

detect_framework

Detect the best available AI framework.

get_available_frameworks

Get list of all available frameworks.

get_runner

Get a runner for the specified or auto-detected framework.

get_cli_runner

Get a single-agent CLI runner for the specified profile.

get_available_cli_runners

Get list of available CLI runner profiles.

get_framework_info

Return lazy runtime registry metadata with current availability.

is_cli_runner_available

Check if a CLI runner profile is available (tool installed).

compose_fabric_agent

Compose a fabric agent configuration into a runtime-specific object.

run_fabric_agent_auto

Run a fabric agent using the best available framework.

Data

API

agentic_fabric.core.decomposer.FRAMEWORK_PRIORITY = 'runtime_names(...)'
agentic_fabric.core.decomposer.is_framework_available(framework: str) bool

Check if a framework is installed and importable.

Args: framework: Framework name (crewai, langgraph, strands)

Returns: True if framework is available

agentic_fabric.core.decomposer.detect_framework(preferred: str | None = None) str

Detect the best available AI framework.

Args: preferred: Optional preferred framework. If available, use it.

Returns: Name of the best available framework.

Raises: RuntimeError: If no frameworks are installed.

agentic_fabric.core.decomposer.get_available_frameworks() list[str]

Get list of all available frameworks.

Returns: List of framework names that are installed.

agentic_fabric.core.decomposer.get_runner(framework: str | None = None) agentic_fabric.runners.base.BaseRunner

Get a runner for the specified or auto-detected framework.

Args: framework: Framework name or None for auto-detect.

Returns: Runner instance for the framework.

Raises: RuntimeError: If framework not available. ValueError: If unknown framework specified.

agentic_fabric.core.decomposer.get_cli_runner(profile: str | dict[str, Any], model: str | None = None) agentic_fabric.runners.single_agent_runner.SingleAgentRunner

Get a single-agent CLI runner for the specified profile.

Args: profile: Profile name (e.g., “aider”, “claude-code”, “ollama”) or custom config dict. model: Optional model override.

Returns: LocalCLIRunner instance for the profile.

Raises: ValueError: If profile not found. FileNotFoundError: If profiles file missing.

Examples: # Use built-in profile runner = get_cli_runner(“aider”) result = runner.run(“Add error handling to auth.py”)

# Use with model override
runner = get_cli_runner("ollama", model="deepseek-coder")
result = runner.run("Fix the bug")

# Use custom config
runner = get_cli_runner({
    "command": "my-tool",
    "task_flag": "--task",
    "auto_approve": "--yes",
})
agentic_fabric.core.decomposer.get_available_cli_runners() list[str]

Get list of available CLI runner profiles.

Returns: List of profile names (e.g., [“aider”, “claude-code”, “ollama”]).

agentic_fabric.core.decomposer.get_framework_info(framework: str | None = None) list[dict[str, Any]] | dict[str, Any]

Return lazy runtime registry metadata with current availability.

agentic_fabric.core.decomposer.is_cli_runner_available(profile: str) bool

Check if a CLI runner profile is available (tool installed).

Args: profile: Profile name to check.

Returns: True if the tool is installed and accessible.

agentic_fabric.core.decomposer.compose_fabric_agent(fabric_agent_config: dict[str, Any], framework: str | None = None) Any

Compose a fabric agent configuration into a runtime-specific object.

This is the core function that converts a framework-agnostic fabric agent definition into a runnable fabric agent for the target framework.

Args: fabric_agent_config: Fabric agent configuration from loader. framework: Target framework or None for auto-detect. If fabric_agent_config has required_framework, that takes precedence.

Returns: Runtime-specific fabric agent object ready to run.

Raises: RuntimeError: If required framework is not available.

agentic_fabric.core.decomposer.run_fabric_agent_auto(fabric_agent_config: dict[str, Any], inputs: dict[str, Any] | None = None, framework: str | None = None) str

Run a fabric agent using the best available framework.

Args: fabric_agent_config: Fabric agent configuration from loader. inputs: Optional inputs for the fabric agent. framework: Optional framework override. If fabric_agent_config has required_framework (from .crewai/.strands/.langgraph dir), that takes precedence.

Returns: Fabric agent output as string.

Raises: RuntimeError: If required framework is not available. ValueError: If requested framework conflicts with required framework.