loom-agent 0.0.1__tar.gz → 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of loom-agent might be problematic. Click here for more details.

Files changed (112) hide show
  1. loom_agent-0.0.2/PKG-INFO +295 -0
  2. loom_agent-0.0.2/README.md +242 -0
  3. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/tools/calculator.py +4 -0
  4. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/tools/document_search.py +5 -0
  5. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/tools/glob.py +4 -0
  6. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/tools/grep.py +4 -0
  7. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/tools/http_request.py +5 -0
  8. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/tools/python_repl.py +5 -0
  9. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/tools/read_file.py +4 -0
  10. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/tools/task.py +5 -0
  11. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/tools/web_search.py +4 -0
  12. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/tools/write_file.py +4 -0
  13. loom_agent-0.0.2/loom/components/agent.py +223 -0
  14. loom_agent-0.0.2/loom/core/agent_executor.py +635 -0
  15. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/compression_manager.py +17 -10
  16. loom_agent-0.0.2/loom/core/context_assembly.py +329 -0
  17. loom_agent-0.0.2/loom/core/events.py +414 -0
  18. loom_agent-0.0.2/loom/core/execution_context.py +119 -0
  19. loom_agent-0.0.2/loom/core/tool_orchestrator.py +383 -0
  20. loom_agent-0.0.2/loom/core/turn_state.py +188 -0
  21. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/types.py +15 -4
  22. loom_agent-0.0.2/loom/interfaces/event_producer.py +172 -0
  23. loom_agent-0.0.2/loom/interfaces/tool.py +48 -0
  24. loom_agent-0.0.2/loom/security/__init__.py +13 -0
  25. loom_agent-0.0.2/loom/security/models.py +85 -0
  26. loom_agent-0.0.2/loom/security/path_validator.py +128 -0
  27. loom_agent-0.0.2/loom/security/validator.py +346 -0
  28. loom_agent-0.0.2/loom/tasks/PHASE_1_FOUNDATION/task_1.1_agent_events.md +121 -0
  29. loom_agent-0.0.2/loom/tasks/PHASE_1_FOUNDATION/task_1.2_streaming_api.md +521 -0
  30. loom_agent-0.0.2/loom/tasks/PHASE_1_FOUNDATION/task_1.3_context_assembler.md +606 -0
  31. loom_agent-0.0.2/loom/tasks/PHASE_2_CORE_FEATURES/task_2.1_tool_orchestrator.md +743 -0
  32. loom_agent-0.0.2/loom/tasks/PHASE_2_CORE_FEATURES/task_2.2_security_validator.md +676 -0
  33. loom_agent-0.0.2/loom/tasks/README.md +109 -0
  34. loom_agent-0.0.2/loom/tasks/__init__.py +11 -0
  35. loom_agent-0.0.2/loom/tasks/sql_placeholder.py +100 -0
  36. {loom_agent-0.0.1 → loom_agent-0.0.2}/pyproject.toml +1 -1
  37. loom_agent-0.0.1/PKG-INFO +0 -457
  38. loom_agent-0.0.1/README.md +0 -404
  39. loom_agent-0.0.1/loom/components/agent.py +0 -107
  40. loom_agent-0.0.1/loom/core/agent_executor.py +0 -450
  41. loom_agent-0.0.1/loom/interfaces/tool.py +0 -27
  42. {loom_agent-0.0.1 → loom_agent-0.0.2}/LICENSE +0 -0
  43. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/__init__.py +0 -0
  44. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/agent.py +0 -0
  45. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/agents/__init__.py +0 -0
  46. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/agents/refs.py +0 -0
  47. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/agents/registry.py +0 -0
  48. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/compression/__init__.py +0 -0
  49. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/compression/structured.py +0 -0
  50. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/embeddings/__init__.py +0 -0
  51. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/embeddings/openai_embedding.py +0 -0
  52. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/embeddings/sentence_transformers_embedding.py +0 -0
  53. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/llms/__init__.py +0 -0
  54. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/llms/mock.py +0 -0
  55. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/llms/openai.py +0 -0
  56. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/llms/rule.py +0 -0
  57. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/memory/__init__.py +0 -0
  58. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/memory/in_memory.py +0 -0
  59. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/memory/persistent_memory.py +0 -0
  60. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/retriever/__init__.py +0 -0
  61. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/retriever/chroma_store.py +0 -0
  62. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/retriever/in_memory.py +0 -0
  63. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/retriever/milvus_store.py +0 -0
  64. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/retriever/pinecone_store.py +0 -0
  65. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/retriever/qdrant_store.py +0 -0
  66. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/retriever/vector_store.py +0 -0
  67. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/retriever/vector_store_config.py +0 -0
  68. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/builtin/tools/__init__.py +0 -0
  69. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/callbacks/base.py +0 -0
  70. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/callbacks/logging.py +0 -0
  71. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/callbacks/metrics.py +0 -0
  72. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/callbacks/observability.py +0 -0
  73. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/circuit_breaker.py +0 -0
  74. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/context_retriever.py +0 -0
  75. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/error_classifier.py +0 -0
  76. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/errors.py +0 -0
  77. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/message_queue.py +0 -0
  78. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/permission_store.py +0 -0
  79. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/permissions.py +0 -0
  80. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/scheduler.py +0 -0
  81. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/steering_control.py +0 -0
  82. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/structured_logger.py +0 -0
  83. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/subagent_pool.py +0 -0
  84. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/system_prompt.py +0 -0
  85. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/system_reminders.py +0 -0
  86. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/core/tool_pipeline.py +0 -0
  87. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/interfaces/compressor.py +0 -0
  88. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/interfaces/embedding.py +0 -0
  89. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/interfaces/llm.py +0 -0
  90. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/interfaces/memory.py +0 -0
  91. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/interfaces/retriever.py +0 -0
  92. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/interfaces/vector_store.py +0 -0
  93. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/llm/__init__.py +0 -0
  94. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/llm/config.py +0 -0
  95. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/llm/factory.py +0 -0
  96. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/llm/model_health.py +0 -0
  97. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/llm/model_pool_advanced.py +0 -0
  98. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/llm/pool.py +0 -0
  99. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/llm/registry.py +0 -0
  100. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/mcp/__init__.py +0 -0
  101. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/mcp/client.py +0 -0
  102. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/mcp/registry.py +0 -0
  103. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/mcp/tool_adapter.py +0 -0
  104. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/observability/__init__.py +0 -0
  105. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/patterns/__init__.py +0 -0
  106. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/patterns/multi_agent.py +0 -0
  107. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/patterns/rag.py +0 -0
  108. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/plugins/registry.py +0 -0
  109. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/resilience/__init__.py +0 -0
  110. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/tooling.py +0 -0
  111. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/utils/agent_loader.py +0 -0
  112. {loom_agent-0.0.1 → loom_agent-0.0.2}/loom/utils/token_counter.py +0 -0
