Anatomy of a single agent

In the previous chapter, we discussed a synthesizer that runs worker agents with different capabilities and tooling. One of the worker agents is responsible for analyzing whether a bug is worth being reported. I find this component to be quite critical, as a mistake there may lead to quite a dissatisfaction of users at best or to a missed bug at worst.

This sub-agent is, however, completely sourced from the LLM we use. It hardly has any programmatic logic around it, barely cares about the state of the world, and the only thing we expect from it is a structured output with bugs that it deems worthy of being reported. Unlike a SAST tool, we cannot describe its logic using a flow chart, as to an outsider it appears as a black box. In any case, I had to experiment with the tool a lot. Readers who have worked with such tools hands-on may know the common paths of experimentation: prompt engineering, limiting the context, splitting into multiple agents by function, etc.

The best outcome I achieved, though pricey, was with the worker agents split by function. Instead of doing a lot of work with a rich, omnipotent toolbox and a sizey prompt, a set of focused worker agents solved 40% of issues with false positives and missed bugs. You might encounter this atomicity already: people create a graph of multiple agents with narrow functionalities, such as “analyst” or “judge”. In this chapter, we will look at a simple atomic agent. For the sake of simplicity, we will focus on a worker agent that performs a specific function and has access to a single tool. However, we must keep in mind that an agentic system still requires the agent to be part of the said system, which doesn’t exist in isolation and can autonomously trigger the execution of the worker agent.

Despite the black-box nature of agents, architects still must define their role in a system and draw a flow chart of whatever we try to build. In this chapter, we will discuss the architectural placement, role, and practical architectural properties of an atomic single agent.