MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / eval_command

Function eval_command

lib/cli/src/crewai_cli/cli.py:812–870  ·  view source on GitHub ↗

Evaluate this crew through CrewAI AMP, or compare models on the project's deployment (--models). It grades the project's last traced run. When there is none, or the project changed since it, it runs the crew first and grades that run: the run is traced and its trace sent to CrewAI A

(
    ctx: click.Context,
    run_id: str | None,
    models: str | None,
    deployment_id: str | None,
    no_open: bool,
)

Source from the content-addressed store, hash-verified

810)
811@click.pass_context
812def eval_command(
813 ctx: click.Context,
814 run_id: str | None,
815 models: str | None,
816 deployment_id: str | None,
817 no_open: bool,
818) -> None:
819 """Evaluate this crew through CrewAI AMP, or compare models on the project's
820 deployment (--models).
821
822 It grades the project's last traced run. When there is none, or the project
823 changed since it, it runs the crew first and grades that run: the run is
824 traced and its trace sent to CrewAI AMP, which grades it. The first time
825 tracing is turned on for the project, a person at a terminal is asked
826 first; with no terminal (a coding agent, a script) nothing is asked and the
827 command says it turned tracing on, so `crewai eval` alone takes an agent
828 from a change to its verdict. A project that turned tracing off is asked
829 at a terminal, and told how to turn it on without one.
830
831 Run by a script or coding agent (no terminal), it prints a markdown brief
832 after the verdict — what failed and the change to make — so an agent can act
833 on it directly. That is when AMP provides the brief: otherwise its link, when
834 AMP sends only that, else nothing more.
835
836 A run's evaluation exits 0 only when the goal gate PASSED, and 1 otherwise — a
837 failed gate, no verdict, or an evaluation that could not run — so a CI job can
838 gate on it. A comparison exits 0 when it finished, 1 when it failed or could
839 not start.
840
841 `crewai eval export ID` downloads an evaluation's full data as files, for a
842 coding agent to dig into.
843 """
844 if ctx.invoked_subcommand is not None:
845 # The subcommand does the work; an option meant for this body would
846 # otherwise be dropped without a word.
847 if (
848 run_id is not None
849 or models is not None
850 or deployment_id is not None
851 or no_open
852 ):
853 raise click.UsageError(
854 f"`crewai eval {ctx.invoked_subcommand}` takes no --run, --models, "
855 "--deployment or --no-open; give those to `crewai eval` alone."
856 )
857 return
858 if models is not None:
859 if run_id is not None:
860 raise click.UsageError(
861 "--run grades a run that already happened; --models runs the "
862 "deployment again. Give one of them."
863 )
864 eval_models(models, deployment_id=deployment_id, open_report=not no_open)
865 return
866 if deployment_id is not None:
867 raise click.UsageError(
868 "--deployment names the deployment --models runs; add --models LIST."
869 )

Callers

nothing calls this directly

Calls 2

eval_modelsFunction · 0.70
eval_crewFunction · 0.70

Tested by

no test coverage detected