  Considering the $B$-branes over a complex manifold $Y$ as objects of the
bounded derived category $D^b(Y)$, we define holomorphic gauge fields on
$B$-branes and the Yang-Mills functional for these fields.These definitions are
a generalization to $B$-branes of concepts that are well known in the context
of vector bundles. Given ${\mathscr F}^{\bullet}\in D^b(Y),$ we show that the
Atiyah class $$a({\mathscr F}^{\bullet})\in{\rm Ext}^1({\mathscr
F}^{\bullet},\,\Omega^1({\mathscr F}^{\bullet}))$$ is the obstruction to the
existence of gauge fields on ${\mathscr F}^{\bullet}.$ When $Y$ be either the
projective space ${\mathbb P}^n$ or the variety of complete flags in ${\mathbb
C}^3,$ we prove that the cardinal of the set of holomorphic gauge fields on any
$B$-brane over $Y$ is $\leq 1.$ We prove that the set of Yang-Mills fields on
the $B$-brane ${\mathscr F}^{\bullet},$ if it is nonempty, is in bijective
correspondence with the points of an algebraic subset of ${\mathbb C}^m$
defined by $m$ polynomial equations of degree $\leq 3$, where $m={\rm
dim}\,{\rm Ext}^0({\mathscr F}^{\bullet},\,\Omega^1({\mathscr F}^{\bullet})).$
