definitions
agent_cover.instrumentation.definitions
Configuration classes for instrumentation targets.
Classes
TargetConfig
dataclass
Represents the configuration for a target to be instrumented.
This dataclass holds information about a specific target, including the module and class name, methods to instrument, and optional parameters and version constraints.
Attributes:
| Name | Type | Description |
|---|---|---|
module |
str
|
The module where the target class or function is located. |
class_name |
str
|
The name of the class or function to instrument. |
methods |
Union[Dict[str, str], List[str], None]
|
Methods to instrument, or None if not applicable. Can be a Dict (e.g., agent strategies) or a List (e.g., method names for prompts/tools). Defaults to None. |
params |
Dict[str, Any]
|
Additional parameters specific to the instrumentor (e.g., type="render" for promptflow). Defaults to an empty dictionary. |
min_version |
Optional[str]
|
Minimum version of the package required for instrumentation. Defaults to None. |
max_version |
Optional[str]
|
Maximum version of the package supported for instrumentation. Defaults to None. |
Methods:
| Name | Description |
|---|---|
from_dict |
Creates a TargetConfig instance from a dictionary. |
Source code in src/agent_cover/instrumentation/definitions.py
Functions
from_dict(data)
classmethod
Creates a TargetConfig instance from a dictionary.
This class method allows creating a TargetConfig object from a dictionary, handling potential type conversions and default values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Dict[str, Any] | TargetConfig
|
A dictionary containing the target configuration data or an existing TargetConfig object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
TargetConfig |
TargetConfig
|
A TargetConfig object initialized from the data. |