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:
|
||||
|
||||
```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
|
||||
|
||||
|
|
|
|||
10
agents.py
10
agents.py
|
|
@ -44,13 +44,9 @@ def build_agent(spec: str) -> Agent:
|
|||
if not normalized:
|
||||
raise RuntimeError("Agent specification must not be empty")
|
||||
|
||||
if ":" in normalized:
|
||||
kind, config = normalized.split(":", 1)
|
||||
else:
|
||||
kind, config = "fixed", normalized
|
||||
|
||||
kind = kind.strip().lower()
|
||||
config = config.strip()
|
||||
parts = normalized.split(maxsplit=1)
|
||||
kind = parts[0].lower()
|
||||
config = parts[1].strip() if len(parts) > 1 else ""
|
||||
|
||||
if kind in {"fixed", "strategy", "fixedstrategy"}:
|
||||
return FixedStrategyAgent(config)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue