
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Given the function $f(x)=\frac{1}{3}{x^3}+a{x^2}+3x+b(a,b\in R)$ attains a maximum value of $2$ at $x=1$.  
$(1)$ Find the values of $a$ and $b$;  
$(2)$ If the equation $f\left(x\right)=-x^{2}+6x+k$ has three distinct real roots, find the range of real number $k$.

Present the answer in LaTex format: \boxed{Your answer}
user