Python API¶
Reference for the agent_eval package, generated from the source docstrings and type
hints. Most users drive the harness through the slash commands and
eval.yaml — this page is for extending it (for example, writing a
custom runner) or embedding it in your own tooling.
Autodoc
These entries are rendered by
mkdocstrings. The documentation build runs
pip install -e . so the package is importable; add more ::: directives to this
page to surface additional modules.
Configuration¶
The entire eval.yaml surface is parsed into EvalConfig. See the
eval.yaml reference for the YAML-level documentation of every field.
agent_eval.config.EvalConfig
dataclass
¶
EvalConfig(name='', description='', skill=None, permissions=dict(), hooks=HooksConfig(), execution=ExecutionConfig(), runner=RunnerConfig(), models=ModelsConfig(), mlflow=MlflowConfig(), dataset=DatasetConfig(), generation=GenerationConfig(), outputs=list(), inputs=InputsConfig(), traces=TracesConfig(), judges=list(), reward=None, thresholds=dict(), config_dir=None, config_path=None, model='', subagent_model='', run_id='', baseline='')
Complete evaluation suite configuration.
Structure is schema-driven: dataset and output structures are described in natural language. The harness interprets these descriptions via LLM (once, cached) to drive prepare, collect, and score steps.
project_root
property
¶
Project root directory (always CWD, not the eval.yaml location).
eval_name
¶
Derive eval identifier with backward-compatible fallback chain.
Priority order (backward-compatible with existing skill evals): 1. skill field - preserves existing skill-based eval runs 2. name field - allows explicit naming for prompt-mode evals 3. directory/filename - pure path-based derivation 4. "eval" - final fallback
This ensures existing skill evals continue to work while enabling prompt mode to use either explicit names or path-based identifiers.
Source code in agent_eval/config.py
from_yaml
classmethod
¶
Load config from a YAML file.
Source code in agent_eval/config.py
643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 | |
is_prompt_mode
¶
resolve_path
¶
Resolve a path relative to the config file's directory.
Absolute paths are returned as-is. Relative paths resolve against config_dir (falling back to cwd when config_dir is None).
Source code in agent_eval/config.py
resolve_skill
¶
Canonical skill name for skill mode, or None for prompt mode.
Prefers execution.skill (the current location) and falls back to
the deprecated top-level skill field. Returns None when neither
is set — i.e. prompt mode or an unconfigured target. All execution
substrates (local, Harbor, EvalHub) MUST resolve the target through
this method so a config authored with only execution.skill runs
the skill instead of silently degrading to prompt mode.
Source code in agent_eval/config.py
Runners¶
A runner adapts a generic evaluation call to a specific agent runtime and returns a
normalized RunResult. To support a new agent,
subclass EvalRunner, implement the three abstract members below, and register it in
the RUNNERS registry — see Runners.
class EvalRunner(ABC):
"""Abstract runner -- one implementation per agent platform."""
@classmethod
@abstractmethod
def from_config(cls, config, *, log_prefix=None, **overrides):
"""Construct a runner from an EvalConfig."""
@property
@abstractmethod
def name(self) -> str:
"""Short identifier for this runner (e.g. 'claude-code')."""
@abstractmethod
def execute(self, target, args, workspace, model, ...) -> RunResult:
"""Run one invocation and return a normalized RunResult."""
Every runner returns the same normalized result, so scoring and reporting are runner-agnostic:
agent_eval.agent.base.RunResult
dataclass
¶
RunResult(exit_code, stdout, stderr, duration_s, token_usage=None, cost_usd=None, num_turns=None, resolved_model=None, models_used=None, per_model_usage=None, per_model_turns=None, permission_denials=None, raw_output=None)
Result of a single skill invocation.