mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-01 05:08:12 +00:00
Let a Flow method run trusted inline Python with `call: script`. The code
is compiled once into a generated function and receives the runtime
values as arguments — state, outputs, input, and item — so nothing is
interpolated into the source. This is not sandboxed.
Also extracts the shared `outputs_by_name` helper into `runtime/_outputs`
so the script action and the expression evaluator build the outputs map
the same way, including each-iteration local outputs.
```yaml
methods:
normalize:
start: true
do:
call: script
code: |
import math
state["rounded"] = math.ceil(state["raw_score"])
return f"rounded:{state['rounded']}"
```
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>