Agent Architecture
This page describes the parts an agent is made of and how they fit together. Each part has its own page.
Overview
When a conversation or an agentic execution needs an agent, a builder assembles it from the agent’s configuration. The agent class declares its own settings, such as its system prompt and tools, and the framework adds defaults for the rest: the classes used for the injector, repositories, registries and memory. The default builder creates all of these parts and hands them to the agent.
| Part | What it is | Page |
|---|---|---|
| Agent | The class that receives a message, calls tools and produces the answer. | Agent Classes |
| Configuration | AgentConfig: everything the builder needs to assemble the agent. | Agent Configuration |
| System prompt | A string that sets the agent’s role and behavior. | Prompts |
| Tools | The capabilities the agent can call. | Tools |
| Injector | The container that gives the agent and its tools access to repositories, chat history and memory. | Injector |
| Memory | Persistent chat history and the optional memory compactor. | Memory |
| Builder | Creates every part above and returns a ready agent. | Builder |
How an agent is built
AgentBuilder.build() performs these steps:
- Create the database models registry and the repositories, and resolve the data set of the conversation.
- Create the language model and embeddings registries.
- Create the language model for the agent, and a default language model for tools.
- Create the injector.
- Create the tools listed in the configuration.
- Create the callback handler and the agent instance.
- Apply the agent’s stored settings, which are entered in the UI, to the agent and its tools.
When an agent has integrations that provide tools, such as MCP servers, selected under Tool sources in its settings, it is built with abuild(), which also attaches the tools of those integrations.
Where a domain definition fits
The core injector carries repositories, chat history, the memory compactor and the tool scratchpad. It holds no domain data. A domain definition can extend the injector with its own retrievers and connectors, and supply a builder that creates them. Agents built on the domain definition can then reach the domain’s data through the injector. See Injector and Builder.