Instructions
instructions
¶
Resolves agent instructions from layered config with bundled defaults.
Supports flat strings, per-provider dicts, and lists with _inherit
splicing. Falls back to a bundled default that describes the standard
container environment.
Two independent layers control what a task receives:
- YAML
instructionskey — controls the inheritance chain via config stack. Uses_inheritin list form to splice the bundled default at that position. Absent/None ⇒ bundled default. - Standalone
instructions.mdfile inproject_root— always appended at the end of whatever the YAML chain resolved. Purely additive. If empty or absent, nothing is appended.
resolve_instructions(config, agent_name, project_root=None, *, family=None)
¶
Resolve instructions from a merged config dict.
Supports:
- Flat string: returned as-is
- Per-agent dict: uses resolve_agent_value, falls back to _default
- List (with _inherit): splices bundled default at each _inherit sentinel
- Absent/None: returns bundled default
family is the task image's package family ("deb"/"rpm", or
None when unknown) — wherever the bundled default is used, its
package-manager guidance is rendered for that family.
After resolving the YAML value, appends the contents of
project_root/instructions.md (if it exists and is non-empty).
Returns the final instructions text.
Source code in src/terok_executor/provider/instructions.py
has_custom_instructions(config, project_root=None)
¶
Check if config has explicit (non-default) instructions.
Returns True when either the YAML instructions key is set or a
standalone instructions.md file exists under project_root.
Source code in src/terok_executor/provider/instructions.py
bundled_default_instructions(family=None)
¶
Render the bundled default instructions for a package family.
The bundled default.md is a Jinja2 template branching on family,
like the Dockerfile templates: package-manager guidance renders as
apt for "deb" bases and dnf for "rpm" bases, and stays
deliberately generic when the family is unknown (None) — better no
tool advice than wrong tool advice.