feat: select agent as parameter of #agent command

This commit is contained in:
Daniel Eder 2025-09-28 11:07:05 +02:00
parent e166b5d0a8
commit 905e3c91ab
2 changed files with 5 additions and 9 deletions

View file

@ -45,10 +45,10 @@ Python-based Telnet helper for connecting to MUD servers, handling login flows,
6. To run an agent that orchestrates several tools, use: 6. To run an agent that orchestrates several tools, use:
```text ```text
#agent move,explore #agent fixed move,explore
``` ```
This example uses the fixed-strategy agent to run `move` and then `explore` once. This example uses the fixed strategy agent to run `move` and then `explore` once. The first token after `#agent` selects the agent type (`fixed` today, more to come), and any remaining text is passed as that agent's configuration.
## Environment Variables ## Environment Variables

View file

@ -44,13 +44,9 @@ def build_agent(spec: str) -> Agent:
if not normalized: if not normalized:
raise RuntimeError("Agent specification must not be empty") raise RuntimeError("Agent specification must not be empty")
if ":" in normalized: parts = normalized.split(maxsplit=1)
kind, config = normalized.split(":", 1) kind = parts[0].lower()
else: config = parts[1].strip() if len(parts) > 1 else ""
kind, config = "fixed", normalized
kind = kind.strip().lower()
config = config.strip()
if kind in {"fixed", "strategy", "fixedstrategy"}: if kind in {"fixed", "strategy", "fixedstrategy"}:
return FixedStrategyAgent(config) return FixedStrategyAgent(config)