The real numbers $x,y,z$ satisfy $x^2+y^2+z^2=3.$ Prove that the inequality
$x^3-(y^2+yz+z^2)x+yz(y+z)\le 3\sqrt{3}.$
and find all triples $(x,y,z)$ for which equality holds.
Given the real numbers \( x, y, z \) satisfy \( x^2 + y^2 + z^2 = 3 \). We need to prove the inequality:
\[ x^3 - (y^2 + yz + z^2)x + yz(y + z) \leq 3\sqrt{3} \]
and find all triples \((x, y, z)\) for which equality holds.

First, let's rewrite the expression:
\[ x^3 - (y^2 + yz + z^2)x + yz(y + z) \]

We will consider the cases based on the signs of \( x+y+z \), \( x-y \), and \( x-z \).

### Case 1: None of \( x+y+z \), \( x-y \), \( x-z \) are negative
By the Arithmetic Mean-Geometric Mean (AM-GM) inequality:
\[ (x+y+z)(x-y)(x-z) \leq \left( \frac{(x+y+z) + (x-y) + (x-z)}{3} \right)^3 = x^3 \]

Given \( |x| \leq \sqrt{3} \), we have:
\[ x^3 \leq |x|^3 \leq 3\sqrt{3} \]

Equality holds when \( (x, y, z) = (\sqrt{3}, 0, 0) \).

### Case 2: Exactly two of \( x+y+z \), \( x-y \), \( x-z \) are negative
We consider the subcases:

#### Subcase 2.1: \( (x+y+z, x-y, x-z) = (+, -, -) \)
\[ (x+y+z)(x-y)(x-z) \leq \left( \frac{(x+y+z) + (y-x) + (z-x)}{3} \right)^3 = \left( \frac{2y + 2z - x}{3} \right)^3 \]

We need to prove:
\[ 2y + 2z - x \leq 3\sqrt{3} \]

Since \( (y+z)^2 \leq 2(y^2 + z^2) = 2(3 - x^2) \), we have:
\[ y+z \leq \sqrt{2(3 - x^2)} \]

Thus:
\[ 2\sqrt{2(3 - x^2)} \leq x + 3\sqrt{3} \]

Squaring both sides:
\[ 8(3 - x^2) \leq x^2 + 6\sqrt{3}x + 27 \]

Simplifying:
\[ 0 \leq 3(\sqrt{3}x + 1)^2 \]

This is always true.

#### Subcase 2.2: \( (x+y+z, x-y, x-z) = (-, +, -) \)
\[ (x+y+z)(x-y)(x-z) \leq \left( \frac{(-x-y-z) + (x-y) + (z-x)}{3} \right)^3 = \left( \frac{-x-2y}{3} \right)^3 \]

Given \( \frac{-x-2y}{3} \leq \max\{|x|, |y|, |z|\} \leq \sqrt{3} \), we are done.

#### Subcase 2.3: \( (x+y+z, x-y, x-z) = (-, -, +) \)
This can be handled similarly to the previous subcases.

Thus, we have shown that:
\[ x^3 - (y^2 + yz + z^2)x + yz(y + z) \leq 3\sqrt{3} \]

Equality holds when \( (x, y, z) = (\sqrt{3}, 0, 0) \).

The final answer is \( \boxed{ (\sqrt{3}, 0, 0) } \)