trading_agent.subagents.subagent_prompt_builder
¶
Builds a subagent's system prompt: a fixed header, then the instructions from its definition file.
A subagent does not read the desk's workspace files. It is a specialist with one task, so its prompt stays short, which matters most on Gemma's and Qwen's small context window. A definition that needs the trading rules can tell the subagent to read TradingRules.md with read_file.
Typical usage example:
prompt = SubagentPromptBuilder(definition, 'main', 'dry_run').build()
SubagentPromptBuilder
¶
Assembles one subagent's prompt.
Creates the builder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definition
|
SubagentDefinition
|
The subagent. |
required |
desk_name
|
str
|
The desk it works for. |
required |
mode
|
str
|
"dry_run" or "live". |
required |
Source code in src/trading_agent/subagents/subagent_prompt_builder.py
build
¶
Assembles the prompt.
Returns:
| Type | Description |
|---|---|
SystemPrompt
|
The prompt and its fingerprint. |