@@ -0,0 +1,295 @@
1
+ Metadata-Version: 2.4
2
+ Name: loom-agent
3
+ Version: 0.0.2
4
+ Summary: Production-ready Python Agent framework with enterprise-grade reliability and observability
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: ai,llm,agent,multi-agent,rag,tooling,asyncio
8
+ Author: kongusen
9
+ Author-email: wanghaishan0210@gmail.com
10
+ Requires-Python: >=3.11,<4.0
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Framework :: AsyncIO
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Topic :: Software Development :: Libraries
23
+ Classifier: Typing :: Typed
24
+ Provides-Extra: all
25
+ Provides-Extra: anthropic
26
+ Provides-Extra: mcp
27
+ Provides-Extra: observability
28
+ Provides-Extra: openai
29
+ Provides-Extra: retrieval
30
+ Provides-Extra: system
31
+ Provides-Extra: web
32
+ Requires-Dist: anthropic (>=0.7.0,<0.8.0) ; extra == "anthropic" or extra == "all"
33
+ Requires-Dist: asyncio-throttle (>=1.0.2,<2.0.0) ; extra == "all"
34
+ Requires-Dist: cachetools (>=5.3.0,<6.0.0) ; extra == "observability" or extra == "all"
35
+ Requires-Dist: chromadb (>=0.4.0,<0.5.0) ; extra == "retrieval" or extra == "all"
36
+ Requires-Dist: docker (>=7.0.0,<8.0.0) ; extra == "system" or extra == "all"
37
+ Requires-Dist: fastapi (>=0.104.0,<0.105.0) ; extra == "web" or extra == "all"
38
+ Requires-Dist: mcp (>=0.2.0,<0.3.0) ; extra == "mcp" or extra == "all"
39
+ Requires-Dist: numpy (>=1.24.0,<2.0.0) ; extra == "retrieval" or extra == "all"
40
+ Requires-Dist: openai (>=1.6.0,<2.0.0) ; extra == "openai" or extra == "all"
41
+ Requires-Dist: pinecone-client (>=2.2,<4.0) ; extra == "retrieval" or extra == "all"
42
+ Requires-Dist: psutil (>=5.9.0,<6.0.0) ; extra == "system" or extra == "all"
43
+ Requires-Dist: pydantic (>=2.5.0,<3.0.0)
44
+ Requires-Dist: structlog (>=23.2.0,<24.0.0) ; extra == "observability" or extra == "all"
45
+ Requires-Dist: uvicorn[standard] (>=0.24.0,<0.25.0) ; extra == "web" or extra == "all"
46
+ Requires-Dist: weakref-tools (>=1.0.0,<2.0.0) ; extra == "all"
47
+ Requires-Dist: websockets (>=12.0,<13.0) ; extra == "web" or extra == "all"
48
+ Project-URL: Documentation, https://github.com/kongusen/loom-agent#readme
49
+ Project-URL: Homepage, https://github.com/kongusen/loom-agent
50
+ Project-URL: Repository, https://github.com/kongusen/loom-agent
51
+ Description-Content-Type: text/markdown
52
+
53
+ # Loom Agent
54
+
55
+ <div align="center">
56
+
57
+ **Production-ready Python Agent framework with enterprise-grade reliability and observability**
58
+
59
+ [![PyPI](https://img.shields.io/pypi/v/loom-agent.svg)](https://pypi.org/project/loom-agent/)
60
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
61
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
62
+ [![Tests](https://img.shields.io/badge/tests-18%2F18%20passing-brightgreen.svg)](tests/)
63
+
64
+ [Documentation](docs/user/user-guide.md) | [API Reference](docs/user/api-reference.md) | [Contributing](CONTRIBUTING.md)
65
+
66
+ </div>
67
+
68
+ ---
69
+
70
+ ## 🎯 What is Loom Agent?
71
+
72
+ Loom Agent is a Python framework for building reliable AI agents with production-grade features like automatic retries, context compression, persistent memory, and comprehensive observability.
73
+
74
+ **Key Features:**
75
+
76
+ - 🚀 **Simple API** - Get started with just 3 lines of code
77
+ - 🔧 **Tool System** - Easy decorator-based tool creation
78
+ - 💾 **Persistent Memory** - Cross-session conversation history
79
+ - 📊 **Observability** - Structured logging with correlation IDs
80
+ - 🛡️ **Production Ready** - Circuit breakers, retries, and failover
81
+ - ⚡ **High Performance** - Parallel tool execution and smart context compression
82
+ - 🌐 **Multi-LLM** - OpenAI, Anthropic, and more
83
+
84
+ ## 📦 Installation
85
+
86
+ ```bash
87
+ # Basic installation
88
+ pip install loom-agent
89
+
90
+ # With OpenAI support
91
+ pip install loom-agent[openai]
92
+
93
+ # With all features
94
+ pip install loom-agent[all]
95
+ ```
96
+
97
+ **Requirements:** Python 3.11+
98
+
99
+ ## 🚀 Quick Start
100
+
101
+ ### Basic Agent
102
+
103
+ ```python
104
+ import asyncio
105
+ from loom import agent
106
+ from loom.builtin.llms import MockLLM
107
+
108
+ async def main():
109
+ # Create an agent
110
+ my_agent = agent(llm=MockLLM())
111
+
112
+ # Run it
113
+ result = await my_agent.run("Hello, world!")
114
+ print(result)
115
+
116
+ asyncio.run(main())
117
+ ```
118
+
119
+ ### With OpenAI
120
+
121
+ ```python
122
+ from loom import agent
123
+
124
+ # Create agent with OpenAI
125
+ my_agent = agent(
126
+ provider="openai",
127
+ model="gpt-4",
128
+ api_key="sk-..." # or set OPENAI_API_KEY env var
129
+ )
130
+
131
+ result = await my_agent.run("What is the capital of France?")
132
+ print(result)
133
+ ```
134
+
135
+ ### Custom Tools
136
+
137
+ ```python
138
+ from loom import agent, tool
139
+
140
+ @tool()
141
+ def add(a: int, b: int) -> int:
142
+ """Add two numbers together"""
143
+ return a + b
144
+
145
+ my_agent = agent(
146
+ provider="openai",
147
+ model="gpt-4",
148
+ tools=[add()]
149
+ )
150
+
151
+ result = await my_agent.run("What is 15 plus 27?")
152
+ print(result)
153
+ ```
154
+
155
+ ## 📚 Documentation
156
+
157
+ - **[Getting Started](docs/user/getting-started.md)** - Your first Loom agent in 5 minutes
158
+ - **[User Guide](docs/user/user-guide.md)** - Complete usage documentation
159
+ - **[API Reference](docs/user/api-reference.md)** - Detailed API documentation
160
+ - **[Contributing Guide](CONTRIBUTING.md)** - How to contribute
161
+
162
+ ## 🛠️ Core Components
163
+
164
+ ### Agent Builder
165
+ ```python
166
+ from loom import agent
167
+
168
+ my_agent = agent(
169
+ provider="openai", # LLM provider
170
+ model="gpt-4", # Model name
171
+ tools=[...], # Custom tools
172
+ memory=..., # Memory system
173
+ callbacks=[...] # Observability
174
+ )
175
+ ```
176
+
177
+ ### Tool Decorator
178
+ ```python
179
+ from loom import tool
180
+
181
+ @tool(description="Fetch weather data")
182
+ def get_weather(city: str) -> dict:
183
+ return {"temp": 72, "condition": "sunny"}
184
+ ```
185
+
186
+ ### Memory System
187
+ ```python
188
+ from loom import PersistentMemory
189
+
190
+ memory = PersistentMemory() # Conversations persist across restarts
191
+ agent = agent(llm=..., memory=memory)
192
+ ```
193
+
194
+ ### Observability
195
+ ```python
196
+ from loom import ObservabilityCallback, MetricsAggregator
197
+
198
+ obs = ObservabilityCallback()
199
+ metrics = MetricsAggregator()
200
+
201
+ agent = agent(llm=..., callbacks=[obs, metrics])
202
+ ```
203
+
204
+ ## 🎯 Supported Platforms
205
+
206
+ - **Python:** 3.11, 3.12
207
+ - **Operating Systems:** Linux, macOS, Windows
208
+ - **LLM Providers:** OpenAI, Anthropic, Ollama
209
+
210
+ ## ⚠️ Alpha Release Notice
211
+
212
+ **This is v0.0.1 - our first Alpha release!**
213
+
214
+ While Loom Agent includes production-grade features, this is an early release. You may experience:
215
+
216
+ - API changes in future versions
217
+ - Incomplete edge case handling
218
+ - Evolving documentation
219
+
220
+ We welcome your feedback and contributions to help improve the framework!
221
+
222
+ **What works well:**
223
+ - ✅ Core agent execution
224
+ - ✅ Tool system and decorators
225
+ - ✅ Basic memory and context management
226
+ - ✅ OpenAI integration
227
+ - ✅ Structured logging
228
+
229
+ **Coming soon:**
230
+ - More LLM provider integrations
231
+ - Enhanced tool library
232
+ - Performance optimizations
233
+ - Additional examples and tutorials
234
+
235
+ ## 🤝 Contributing
236
+
237
+ We welcome contributions! Here's how to get started:
238
+
239
+ 1. Fork the repository
240
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
241
+ 3. Make your changes and add tests
242
+ 4. Run tests: `poetry run pytest`
243
+ 5. Submit a pull request
244
+
245
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
246
+
247
+ ## 📊 Project Status
248
+
249
+ - **Version:** 0.0.1 (Alpha)
250
+ - **Status:** Active Development
251
+ - **Tests:** 18/18 passing ✅
252
+ - **Python:** 3.11+ supported
253
+
254
+ ## 🗺️ Roadmap
255
+
256
+ ### v0.1.0 (Planned)
257
+ - API stabilization
258
+ - More examples and tutorials
259
+ - Performance optimizations
260
+ - Extended documentation
261
+
262
+ ### v0.2.0 (Planned)
263
+ - Additional LLM providers
264
+ - Plugin system
265
+ - Web UI for debugging
266
+
267
+ ### v1.0.0 (Goal)
268
+ - Stable API
269
+ - Production-grade quality
270
+ - Comprehensive documentation
271
+ - Community ecosystem
272
+
273
+ ## 📄 License
274
+
275
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
276
+
277
+ ## 🔗 Links
278
+
279
+ - **PyPI:** https://pypi.org/project/loom-agent/
280
+ - **GitHub:** https://github.com/kongusen/loom-agent
281
+ - **Issues:** https://github.com/kongusen/loom-agent/issues
282
+ - **Releases:** [v0.0.1](releases/v0.0.1.md)
283
+
284
+ ## 🙏 Acknowledgments
285
+
286
+ Special thanks to the Claude Code project for inspiration and to all early testers and contributors!
287
+
288
+ ---
289
+
290
+ **Built with ❤️ for the AI community**
291
+
292
+ <div align="center">
293
+ <sub>If you find Loom Agent useful, please consider giving it a ⭐ on GitHub!</sub>
294
+ </div>
295
+
@@ -0,0 +1,242 @@
1
+ # Loom Agent
2
+
3
+ <div align="center">
4
+
5
+ **Production-ready Python Agent framework with enterprise-grade reliability and observability**
6
+
7
+ [![PyPI](https://img.shields.io/pypi/v/loom-agent.svg)](https://pypi.org/project/loom-agent/)
8
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
+ [![Tests](https://img.shields.io/badge/tests-18%2F18%20passing-brightgreen.svg)](tests/)
11
+
12
+ [Documentation](docs/user/user-guide.md) | [API Reference](docs/user/api-reference.md) | [Contributing](CONTRIBUTING.md)
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ ## 🎯 What is Loom Agent?
19
+
20
+ Loom Agent is a Python framework for building reliable AI agents with production-grade features like automatic retries, context compression, persistent memory, and comprehensive observability.
21
+
22
+ **Key Features:**
23
+
24
+ - 🚀 **Simple API** - Get started with just 3 lines of code
25
+ - 🔧 **Tool System** - Easy decorator-based tool creation
26
+ - 💾 **Persistent Memory** - Cross-session conversation history
27
+ - 📊 **Observability** - Structured logging with correlation IDs
28
+ - 🛡️ **Production Ready** - Circuit breakers, retries, and failover
29
+ - ⚡ **High Performance** - Parallel tool execution and smart context compression
30
+ - 🌐 **Multi-LLM** - OpenAI, Anthropic, and more
31
+
32
+ ## 📦 Installation
33
+
34
+ ```bash
35
+ # Basic installation
36
+ pip install loom-agent
37
+
38
+ # With OpenAI support
39
+ pip install loom-agent[openai]
40
+
41
+ # With all features
42
+ pip install loom-agent[all]
43
+ ```
44
+
45
+ **Requirements:** Python 3.11+
46
+
47
+ ## 🚀 Quick Start
48
+
49
+ ### Basic Agent
50
+
51
+ ```python
52
+ import asyncio
53
+ from loom import agent
54
+ from loom.builtin.llms import MockLLM
55
+
56
+ async def main():
57
+ # Create an agent
58
+ my_agent = agent(llm=MockLLM())
59
+
60
+ # Run it
61
+ result = await my_agent.run("Hello, world!")
62
+ print(result)
63
+
64
+ asyncio.run(main())
65
+ ```
66
+
67
+ ### With OpenAI
68
+
69
+ ```python
70
+ from loom import agent
71
+
72
+ # Create agent with OpenAI
73
+ my_agent = agent(
74
+ provider="openai",
75
+ model="gpt-4",
76
+ api_key="sk-..." # or set OPENAI_API_KEY env var
77
+ )
78
+
79
+ result = await my_agent.run("What is the capital of France?")
80
+ print(result)
81
+ ```
82
+
83
+ ### Custom Tools
84
+
85
+ ```python
86
+ from loom import agent, tool
87
+
88
+ @tool()
89
+ def add(a: int, b: int) -> int:
90
+ """Add two numbers together"""
91
+ return a + b
92
+
93
+ my_agent = agent(
94
+ provider="openai",
95
+ model="gpt-4",
96
+ tools=[add()]
97
+ )
98
+
99
+ result = await my_agent.run("What is 15 plus 27?")
100
+ print(result)
101
+ ```
102
+
103
+ ## 📚 Documentation
104
+
105
+ - **[Getting Started](docs/user/getting-started.md)** - Your first Loom agent in 5 minutes
106
+ - **[User Guide](docs/user/user-guide.md)** - Complete usage documentation
107
+ - **[API Reference](docs/user/api-reference.md)** - Detailed API documentation
108
+ - **[Contributing Guide](CONTRIBUTING.md)** - How to contribute
109
+
110
+ ## 🛠️ Core Components
111
+
112
+ ### Agent Builder
113
+ ```python
114
+ from loom import agent
115
+
116
+ my_agent = agent(
117
+ provider="openai", # LLM provider
118
+ model="gpt-4", # Model name
119
+ tools=[...], # Custom tools
120
+ memory=..., # Memory system
121
+ callbacks=[...] # Observability
122
+ )
123
+ ```
124
+
125
+ ### Tool Decorator
126
+ ```python
127
+ from loom import tool
128
+
129
+ @tool(description="Fetch weather data")
130
+ def get_weather(city: str) -> dict:
131
+ return {"temp": 72, "condition": "sunny"}
132
+ ```
133
+
134
+ ### Memory System
135
+ ```python
136
+ from loom import PersistentMemory
137
+
138
+ memory = PersistentMemory() # Conversations persist across restarts
139
+ agent = agent(llm=..., memory=memory)
140
+ ```
141
+
142
+ ### Observability
143
+ ```python
144
+ from loom import ObservabilityCallback, MetricsAggregator
145
+
146
+ obs = ObservabilityCallback()
147
+ metrics = MetricsAggregator()
148
+
149
+ agent = agent(llm=..., callbacks=[obs, metrics])
150
+ ```
151
+
152
+ ## 🎯 Supported Platforms
153
+
154
+ - **Python:** 3.11, 3.12
155
+ - **Operating Systems:** Linux, macOS, Windows
156
+ - **LLM Providers:** OpenAI, Anthropic, Ollama
157
+
158
+ ## ⚠️ Alpha Release Notice
159
+
160
+ **This is v0.0.1 - our first Alpha release!**
161
+
162
+ While Loom Agent includes production-grade features, this is an early release. You may experience:
163
+
164
+ - API changes in future versions
165
+ - Incomplete edge case handling
166
+ - Evolving documentation
167
+
168
+ We welcome your feedback and contributions to help improve the framework!
169
+
170
+ **What works well:**
171
+ - ✅ Core agent execution
172
+ - ✅ Tool system and decorators
173
+ - ✅ Basic memory and context management
174
+ - ✅ OpenAI integration
175
+ - ✅ Structured logging
176
+
177
+ **Coming soon:**
178
+ - More LLM provider integrations
179
+ - Enhanced tool library
180
+ - Performance optimizations
181
+ - Additional examples and tutorials
182
+
183
+ ## 🤝 Contributing
184
+
185
+ We welcome contributions! Here's how to get started:
186
+
187
+ 1. Fork the repository
188
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
189
+ 3. Make your changes and add tests
190
+ 4. Run tests: `poetry run pytest`
191
+ 5. Submit a pull request
192
+
193
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
194
+
195
+ ## 📊 Project Status
196
+
197
+ - **Version:** 0.0.1 (Alpha)
198
+ - **Status:** Active Development
199
+ - **Tests:** 18/18 passing ✅
200
+ - **Python:** 3.11+ supported
201
+
202
+ ## 🗺️ Roadmap
203
+
204
+ ### v0.1.0 (Planned)
205
+ - API stabilization
206
+ - More examples and tutorials
207
+ - Performance optimizations
208
+ - Extended documentation
209
+
210
+ ### v0.2.0 (Planned)
211
+ - Additional LLM providers
212
+ - Plugin system
213
+ - Web UI for debugging
214
+
215
+ ### v1.0.0 (Goal)
216
+ - Stable API
217
+ - Production-grade quality
218
+ - Comprehensive documentation
219
+ - Community ecosystem
220
+
221
+ ## 📄 License
222
+
223
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
224
+
225
+ ## 🔗 Links
226
+
227
+ - **PyPI:** https://pypi.org/project/loom-agent/
228
+ - **GitHub:** https://github.com/kongusen/loom-agent
229
+ - **Issues:** https://github.com/kongusen/loom-agent/issues
230
+ - **Releases:** [v0.0.1](releases/v0.0.1.md)
231
+
232
+ ## 🙏 Acknowledgments
233
+
234
+ Special thanks to the Claude Code project for inspiration and to all early testers and contributors!
235
+
236
+ ---
237
+
238
+ **Built with ❤️ for the AI community**
239
+
240
+ <div align="center">
241
+ <sub>If you find Loom Agent useful, please consider giving it a ⭐ on GitHub!</sub>
242
+ </div>
@@ -18,6 +18,10 @@ class Calculator(BaseTool):
18
18
  description = "Evaluate simple arithmetic expressions"
19
19
  args_schema = CalcArgs
20
20
 
21
+ # 🆕 Loom 2.0 - Orchestration attributes
22
+ is_read_only = True # Pure computation, no side effects
23
+ category = "general"
24
+
21
25
  async def run(self, **kwargs) -> Any:
22
26
  expr = kwargs.get("expression", "")
23
27
  return str(_safe_eval(expr))
@@ -48,6 +48,11 @@ class DocumentSearchTool(BaseTool):
48
48
  """
49
49
 
50
50
  name = "search_documents"
51
+
52
+ # 🆕 Loom 2.0 - Orchestration attributes
53
+ is_read_only = True # Only searches documents, no modifications
54
+ category = "general"
55
+
51
56
  description = (
52
57
  "Search for relevant documents from the knowledge base. "
53
58
  "Use this when you need specific information that might be in the documents. "
@@ -19,6 +19,10 @@ class GlobTool(BaseTool):
19
19
  description = "按模式匹配文件路径"
20
20
  args_schema = GlobArgs
21
21
 
22
+ # 🆕 Loom 2.0 - Orchestration attributes
23
+ is_read_only = True
24
+ category = "general"
25
+
22
26
  async def run(self, **kwargs) -> Any:
23
27
  args = self.args_schema(**kwargs) # type: ignore
24
28
  cwd = Path(args.cwd).expanduser() if args.cwd else Path.cwd()
@@ -22,6 +22,10 @@ class GrepTool(BaseTool):
22
22
  description = "在文件或文件集内检索正则匹配"
23
23
  args_schema = GrepArgs
24
24
 
25
+ # 🆕 Loom 2.0 - Orchestration attributes
26
+ is_read_only = True
27
+ category = "general"
28
+
25
29
  async def run(self, **kwargs) -> Any:
26
30
  args = self.args_schema(**kwargs) # type: ignore
27
31
  flags = 0
@@ -35,6 +35,11 @@ class HTTPRequestTool(BaseTool):
35
35
  args_schema = HTTPRequestInput
36
36
  is_concurrency_safe = True
37
37
 
38
+ # 🆕 Loom 2.0 - Orchestration attributes
39
+ is_read_only = False # POST/PUT/DELETE may modify remote state
40
+ category = "network" # Network operation
41
+ requires_confirmation = False # Usually safe, but depends on usage
42
+
38
43
  def __init__(self, timeout: int = 10) -> None:
39
44
  if httpx is None:
40
45
  raise ImportError("Please install httpx: pip install httpx")
@@ -33,6 +33,11 @@ class PythonREPLTool(BaseTool):
33
33
  args_schema = PythonREPLInput
34
34
  is_concurrency_safe = False # 代码执行不并发安全
35
35
 
36
+ # 🆕 Loom 2.0 - Orchestration attributes
37
+ is_read_only = False # Code execution may have side effects
38
+ category = "destructive" # Potentially dangerous
39
+ requires_confirmation = True # Should require user confirmation
40
+
36
41
  async def run(self, code: str, **kwargs: Any) -> str:
37
42
  """执行 Python 代码"""
38
43
  # 安全性检查 - 禁止危险操作
@@ -19,6 +19,10 @@ class ReadFileTool(BaseTool):
19
19
  description = "读取文本文件内容"
20
20
  args_schema = ReadArgs
21
21
 
22
+ # 🆕 Loom 2.0 - Orchestration attributes
23
+ is_read_only = True
24
+ category = "general"
25
+
22
26
  async def run(self, **kwargs) -> Any:
23
27
  args = self.args_schema(**kwargs) # type: ignore
24
28
  p = Path(args.path).expanduser()
@@ -47,6 +47,11 @@ class TaskTool(BaseTool):
47
47
  args_schema = TaskInput
48
48
  is_concurrency_safe = True
49
49
 
50
+ # 🆕 Loom 2.0 - Orchestration attributes
51
+ is_read_only = False # Sub-agent may use write tools
52
+ category = "general" # Not inherently dangerous, but depends on sub-agent's tools
53
+ requires_confirmation = False
54
+
50
55
  def __init__(
51
56
  self,
52
57
  agent_factory: Optional[callable] = None,
@@ -33,6 +33,10 @@ class WebSearchTool(BaseTool):
33
33
  args_schema = WebSearchInput
34
34
  is_concurrency_safe = True
35
35
 
36
+ # 🆕 Loom 2.0 - Orchestration attributes
37
+ is_read_only = True # Only reads from web, no local side effects
38
+ category = "network"
39
+
36
40
  def __init__(self) -> None:
37
41
  if DDGS is None:
38
42
  raise ImportError(
@@ -20,6 +20,10 @@ class WriteFileTool(BaseTool):
20
20
  description = "写入文本到文件(可能覆盖)"
21
21
  args_schema = WriteArgs
22
22
 
23
+ # 🆕 Loom 2.0 - Orchestration attributes
24
+ is_read_only = False
25
+ category = "destructive"
26
+
23
27
  async def run(self, **kwargs) -> Any:
24
28
  args = self.args_schema(**kwargs) # type: ignore
25
29
  p = Path(args.path).expanduser()