Files
microdao-daarion/crews/agromatrix_crew/agents/stepan_orchestrator.py
Apple 90080c632a fix(fabric): use broadcast subject for NATS capabilities discovery
NATS wildcards (node.*.capabilities.get) only work for subscriptions,
not for publish. Switch to a dedicated broadcast subject
(fabric.capabilities.discover) that all NCS instances subscribe to,
enabling proper scatter-gather discovery across nodes.

Made-with: Cursor
2026-02-27 03:20:13 -08:00

40 lines
1.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from pathlib import Path
from crewai import Agent
from crews.agromatrix_crew.llm_factory import make_llm
_PROMPT_PATH = Path(__file__).parent.parent / "stepan_system_prompt_v2.txt"
def _load_system_prompt() -> str:
try:
return _PROMPT_PATH.read_text(encoding="utf-8")
except Exception:
return (
"Ти — Степан, операційний агент AgroMatrix. "
"Говориш коротко, по ділу, живою українською мовою. "
"Не пишеш сервісних повідомлень. Відповідаєш прямо."
)
def build_stepan(style_prefix: str = "") -> Agent:
"""
Будує агента Степана.
style_prefix — персоналізований prefix від style_adapter.build_style_prefix().
Якщо не передано — використовується базовий системний промпт.
"""
backstory = _load_system_prompt()
if style_prefix:
backstory = style_prefix.strip() + "\n\n" + backstory
return Agent(
role="Stepan (AgroMatrix Operational Agent)",
goal=(
"Відповідати на запити точно і людяно. "
"Делегувати під-агентам лише якщо без них неможливо. "
"Повертати консолідовану відповідь без технічного сміття."
),
backstory=backstory,
llm=make_llm(),
allow_delegation=True,
verbose=False,
)