AI-Assisted Development
This project uses a multi-agent AI architecture to accelerate development while maintaining quality standards. This guide explains how to work with the AI agents, how to give them effective instructions, and what guardrails are in place.
Agent Architecture
The project has four specialized AI agents, organized as a team. The architect plans and hands approved work packages directly to the owning specialist โ there is no orchestrator.
graph TD
CA[๐ค Human Developer] -->|requirements| ARCH
ARCH[๐งญ Architect<br/>testlab-architect] -->|work packages| PY[๐ Backend Developer<br/>testlab-master]
ARCH -->|work packages| TEST[๐งช Test Engineer<br/>testlab-test-master]
ARCH -->|work packages| DOCS[๐ Technical Writer<br/>testlab-docs-master]
PY -->|delivery| CA
TEST -->|delivery| CA
DOCS -->|delivery| CA
| Agent | File | Expertise |
|---|---|---|
| Architect | .github/agents/testlab-architect.agent.md |
Planning, impact analysis, work package design โ never writes code |
| Backend Developer | .github/agents/testlab-master.agent.md |
Python 3.12+, Pydantic, async, tractusx-sdk |
| Test Engineer | .github/agents/testlab-test-master.agent.md |
pytest, fixtures, factories, mocking, coverage |
| Technical Writer | .github/agents/testlab-docs-master.agent.md |
MkDocs, tutorials, API docs, diagrams, guides |
How to Use the Agents
Option 1: Plan with the Architect (Recommended)
For any non-trivial task, talk to testlab-architect. It will:
- Analyze the requirement
- Break it into work packages
- Identify the owning specialist for each package
- Hand the approved work packages directly to that specialist
The architect never writes code โ it plans and advises. The specialist that receives a work package delivers it.
Best for
Complex refactors, multi-file changes, anything requiring planning before implementation.
Example prompt:
Add a new "Notification" capability with send and receive step types.
Plan the work packages and hand them to the backend and test specialists.
Option 2: Talk to a Specialist Agent Directly
For focused, single-concern tasks, you can talk directly to the specialized agent.
Best for
Bug fixes in one file, adding a single Python step executor, documenting one command.
Example โ Backend agent:
@testlab-master Add a new step executor `http_download` that downloads
a file from a URL and saves it to a temp directory. Follow the pattern
in steps/http/request.py.
Example โ Test engineer:
@testlab-test-master The authoring parser has zero test coverage.
Write tests for `src/tractusx_testlab/authoring/parser.py` covering
valid YAML parsing, malformed input rejection, and dependency resolution.
Example โ Technical writer:
@testlab-docs-master Document the new CLI `testlab compile` command.
Add a page under Tutorials explaining the compile workflow with
examples. Update the nav in mkdocs.yml.
Writing Effective Prompts
The quality of AI output is directly proportional to the quality of your prompt. Follow these patterns:
The 5-Part Prompt Formula
Every non-trivial task should include:
- Goal โ What to build (one sentence)
- Context โ Which files to read, which patterns to follow
- Scope โ Exact files to create or modify
- Acceptance criteria โ How to verify success
- Constraints โ What NOT to do
Good Prompt Example
TASK: Add a `wait_for_callback` step executor.
CONTEXT: Read `src/tractusx_testlab/steps/connector/consume.py` for the
pattern. This step waits for an HTTP callback on the mock server.
CREATE: `src/tractusx_testlab/steps/flow/wait_callback.py`
UPDATE: Register in `src/tractusx_testlab/steps/__init__.py`
ACCEPTANCE:
- `python -m pytest tests/ -x -q` passes
- `python -c "from tractusx_testlab.steps.flow.wait_callback import WaitCallbackStep"` works
CONSTRAINTS:
- Do NOT modify the mock server code
- Do NOT add new dependencies
- Keep the file under 300 lines
Bad Prompt Example
This is bad because it's missing context, scope, acceptance criteria, and constraints. The agent will guess, and guesses produce spaghetti.
Prompt Patterns by Task Type
Quality Guardrails
Every agent has a Mandatory Self-Review Checklist that runs before delivering code. These are enforced automatically:
Python Quality Gates
| Check | Command | Expected |
|---|---|---|
| File size | find src -name '*.py' \| xargs wc -l \| awk '$1 > 300' |
Empty output |
| Exception handling | grep -rn "except Exception:" src/ |
Zero matches |
| No print | grep -rn "print(" src/ --include="*.py" |
Zero matches |
| Tests | python -m pytest tests/ -x -q |
All pass |
Universal Rules
- 300-line limit โ No source file may exceed 300 lines
- No bare exceptions โ Catch the narrowest type, never
except Exception: - No magic strings โ Use constants, enums, or configuration
- Type annotations โ All public functions must be typed
- Single responsibility โ One module, one concern
Instruction Files
The agents are configured through instruction files in .github/instructions/:
| File | Scope | Purpose |
|---|---|---|
copilot-instructions.md |
**/* |
Project-wide conventions and design principles |
python.instructions.md |
src/**/*.py |
Python-specific coding standards |
ai_generated_code.instructions.md |
**/* |
AI subtitle requirement for license headers |
These files are automatically loaded by the AI agents when working on matching file paths. To update a convention, edit the relevant instruction file โ it takes effect immediately.
How to Split Oversized Files
When a file exceeds 300 lines, use these extraction patterns:
Python
| What to extract | Where to put it |
|---|---|
| One step class per file | steps/category/step_name.py |
| Shared constants | package/_constants.py |
| Helper functions (private) | package/_helpers.py |
| CLI command groups | cli/command_group.py |
| Parsing sub-phases | authoring/_builders.py |
Adding a New Agent
To create a new specialized agent:
- Create
.github/agents/agent-name.agent.md - Include the YAML frontmatter with
descriptionandtools - Define identity, expertise, constraints
- Add the Mandatory Self-Review Checklist (copy from an existing agent)
- Add the How to Split Oversized Files patterns relevant to the agent's domain
- Add the agent to the team table in this guide
Warning
Every agent MUST include a self-review checklist. Agents without one will produce unchecked code.
Codex Compatibility
The .agent.md files are GitHub Copilot-specific. For OpenAI Codex, consolidate the key rules into an AGENTS.md file at the repository root. Codex reads this file automatically. The content (quality rules, split patterns, naming conventions) transfers directly โ only the file format differs.