fractal package#

Subpackages#

Submodules#

fractal.constants module#

Constants for fractal.

fractal.constants.FRACTAL_FOLDER = '.fractal'#

fractal data directory at the repo root

fractal.constants.WORKTREES_FOLDER = '.worktrees'#

directory holding the per-node git worktrees

fractal.constants.PROJECT_FOLDER = '.project'#

immutable project-layout cache under the worktrees directory

fractal.constants.CONFIG_FILE = 'config.json'#

per-node configuration file in the node’s data directory

fractal.constants.DB_FILE = '.db'#

central SQLite database file in the root node’s data directory

fractal.constants.LOCK_FILE = '.lock'#

lock filename, standalone or as a suffix, serializing concurrent access

fractal.constants.PAUSE_ABORT_FILE = '.pause_abort'#

marker signaling the running loop to abort into a pause

fractal.constants.PAUSED_FILE = '.paused'#

tree-wide pause marker beside the central database

fractal.constants.PGID_FILE = '.pgid'#

process group id of the running loop

fractal.constants.SESSION_FILE = '.session'#

agent session records for the node

fractal.constants.SOCKET_FILE = '.socket'#

tmux server socket path of the session running the loop

fractal.constants.STATUS_FILE = '.status'#

the node’s current lifecycle status

fractal.constants.STEP_PGID_FILE = '.step_pgid'#

process group id of the running step

fractal.constants.STATUSES = ('active', 'paused', 'idle', 'completed', 'stopped', 'exited', 'killed', 'failed', 'retired')#

lifecycle status set shared by the node status file and the record rows

fractal.constants.EVENTS = ('init', 'spawn', 'commit', 'approve', 'merge', 'delete', 'orphan', 'start', 'finish', 'finish_cancel', 'stop', 'kill', 'pause', 'resume', 'retire', 'unretire')#

point-in-time event kinds recorded on the node record

fractal.constants.PRIORITY_MIN = 0#

lowest radio message priority

fractal.constants.PRIORITY_MAX = 10#

highest radio message priority

fractal.exceptions module#

Exceptions for fractal.

exception fractal.exceptions.AbstractMethodError(class_or_instance, /, methodtype='method')[source]#

Bases: NotImplementedError

Subclass of NotImplementedError for abstract methods.

To be used when not using the abc module. (adapted from pandas.errors).

Parameters:

Initialize AbstractMethodError, validating methodtype.

Parameters:
exception fractal.exceptions.AgentStreamError[source]#

Bases: RuntimeError

Raised when an agent reports a failure on its own JSON stream.

Distinct from a fractal-side stream-consumer failure: the agent drained cleanly (exit 0) but its events named an error, so the loop books the step as an agent error, not a stream error.

fractal.typing module#

Type hints for fractal.

fractal.typing.PathLike = str | os.PathLike#

filesystem path accepted at boundaries

fractal.typing.Row#

database row (a sqlite3.Row surfaced as a plain dict)

alias of dict[str, Any]

Module contents#

The fractal package.

Hierarchical agent loops with recursive self-organization.