Alejandro Arguelles commited on
Commit ยท
824a315
1
Parent(s): 4ee5784
finished Readme
Browse files- README.md +116 -0
- screenshot.png +0 -0
README.md
CHANGED
|
@@ -24,6 +24,119 @@ This is my submission for the Text Adventure Agent assignment. My agent uses the
|
|
| 24 |
- What tools did you implement in your MCP server?
|
| 25 |
- Any interesting techniques or optimizations?
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
## Files
|
| 28 |
|
| 29 |
| File | Description |
|
|
@@ -57,3 +170,6 @@ python run_agent.py --agent . --game lostpig -v -n 20
|
|
| 57 |
# Run evaluation
|
| 58 |
python -m evaluation.evaluate -s . -g lostpig -t 3
|
| 59 |
```
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
- What tools did you implement in your MCP server?
|
| 25 |
- Any interesting techniques or optimizations?
|
| 26 |
|
| 27 |
+
|
| 28 |
+
1. Long-Term Memory System (Rolling Summary)
|
| 29 |
+
To avoid the LLM context prompt growing forever and hiting token limits (or losing focus), i've added a cyclic summary system:
|
| 30 |
+
|
| 31 |
+
Interval: Every 10 steps (configurabe in __init__), the agent pauses to consolidate info.
|
| 32 |
+
|
| 33 |
+
Process: The agent takes the previous summary + the last 10 actions, and asks the LLM to generate a new consolidated summary of max 4 paragraphs.
|
| 34 |
+
|
| 35 |
+
Efficency: Once summarized, the history of those 10 actions is wiped, keeping the prompt always short, clean and focused on what matters (goals, items found, places discovered). Also specific general prompt is made to make the agent be more effective, clever and effective.
|
| 36 |
+
|
| 37 |
+
2. Dynamic Tool Introspection
|
| 38 |
+
The agent doesnt have a static list of tools in its prompt anymore. Now:
|
| 39 |
+
|
| 40 |
+
When starting, the MCP client asks the server what tools it offers.
|
| 41 |
+
|
| 42 |
+
The agent dinamically injects the name, description, and JSON Schema of each tool into the system prompt.
|
| 43 |
+
|
| 44 |
+
This allows the agent to learn how to use new tools instantly if you add them to the server, without touching the agent code.
|
| 45 |
+
|
| 46 |
+
3. Verbose Log System (Debug Mode)
|
| 47 |
+
I've added an advanced visualization for development. When running with the --verbose flag, the agent shows:
|
| 48 |
+
|
| 49 |
+
Prompt Structure: The exact breakdown of what is sent to the LLM (Tools, Summary, Recent History, Observation).
|
| 50 |
+
|
| 51 |
+
Consolidation: The real-time summary process and the resulting new context.
|
| 52 |
+
|
| 53 |
+
JSON Formatting: Internal LLM messages formatted to be human-readable.
|
| 54 |
+
|
| 55 |
+
New Tools Implemented
|
| 56 |
+
Here are the tools i've added to the logic:
|
| 57 |
+
|
| 58 |
+
inventory: It lists all the items you are currently carrying in your bag.
|
| 59 |
+
|
| 60 |
+
get_map: Shows a list of every location visited so far, how many times you've been there, and highlights your current room.
|
| 61 |
+
|
| 62 |
+
get_current_state: This is like a "status report". It gives you the score, moves, current observation, and the contents of the memory notebook all at once.
|
| 63 |
+
|
| 64 |
+

|
| 65 |
+
|
| 66 |
+
============================================================
|
| 67 |
+
EXAMPLE OF VERBOSE MODE WITH MEMORY ROLL OUT
|
| 68 |
+
============================================================
|
| 69 |
+
|
| 70 |
+
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
|
| 71 |
+
โ โ
|
| 72 |
+
โ โ
|
| 73 |
+
โ โโโ โโโ โโโ โโโ โโโโโ โโโ โโโ โ
|
| 74 |
+
โ โโ โโโ โโโ โ โ โ โ โโโ โโโ โ
|
| 75 |
+
โ โ
|
| 76 |
+
โ โ
|
| 77 |
+
โ FastMCP 2.14.4 โ
|
| 78 |
+
โ https://gofastmcp.com โ
|
| 79 |
+
โ โ
|
| 80 |
+
โ ๐ฅ Server: Text Adventure Server โ
|
| 81 |
+
โ ๐ Deploy free: https://fastmcp.cloud โ
|
| 82 |
+
โ โ
|
| 83 |
+
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
|
| 84 |
+
|
| 85 |
+
[02/21/26 13:04:18] INFO Starting MCP server 'Text Adventure Server' with transport 'stdio'
|
| 86 |
+
|
| 87 |
+
Available tools: ['play_action', 'inventory', 'get_map', 'get_current_state']
|
| 88 |
+
|
| 89 |
+
Initial observation:
|
| 90 |
+
West of House
|
| 91 |
+
You are standing in an open field west of a white house, with a boarded front door.
|
| 92 |
+
There is a small mailbox here.
|
| 93 |
+
|
| 94 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 95 |
+
Step 1: Initial Investigation
|
| 96 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 97 |
+
THOUGHT: I should examine the mailbox to see if it contains any useful items.
|
| 98 |
+
TOOL: play_action
|
| 99 |
+
ARGS: {'action': 'examine mailbox'}
|
| 100 |
+
RESULT: The small mailbox is closed.
|
| 101 |
+
|
| 102 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 103 |
+
Step 2: Interaction
|
| 104 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 105 |
+
THOUGHT: Since the mailbox is closed, I should try to open it to see if there are any clues inside.
|
| 106 |
+
TOOL: play_action
|
| 107 |
+
ARGS: {'action': 'open mailbox'}
|
| 108 |
+
RESULT: Opening the small mailbox reveals a leaflet.
|
| 109 |
+
|
| 110 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 111 |
+
Step 3: Reading Discovery
|
| 112 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 113 |
+
THOUGHT: Since the mailbox contains a leaflet, I should examine it to see what information it provides.
|
| 114 |
+
TOOL: play_action
|
| 115 |
+
ARGS: {'action': 'examine leaflet'}
|
| 116 |
+
RESULT: "WELCOME TO ZORK! ZORK is a game of adventure, danger, and low cunning..."
|
| 117 |
+
|
| 118 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 119 |
+
Step 4: Environmental Scan
|
| 120 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 121 |
+
THOUGHT: I need to understand the environment and find more ways to interact with the house.
|
| 122 |
+
TOOL: play_action
|
| 123 |
+
ARGS: {'action': 'look'}
|
| 124 |
+
RESULT: West of House. You are standing in an open field west of a white house...
|
| 125 |
+
The small mailbox contains: A leaflet
|
| 126 |
+
|
| 127 |
+
## SUMMARIZING HISTORY... (Rolling Memory)
|
| 128 |
+
NEW SUMMARY:
|
| 129 |
+
|
| 130 |
+
Game started. You are standing in an open field west of a white house, with a boarded front door. There is a small mailbox here, which you examine to find a leaflet inside. The leaflet welcomes you to Zork, describing it as a game of adventure, danger, and low cunning. Opening the mailbox reveals a single leaflet.
|
| 131 |
+
|
| 132 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 133 |
+
Step 5: Consolidation
|
| 134 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 135 |
+
THOUGHT: The leaflet is the only item of interest right now. I'll keep it in mind for clues.
|
| 136 |
+
TOOL: play_action
|
| 137 |
+
ARGS: {'action': 'examine leaflet'}
|
| 138 |
+
RESULT: "WELCOME TO ZORK!..."
|
| 139 |
+
|
| 140 |
## Files
|
| 141 |
|
| 142 |
| File | Description |
|
|
|
|
| 170 |
# Run evaluation
|
| 171 |
python -m evaluation.evaluate -s . -g lostpig -t 3
|
| 172 |
```
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
|
screenshot.png
ADDED
|