2. The incenter of $\triangle A B C$ is $I$, and the angle bisector of $\angle B$ intersects $A C$ at point $P$. If $A P+A B=B C$, and $A B=3, B C=$ 5, then the value of $A I$ is $\qquad$ .
2.2.

As shown in Figure 7, on segment $B C$, take $B A^{\prime}=B A$, extend $A I$ to intersect $B C$ at $Q$, and connect $P A^{\prime}$.
$$
\begin{array}{l}
\text { Given } B A^{\prime}=B A, \\
\angle A B P=\angle A^{\prime} B P, \\
B P=B P,
\end{array}
$$

we have $\triangle A B P \cong \triangle A^{\prime} B P$.
Thus, $A^{\prime} P=A P=B C-B A=B C-B A^{\prime}=A^{\prime} C$.
Therefore, $\angle A^{\prime} P C=\angle C$.
Since $\angle B A C=\angle B A^{\prime} P=\angle C+\angle A^{\prime} P C=$ $2 \angle C$, we have
$$
\begin{array}{l}
\angle A P B=\angle P B C+\angle C \\
=\frac{1}{2} \angle B+\angle C=\frac{1}{2}(\angle B+\angle A). \\
\text { Also, } \angle A I P=\angle I A B+\angle I B A \\
=\frac{1}{2}(\angle A+\angle B),
\end{array}
$$

Thus, $\angle A P B=\angle A I P$, and $A I=A P$.
Since $A P=B C-A B=5-3=2$, we have $A I=2$.