Agents
agents
¶
Prepares agent config directories with wrappers, instructions, and sub-agent definitions.
Parses .md frontmatter for sub-agent definitions, converts them to Claude's
--agents JSON format, and generates the terok-executor.sh wrapper that
sets up git identity and CLI flags inside task containers.
AgentConfigSpec(tasks_root, task_id, subagents, selected_agents=None, prompt=None, provider='claude', instructions=None, default_agent=None, mounts_base=None)
dataclass
¶
Groups parameters for preparing an agent-config directory.
tasks_root
instance-attribute
¶
task_id
instance-attribute
¶
subagents
instance-attribute
¶
selected_agents = None
class-attribute
instance-attribute
¶
prompt = None
class-attribute
instance-attribute
¶
provider = 'claude'
class-attribute
instance-attribute
¶
instructions = None
class-attribute
instance-attribute
¶
default_agent = None
class-attribute
instance-attribute
¶
mounts_base = None
class-attribute
instance-attribute
¶
__post_init__()
¶
Coerce mutable sequences to tuples for true immutability.
Defensive against callers that build the spec from
json.loads / yaml.load output where the runtime types are
list instead of tuple. Mypy sees the static annotations
and reports the isinstance(..., list) branches as unreachable;
the runtime coercion remains correct.
Source code in src/terok_executor/provider/agents.py
prepare_agent_config_dir(spec)
¶
Create and populate the agent-config directory for a task.
Writes:
- terok-executor.sh (always) — wrapper functions with git env vars
- agents.json (only when provider supports it and sub-agents are non-empty)
- prompt.txt (if prompt given, headless only)
- instructions.md (always) — custom instructions or a neutral default
- instructions path injected into shared
OpenCode and Blablador configs
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
AgentConfigSpec
|
All agent-config parameters bundled in an |
required |
Returns the agent_config_dir path.
Source code in src/terok_executor/provider/agents.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
parse_md_agent(file_path)
¶
Parse a .md file with YAML frontmatter into an agent dict.
Expected format
name: agent-name description: ... tools: [Read, Grep] model: sonnet
System prompt body...