[BUG] Unmatched curly braces should not be taken as interpolation
Description
Similar to this issue: https://github.com/crewAIInc/crewAI/issues/528 , I am trying to use JSON as the expected output in tasks.yaml file. However the curly braces in JSON will be taken as interpollation string and it will throw exception as below:
ValueError: unmatched '{' in format spec
An error occurred while running the crew: Command '['uv', 'run', 'run_crew']' returned non-zero exit status 1.
Steps to Reproduce
- Put some json code in tasks.yaml, .e.g
...
expected_output: >
You should return the JSON format as below:
{
"action":"<action_name>",
"message":"<message_content>"
}
...
- Run the crew
Expected behavior
If found a mismatched curly brace, it should be ignored from the interpolation, instead of throwing error. This will be very helpful to specify expected JSON format in those YAML files.
Screenshots/Code snippets
read_intention_task:
description: >
Read the user's intentions: {intention}. Return the most relevant action and context information
expected_output: >
You need to return the action and context information in the following format:
action:
operate_task: description: > Review the action and context you got and return the JSON format representation for the action and parameters. Here are detailed definition of each action.
expected_output: >
You should return the JSON format as below:
yaml { "action":"<action_name>", "message":"<message_content>" }
agent: operator
Operating System
macOS Sonoma
Python Version
3.12
crewAI Version
0.86.0
crewAI Tools Version
0.17.0
Virtual Environment
Venv
Evidence
Possible Solution
If found a mismatched curly brace, it should be ignored from the interpolation, instead of throwing error. This will be very helpful to specify expected JSON format in those YAML files.
Additional context
N/A