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:EmptyAnswerAnalyzer. You can also skip the configuration file and pass the file directly with --custom-import ./components.py.
Choose What to Import
Every entry incustom_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 asfrom . 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:
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:- All built-in components, so a custom component cannot reuse a built-in ID.
- Imports from configuration files: the user-level file, the project-level file, then each
--configfile in the order given. - Imports from the orchestration file (
launchonly). - Imports from
--custom-import, in the order given.
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:
runandlaunchsummaryandanalysis- every
listsubcommand, includinglist dump config showandconfig docsenv close
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 inrun_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:
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, includinglist, config docs, and summary --dry-run. Add only sources you trust, and watch for changes to the import lists in shared configuration files.