In The Matrix, Morpheus and his team take Neo to see the Oracle in "The Matrix". Not until after the visit is concluded are they ambushed by Agents. Other times, such as the beginning of the movie where Trinity talks to Neo, or when Trinity takes Neo to Morpheus, they seem to be unharassed by Agents. How could this be? The Agents certainly know Morpheus, Trinity, and Neo are threats. And it seems implausible that Agents are not immediately aware whenever they enter "The Matrix". So why aren't they attacked right away (aside from that ruining the movie)?
Agents are certainly aware of what humans see, but only under certain circumstances, which appears to be related to whether what the person sees is normal or not. For example, near the end of the first movie, a tramp sees Neo, Morpheus and Trinity enter the train station:
They then make a phone call, and suddenly, one of them disappears right in front of his eyes! He is absolutely stunned:
Then at this moment, we go into a closeup shot of Agent Smith's earpiece, and he turns to the camera to suggest he knows what just happened:
I believe this is supposed to indicate that the shock which seeing something impossible happens is what causes the agents to be notified, as only Anomalies (As The Architect calls them) and freed humans are shown to exhibit this behaviour.
Compare this to other scenes where Neo is seen by humans connected to the Matrix, such as when he and Trinity enter the lobby of their building. If the agents were aware of every human thought, they would instantly have shown up to kill them.
In addition to Crowd T Robot's great answer about how agents detect them:
It probably helps to think of the protagonists entering the Matrix as a virus infiltrating a system through a security hole. It can remain undetected for a long time, unless you know exactly where to look for it or it starts messing with the system. Morpheus and Co know how to enter the Matrix undetected and stay under the Agents' radar for a long time. They train for it in the simulator and try to not draw any attention to themselves when they are on a mission. That way they are indistinguishable from the other humans in the matrix.
That is the reason the Agents don't discover them upon arrival. They seem to be able to hide their entry into the matrix through hacking and finding them would probably mean checking every human in the matrix manually, which would take an enormous amount of resources. That is also the reason why free humans try to avoid staying in the matrix for extended amount of times. The longer they stay, the larger there risk of exposure becomes.