Skip to main content
Load your own Benchmark, Harness, Environment, Recipe, or Analyzer into AgentCompass without changing its source code. List the Python files, packages, or modules that register your components, and AgentCompass imports them before it looks up component IDs.

Before You Start

This page explains how to load components that you have already written. To write one, start with the matching developer guide: Those guides are written for contributors, so some steps, such as placing files under src/agentcompass/, apply only to components that you submit to the repository. For a private component, follow the same component contract (base class, registration decorator, and parameters), keep your code in your own project, and load it with the steps on this page.

Quick Start

Write a module that registers your component. This example registers an Analyzer that flags empty final answers:
Declare the file in a configuration file. A relative path here is resolved from the folder that contains the configuration file:
Confirm that AgentCompass finds the component:
The output includes EmptyAnswerAnalyzer. You can also skip the configuration file and pass the file directly with --custom-import ./components.py.

Choose What to Import

Every entry in custom_imports is a plain string. AgentCompass checks it in the following order to decide how to load it: Any other value is an error.

Single File

Use a file for a small, self-contained component. AgentCompass does not add the file’s folder to the module search path, so the file cannot import its neighbors by name, and relative imports such as from . import helpers do not work. Standard-library and installed packages import normally. If your component needs several files, use a package.

Package Directory

Use a package when your component spans several files. AgentCompass runs only the package’s __init__.py and does not scan the directory, so import every module that registers a component there:
Use relative imports inside the package, as shown above. Importing the package by its folder name, such as import component_package, does not give you the package that AgentCompass loaded. If two packages need to refer to each other, put them under one parent package and import only the parent.

Installed Module

Use a module name when your components ship as an installed Python package, for example from your team’s private package index. The module must be importable in the Python environment that runs AgentCompass.

Declare Imports

You can declare imports in four places. Use whichever fits how you run AgentCompass, or combine them. The SDK options are described in Python SDK. Configuration files come from the same three sources as every other setting: the user-level config.yaml, the nearest project config.yaml, and each --config file. See Override Order for where AgentCompass looks for them.

Load Order

AgentCompass loads imports in this order:
  1. All built-in components, so a custom component cannot reuse a built-in ID.
  2. Imports from configuration files: the user-level file, the project-level file, then each --config file in the order given.
  3. Imports from the orchestration file (launch only).
  4. Imports from --custom-import, in the order given.
Entries that resolve to the same file, directory, or module name run only once. Most list settings in configuration files are replaced by the higher-priority file, but custom_imports is an exception: entries from every layer are added together. If an import fails or a component ID is already taken, the command stops with an error instead of skipping the entry.

Use the Options in Commands

These commands accept repeatable --config <path> and --custom-import <entry> options:
  • run and launch
  • summary and analysis
  • every list subcommand, including list dump
  • config show and config docs
  • env close
For example, check that a Benchmark from an installed module is registered:
list and config docs read only runtime.custom_imports from your configuration files and ignore their other settings. A YAML syntax error, an invalid entry, or an import that fails still stops the command. When no custom imports are configured, these commands load only the built-in components of the kind you asked about.

Recipes

A Recipe class decorated with @RECIPES.register() in an imported module joins the Recipe registry for every run that loads the import. AgentCompass then applies it to each task where its matches() method returns True. To limit which Recipes can apply, pass --recipe <id>, which works as an allowlist. To load a Recipe for selected runs only, use --recipe-dir instead. It takes a package that lists its classes in RECIPE_CLASSES and does not use the decorator. See Recipes.

Summarize or Analyze Existing Results

Every run records the imports it used in run_info.json, so you can see where its components came from. summary and analysis do not import those records again. They use only the imports from your current configuration and command line, so opening a results folder never runs code that is saved inside it. If the results use a custom component, declare it again in the command:
Without the import, the command stops with an unknown-component error. The same applies to summary --dry-run. With the default analyzers: null, analysis considers only the Analyzers registered at that moment. To use a custom Analyzer, import it as shown above. Naming its ID in analysis_params.analyzers does not load its source code.

Import Only Code You Trust

An import runs the Python code in that file, package, or module with your permissions. This is true for every command that accepts the options, including list, config docs, and summary --dry-run. Add only sources you trust, and watch for changes to the import lists in shared configuration files.