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

Function eval_command

lib/cli/src/crewai_cli/cli.py:821–879  ·  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

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

Callers

nothing calls this directly

Calls 2

eval_modelsFunction · 0.70
eval_crewFunction · 0.70

Tested by

no test coverage detected