As you can see, agentUniverse
is designed with lightweight and integration capabilities in mind, allowing you to incorporate agentUniverse
into any of your projects for seamless operation.
The directory structure provided below is only a suggestion, and you are free to adjust it according to your preferences and actual situation. We will explain this in more detail later in the document.
/
├── bootstrap/
│ ├── intelligence/
│ │ └── server_application.py
│ ├── platform/
│ │ └── product_application.py
├── intelligence/
│ ├── agentic/
│ │ ├── agent
│ │ │ └── agent_instance
│ │ │ └── agent_template
│ │ ├── knowledge
│ │ │ └── store/
│ │ │ └── rag_router/
│ │ │ └── doc_processor/
│ │ ├── llm
│ │ ├── prompt
│ │ ├── memory
│ │ ├── tool
│ │ └── work_pattern
│ ├── service/
│ │ └── agent_service
│ │ └── classic_service
│ ├── dal/
│ ├── integration/
│ ├── utils/
│ └── test/
├── platform/
├── config
├── pyproject.toml
└── other project files...
Here's what each package directory level means:
- bootstrap: The entry layer for starting the web server
- intelligence - The entry layer for starting Intelligent web server
- platform - The entry layer for productization web server
- intelligence: Intelligent project layer, used for agent construction, component customization, and service implementation.
- agentic: Intelligent domain layer, where related domain components of agentUniverse are placed.
- agent - Agent layer, corresponding to the agent component of agentUniverse, which can be used to build agent templates and instances.
- agent_template - Agent template layer, abstracted from business understanding, to help users quickly build agents. After the template is built, users only need to configure specific attributes based on the template to execute the corresponding logic.
- agent_instance - Agent instance layer.
- knowledge - Knowledge layer, corresponding to the knowledge component of agentUniverse, including knowledge injection and search capabilities.
- store - Knowledge store, corresponding to the store component of agentUniverse.
- rag_router - Knowledge RAG router, corresponding to the rag_router component of agentUniverse.
- doc_processor - Knowledge document processor, corresponding to the doc_processor component of agentUniverse.
- llm - LLM layer, corresponding to the llm component of agentUniverse, providing llm services such as ChatGPT/Qwen.
- prompt - Prompt layer, corresponding to the prompt component of agentUniverse, providing prompt templates and generation capabilities.
- memory - Memory layer, corresponding to the memory component of agentUniverse, providing agent memory capabilities, including memory compression and storage.
- tool - Tool layer, corresponding to the tool component of agentUniverse, providing auxiliary tools such as API services.
- work_pattern - Work pattern layer, providing typical single-agent and multi-agent collaboration patterns, including PEER/DOE/MAP, etc.
- agent - Agent layer, corresponding to the agent component of agentUniverse, which can be used to build agent templates and instances.
- service: Intelligent project service layer.
- agent_service - Intelligent service layer, corresponding to the service component of agentUniverse, associating agent instances and providing external services.
- classic_service - Traditional service layer, handling non-agent services such as file services and session services.
- dal: Data access layer, providing data source access interfaces.
- integration: Integration layer, used to connect and coordinate different systems, services, and components.
- utils: Basic utility layer, providing small and general-purpose helper functions.
- test: Unit tests.
- agentic: Intelligent domain layer, where related domain components of agentUniverse are placed.
- platform: Platform project layer, handling platform capabilities outside intelligent project.
- config - Application configuration code
You can adjust the project directory structure according to your preferences and actual circumstances, but please ensure you follow the rules below.
Regardless of the location of your project's startup script, except for testing, you should start the application service with the following statement:
from agentuniverse.agent_serve.web.web_booster import start_web_server
from agentuniverse.base.agentuniverse import AgentUniverse
class ServerApplication:
"""
Server application.
"""
@classmethod
def start(cls):
AgentUniverse().start()
start_web_server()
ServerApplication.start()
ServerApplication.start()
is the server startup method for this framework, which accepts a configuration path config_path
as an input parameter. The default config_path
points to a file named 'config.toml', located in the config directory under the project root path(project_root_dir/config/config.toml
). Ensure that the config file path is correct; if you have further changed the directory of the config file, adjust the config_path
accordingly.
As mentioned in the Bootstrap Startup Directory, the default config path for the project is project_root_dir/config/config.toml
. If you have made any adjustments to this, please ensure that the correct config file path is provided to the startup method when the application server is launched.
As shown in the recommended directory structure, the agentic directory within intelligence is primarily used to place domain components related to agents, knowledge, and LLMs. If you want to customize the location of core components, you can specify the paths of the domain components in the [CORE_PACKAGE] section of the main configuration file config/config.toml as follows:
[CORE_PACKAGE]
# Perform a full component scan and registration for all the paths under this list.
default = ['sample_standard_app.intelligence.agentic']
# Scan and register agent components for all paths under this list, with priority over the default.
agent = ['sample_standard_app.intelligence.agentic.agent']
# Scan and register knowledge components for all paths under this list, with priority over the default.
knowledge = ['sample_standard_app.intelligence.agentic.knowledge']
# Scan and register llm components for all paths under this list, with priority over the default.
llm = ['sample_standard_app.intelligence.agentic.llm']
# Scan and register tool components for all paths under this list, with priority over the default.
tool = ['sample_standard_app.intelligence.agentic.tool']
# Scan and register memory components for all paths under this list, with priority over the default.
memory = ['sample_standard_app.intelligence.agentic.memory']
# Scan and register service components for all paths under this list, with priority over the default.
service = ['sample_standard_app.intelligence.service.agent_service']
# Scan and register prompt components for all paths under this list, with priority over the default.
prompt = ['sample_standard_app.intelligence.agentic.prompt']
# Scan and register store components for all paths under this list, with priority over the default.
store = ['sample_standard_app.intelligence.agentic.knowledge.store']
# Scan and register rag_router components for all paths under this list, with priority over the default.
rag_router = ['sample_standard_app.intelligence.agentic.knowledge.rag_router']
# Scan and register doc_processor components for all paths under this list, with priority over the default.
doc_processor = ['sample_standard_app.intelligence.agentic.knowledge.doc_processor']
# Scan and register query_paraphraser components for all paths under this list, with priority over the default.
query_paraphraser = ['sample_standard_app.intelligence.agentic.knowledge.query_paraphraser']
# Scan and register memory_compressor components for all paths under this list, with priority over the default.
memory_compressor = ['sample_standard_app.intelligence.agentic.memory.memory_compressor']
# Scan and register memory_storage components for all paths under this list, with priority over the default.
memory_storage = ['sample_standard_app.intelligence.agentic.memory.memory_storage']
# Scan and register product components for all paths under this list, with priority over the default.
product = ['sample_standard_app.platform.difizen.product']
# Scan and register workflow components for all paths under this list, with priority over the default.
workflow = ['sample_standard_app.platform.difizen.workflow']
The format for specifying package paths in the configuration follows the standard Python package path format. The framework will register, scan, and manage all types of component packages uniformly based on the defined package paths during startup.
Tips: The package path should be specified relative to one level below your project's root directory. For example, in the sample_standard_app project, since the package path is specified under the project's top-level directory, it starts with sample_standard_app. If you are using sample_standard_app as a project template and organizing your components under an app subdirectory, then the package path should start with app.xxx.”