
\begin{center}
\begin{tikzpicture}[
    font=\small,
    % line width=0.9pt,
    box/.style={
        draw,
        rounded corners=3pt,
        minimum width=3.1cm,
        minimum height=1.35cm,
        align=center,
        font=\normalsize
    },
    neuron/.style={
        circle,
        draw=black!55,
        minimum size=7mm,
        inner sep=0pt
    },
    conn/.style={
        draw=black!65,
        line width=0.5pt
    },
    flow/.style={
        draw=black,
        -Latex,
        line width=0.9pt
    }
]

% =========================================================
% Left part: Environment-Agent interaction
% =========================================================
\node[
    anchor=center,
    draw,
    thick,
    minimum width=3.0cm,
    minimum height=1.0cm,
    fill=white,
    drop shadow={
        fill=gray!40,
        shadow xshift=0.6ex,
        shadow yshift=-0.6ex
    }
] (env) at (0,0) {\large Environment};
\node[anchor=center,draw, minimum width=3.0cm, minimum height=1.0cm, fill=white, drop shadow={
        fill=gray!40,
        shadow xshift=0.6ex,
        shadow yshift=-0.6ex
    }
] (agent) at (5.2,0) {\large Agent};

% top arc: state
\draw[->]
    ($(env.north west)+(1.6,0.05)$)
    to[out=45,in=135]
    node[pos=0.15, above, font=\large] {$S_t$}
    ($(agent.north east)+(-1.6,0.05)$);

% middle arc: reward
\draw[->]
    ($(env.north east)+(0.02,0.10)$)
    to[out=20,in=160]
    node[midway, above=2pt] {\large $r_t$}
    ($(agent.north west)+(-0.02,0.10)$);

% bottom arc: action
\draw[->]
    ($(agent.south west)+(-0.02,-0.10)$)
    to[out=200,in=340]
    node[midway, below=2pt] {\large $a_t$}
    ($(env.south east)+(0.02,-0.10)$);

% connector to policy net
\draw[dashed, line width=0.9pt, ->]
    ($(agent.east)+(0.10,0.00)$)
    .. controls +(1.0,0.45) and +(-0.9,0.25)
    .. ($(8.6,0.15)$);

% =========================================================
% Right part: Policy network
% =========================================================

% input layer
\foreach \i/\x in {1/9.3,2/10.1,3/10.9,4/11.7}
{
    \node[neuron, fill=gray!25, minimum size=4mm] (I\i) at (\x,-1.15) {};
}

% hidden layer
\foreach \i/\x in {1/9.1,2/9.8,3/10.5,4/11.2,5/11.9}
{
    \node[neuron, fill=blue!30, minimum size=4mm] (H\i) at (\x,0.05) {};
}

% output layer
\foreach \i/\x in {2/9.8,4/11.2}
{
    \node[neuron, fill=yellow!45, minimum size=4mm] (O\i) at (\x,1.35) {};
}

% connections: input -> hidden
\foreach \i in {1,2,3,4}
{
    \foreach \j in {1,2,3,4,5}
    {
        \draw[conn] (I\i) -- (H\j);
    }
}

% connections: hidden -> output
\foreach \i in {1,2,3,4,5}
{
    \foreach \j in {2,4}
    {
        \draw[conn] (H\i) -- (O\j);
    }
}

% arrows below input layer
\foreach \i in {1,2,3,4}
{
    \draw [->] ($(I\i.south)+(0,-0.36)$) -- ($(I\i.south)+(0,-0.02)$);
}

% \draw [->] ([yshift=0.2cm]\x.center) -- ([yshift=0.55cm]\x.center);

% arrows above output layer
\foreach \i in {2,4}
{
    \draw[->] ($(O\i.north)+(0,0.02)$) -- ($(O\i.north)+(0,0.42)$);
}

% dashed rounded frame around policy net
\node[
    draw=gray!70,
    dashed,
    rounded corners=5pt,
    minimum width=5.0cm,
    minimum height=4.0cm,
    inner xsep=0.85cm,
    inner ysep=1.00cm
] (policybox) at (11.2, 0.2){};

% labels
\node[anchor=west] at (10.6, -2.2) {Policy};

\node[anchor=center, font=\small] at ($(policybox.east)+(-0.9, 1.15)$) {Output};
\node[anchor=center, font=\small] at ($(policybox.east)+(-0.9, -0.1)$) {Hidden};
\node[anchor=center, font=\small] at ($(policybox.east)+(-0.9, -1.4)$) {Input};

\end{tikzpicture}
\end{center}