Skip to main content
Environment Node Node inspector for a Code Evaluator node

Parameters

Source Code
string
required
Python code that evaluates the agent. Your code must update the score (float) and feedback (string) variables. The default value for this parameter is:
Default evaluator code
score = 1.0
feedback = "Good job!"
You can access upstream node outputs by node ID. For example:
Accessing upstream node outputs
agent_output = Agent.output
score = 1.0 if len(agent_output) < 50 else 0.0
feedback = "Good job!" if score else "Output too long."
In the above example, Agent is the ID of an upstream node with an output port.

Inputs

Input
any
The input passed to the evaluator.

Outputs

Output
json
Evaluation result with score and feedback.
FieldDescription
scoreNumeric score for the evaluation.
feedbackNatural language feedback for the evaluation.