feat: select agent as parameter of #agent command
This commit is contained in:
parent
e166b5d0a8
commit
905e3c91ab
2 changed files with 5 additions and 9 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
10
agents.py
10
agents.py
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue