agents
agents
¶
Agent configuration: parsing, filtering, and wrapper generation.
Handles .md frontmatter parsing, sub-agent JSON conversion for Claude's
--agents flag, and the terok-agent.sh wrapper function 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.
__post_init__()
¶
Coerce mutable sequences to tuples for true immutability.
Source code in src/terok_agent/agents.py
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...
Source code in src/terok_agent/agents.py
prepare_agent_config_dir(spec)
¶
Create and populate the agent-config directory for a task.
Writes:
- terok-agent.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 :class: |
required |
Returns the agent_config_dir path.
Source code in src/terok_agent/agents.py
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | |