Chapter 6: Project Structure and Internals
This chapter provides a technical overview of the T20 system's architecture and how to customize it. We will delve into the directory layout, the purpose of key files and modules within the runtime/
directory, and discuss methods for customizing orchestration logic and advanced prompt engineering techniques.
6.1 Directory Layout Explained
The T20 project follows a structured directory layout designed for clarity and maintainability:
t20-multi-agent/
├── agents/ # YAML definitions for each agent
│ ├── orchestrator.yaml
│ ├── lyra.yaml
│ ├── aurora.yaml
│ ├── kodax.yaml
│ └── tase.yaml
├── prompts/ # System prompts and instructions for agents (can be text files or structured data)
│ ├── orchestrator_instructions.txt
│ └── ...
├── runtime/ # Core Python source code for the framework
│ ├── __init__.py
│ ├── executor.py # Main execution logic, agent classes, CLI entry point
│ └── loader.py # Utilities for loading configs, agents, and prompts
├── sessions/ # Output directory for all runtime sessions (auto-generated)
│ └── session_...
│ ├── initial_plan.json
│ ├── 0__step_0_Lyra_result.txt
│ └── ...
├── setup.py # Project setup and dependencies definition
├── README.md # Project overview and documentation
└── .env # Environment variables (e.g., API keys)
agents/
: Contains the declarative configurations (YAML) for each agent, defining their roles, goals, and models.prompts/
: Stores the system prompts and instructions used to guide agent behavior.runtime/
: Houses the core Python logic of the T20 framework, including the execution engine and configuration loaders.sessions/
: Automatically generated directory where all artifacts, logs, and plans for each T20 run are stored.setup.py
: Standard Python packaging file used for installation and dependency management.
6.2 The runtime/
Module
The runtime/
directory is the heart of the T20 framework's execution logic.
executor.py
: This file contains the main execution loop, the base classes for agents, and the entry point for thet20-cli
command. It orchestrates the loading of agents, processing of goals, generation of plans, and delegation of tasks.loader.py
: Provides utility functions for loading agent configurations from YAML files, loading prompts, and managing environment variables (like API keys). It ensures the system can correctly interpret and utilize its components.
6.3 Customizing the Orchestration Logic
For advanced users seeking to modify the system's core behavior, the orchestration logic offers avenues for customization:
- Modifying Planning Strategies: The way
Meta-AI
generates plans could be influenced by changing the prompts it receives or by modifying the internal logic withinexecutor.py
that interacts with the planning LLM. For instance, one might experiment with different meta-prompts to encourage more robust or creative plan generation. - Implementing New Delegation Patterns: The logic for how tasks are delegated could be altered. This might involve introducing new criteria for agent selection or implementing different communication protocols between agents. Such changes would likely require modifications within the
executor.py
or related modules.
Note: Customizing core logic requires a good understanding of the Python codebase and the T20 framework's internal workings.
6.4 Advanced Prompt Engineering Techniques
Effective prompt engineering is crucial for maximizing agent performance. Best practices include:
- Clear Task Definition: Ensure prompts clearly state the desired output format, constraints, and goals.
- Contextual Information: Provide relevant context from previous steps or the overall goal.
- Role-Playing: Instructing the agent to adopt a specific persona (e.g., "Act as a senior software engineer...") can significantly influence its output.
- Few-Shot Prompting: Including examples of desired input/output pairs within the prompt can guide the LLM effectively, especially for complex or nuanced tasks. For example, when defining prompts for
Aurora
, providing a few examples of minimalist design descriptions could yield better results.
The T20 system's integration with Lyra
allows for dynamic adaptation of these techniques during runtime, further optimizing the results.