This is (obviously) up for debate. If you speak about agents, one common definition of agents is:
autonomy: agents operate without the direct intervention of humans or others, and have some kind of control over their actions and internal state;
social ability: agents interact with other agents (and possibly humans) via some kind of agent-communication language [Genesereth and Ketchpel, 1994];
reactivity: agents perceive their environment, (which may be the physical world, a user via a graphical user interface, a collection of other agents, the INTERNET, or perhaps all of these combined), and respond in a timely fashion to changes that occur in it;
pro-activeness: agents do not simply act in response to their environment, they are able to exhibit goal-directed behaviour by taking the initiative.
There is also the BDI model using the concepts belief, desire and intention for intelligent agents.
If you go further away from "agents" (this term has a specific meaning in computer science as it's also part of a software engineering paradigm) to "what makes a piece of code intelligent?" You'll see that every research area will give you a different answer. Artificial intelligence distinguishes between hard and soft AI. Neuroinformatics takes its answers from cognitive science, importing the definitions that biopsychology and neuro science give about cognition and what makes a being "intelligent". A philosopher will also have a different definition.
These definitions all have some common ground but in the end there is no ultimate definition everybody can agree on.