Spaces:
Sleeping
Sleeping
Delete Looplens
Browse files
Looplens
DELETED
|
@@ -1,88 +0,0 @@
|
|
| 1 |
-
space-link/
|
| 2 |
-
βββ app.py # Gradio app with streaming traces
|
| 3 |
-
βββ requirements.txt # Dependencies
|
| 4 |
-
βββ README.md # Full docs
|
| 5 |
-
βββ .gitignore
|
| 6 |
-
β
|
| 7 |
-
βββ agents/
|
| 8 |
-
β βββ __init__.py
|
| 9 |
-
β βββ loops/
|
| 10 |
-
β β βββ base.py # Abstract base: BaseAgentLoop, BaseMemory, Tool
|
| 11 |
-
β β βββ react_loop.py # ReAct: Thought β Action β Observation
|
| 12 |
-
β β βββ plan_execute_loop.py # Plan β Execute β Synthesize
|
| 13 |
-
β β βββ reflection_loop.py # Action β Reflection β Refinement
|
| 14 |
-
β βββ tools/
|
| 15 |
-
β β βββ web_search.py # Simulated search with keyword routing
|
| 16 |
-
β β βββ calculator.py # Safe math eval + demo cases
|
| 17 |
-
β βββ memory/
|
| 18 |
-
β βββ short_term.py # Sliding-window context memory
|
| 19 |
-
β
|
| 20 |
-
βββ config/
|
| 21 |
-
β βββ settings.py # AgentConfig & SpaceConfig dataclasses
|
| 22 |
-
βββ ui/ # Expansion-ready UI package
|
| 23 |
-
βββ tests/
|
| 24 |
-
βββ test_loops.py # pytest suite for all loops & tools
|
| 25 |
-
from agents.loops.react_loop import ReActAgent
|
| 26 |
-
from agents.tools.web_search import WebSearchTool
|
| 27 |
-
from agents.tools.calculator import CalculatorTool
|
| 28 |
-
from agents.memory.short_term import ShortTermMemory
|
| 29 |
-
|
| 30 |
-
agent = ReActAgent(
|
| 31 |
-
tools=[WebSearchTool(), CalculatorTool()],
|
| 32 |
-
memory=ShortTermMemory(max_items=10),
|
| 33 |
-
max_steps=5
|
| 34 |
-
)
|
| 35 |
-
result = agent.run("What is the population of Tokyo divided by Paris?")
|
| 36 |
-
from agents.loops.plan_execute_loop import PlanExecuteAgent
|
| 37 |
-
|
| 38 |
-
agent = PlanExecuteAgent(
|
| 39 |
-
tools=[WebSearchTool(), CalculatorTool()],
|
| 40 |
-
memory=ShortTermMemory(max_items=10),
|
| 41 |
-
max_steps=5
|
| 42 |
-
)
|
| 43 |
-
from agents.loops.reflection_loop import ReflectionAgent
|
| 44 |
-
|
| 45 |
-
agent = ReflectionAgent(
|
| 46 |
-
tools=[WebSearchTool(), CalculatorTool()],
|
| 47 |
-
memory=ShortTermMemory(max_items=10),
|
| 48 |
-
max_steps=5
|
| 49 |
-
)
|
| 50 |
-
Tab Function
|
| 51 |
-
βΆοΈ Single Run Pick a loop architecture, set max steps, and watch the real-time execution trace with color-coded steps (π§ Thought, π§ Action, ποΈ Observation, β
Final)
|
| 52 |
-
βοΈ Compare All Loops Run the same query across all three architectures side-by-side with step counts and timing
|
| 53 |
-
π Architecture Guide Built-in documentation explaining when to use each loop
|
| 54 |
-
pytest tests/ -v
|
| 55 |
-
gradio>=4.0.0
|
| 56 |
-
pydantic>=2.0.0
|
| 57 |
-
python-dotenv>=1.0.0
|
| 58 |
-
pytest>=7.0.0
|
| 59 |
-
π Extending the Architecture
|
| 60 |
-
Because every loop inherits from BaseAgentLoop , adding a new architecture (like Tree of Thoughts or DSPy) requires only:
|
| 61 |
-
1.
|
| 62 |
-
Subclass BaseAgentLoop
|
| 63 |
-
2.
|
| 64 |
-
Implement run() and run_stream()
|
| 65 |
-
3.
|
| 66 |
-
Register it in app.py 's AGENTS dictionary
|
| 67 |
-
The UI, comparison logic, and memory systems work automatically.
|
| 68 |
-
The full codebase is saved in /mnt/agents/output/space-link/ . You can zip it, push it to a Hugging Face Space, or extend it with a real LLM backend by swapping the _think() methods for actual OpenAI/Claude/local model calls.MIT License
|
| 69 |
-
|
| 70 |
-
Copyright (c) 2026 Roger Lawson
|
| 71 |
-
|
| 72 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 73 |
-
of this software and associated documentation files (the "Software"), to deal
|
| 74 |
-
in the Software without restriction, including without limitation the rights
|
| 75 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 76 |
-
copies of the Software, and to permit persons to whom the Software is
|
| 77 |
-
furnished to do so, subject to the following conditions:
|
| 78 |
-
|
| 79 |
-
The above copyright notice and this permission notice shall be included in all
|
| 80 |
-
copies or substantial portions of the Software.
|
| 81 |
-
|
| 82 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 83 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 84 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 85 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 86 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 87 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 88 |
-
SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|