Skip to Content
DocumentationAgentsAgent Architecture

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.

PartWhat it isPage
AgentThe class that receives a message, calls tools and produces the answer.Agent Classes
ConfigurationAgentConfig: everything the builder needs to assemble the agent.Agent Configuration
System promptA string that sets the agent’s role and behavior.Prompts
ToolsThe capabilities the agent can call.Tools
InjectorThe container that gives the agent and its tools access to repositories, chat history and memory.Injector
MemoryPersistent chat history and the optional memory compactor.Memory
BuilderCreates every part above and returns a ready agent.Builder

How an agent is built

AgentBuilder.build() performs these steps:

  1. Create the database models registry and the repositories, and resolve the data set of the conversation.
  2. Create the language model and embeddings registries.
  3. Create the language model for the agent, and a default language model for tools.
  4. Create the injector.
  5. Create the tools listed in the configuration.
  6. Create the callback handler and the agent instance.
  7. 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.

Last updated on