jarviscore-framework 0.1.1__py3-none-any.whl → 0.2.1__py3-none-any.whl

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.
Files changed (86) hide show
  1. examples/autoagent_distributed_example.py +211 -0
  2. examples/custom_profile_decorator.py +134 -0
  3. examples/custom_profile_wrap.py +168 -0
  4. examples/customagent_distributed_example.py +362 -0
  5. examples/customagent_p2p_example.py +730 -0
  6. jarviscore/__init__.py +49 -36
  7. jarviscore/adapter/__init__.py +15 -9
  8. jarviscore/adapter/decorator.py +23 -19
  9. jarviscore/adapter/wrapper.py +303 -0
  10. jarviscore/cli/scaffold.py +1 -1
  11. jarviscore/cli/smoketest.py +3 -2
  12. jarviscore/core/agent.py +44 -1
  13. jarviscore/core/mesh.py +196 -35
  14. jarviscore/data/examples/autoagent_distributed_example.py +211 -0
  15. jarviscore/data/examples/customagent_distributed_example.py +362 -0
  16. jarviscore/data/examples/customagent_p2p_example.py +730 -0
  17. jarviscore/docs/API_REFERENCE.md +264 -51
  18. jarviscore/docs/AUTOAGENT_GUIDE.md +198 -0
  19. jarviscore/docs/CONFIGURATION.md +35 -21
  20. jarviscore/docs/CUSTOMAGENT_GUIDE.md +1362 -0
  21. jarviscore/docs/GETTING_STARTED.md +107 -14
  22. jarviscore/docs/TROUBLESHOOTING.md +145 -7
  23. jarviscore/docs/USER_GUIDE.md +138 -361
  24. jarviscore/orchestration/engine.py +20 -8
  25. jarviscore/p2p/__init__.py +10 -0
  26. jarviscore/p2p/coordinator.py +129 -0
  27. jarviscore/p2p/messages.py +87 -0
  28. jarviscore/p2p/peer_client.py +576 -0
  29. jarviscore/p2p/peer_tool.py +268 -0
  30. jarviscore_framework-0.2.1.dist-info/METADATA +144 -0
  31. jarviscore_framework-0.2.1.dist-info/RECORD +132 -0
  32. {jarviscore_framework-0.1.1.dist-info → jarviscore_framework-0.2.1.dist-info}/WHEEL +1 -1
  33. {jarviscore_framework-0.1.1.dist-info → jarviscore_framework-0.2.1.dist-info}/top_level.txt +1 -0
  34. test_logs/code_registry/functions/data_generator-558779ed_560ebc37.py +7 -0
  35. test_logs/code_registry/functions/data_generator-5ed3609e_560ebc37.py +7 -0
  36. test_logs/code_registry/functions/data_generator-66da0356_43970bb9.py +25 -0
  37. test_logs/code_registry/functions/data_generator-7a2fac83_583709d9.py +36 -0
  38. test_logs/code_registry/functions/data_generator-888b670f_aa235863.py +9 -0
  39. test_logs/code_registry/functions/data_generator-9ca5f642_aa235863.py +9 -0
  40. test_logs/code_registry/functions/data_generator-bfd90775_560ebc37.py +7 -0
  41. test_logs/code_registry/functions/data_generator-e95d2f7d_aa235863.py +9 -0
  42. test_logs/code_registry/functions/data_generator-f60ca8a2_327eb8c2.py +29 -0
  43. test_logs/code_registry/functions/mathematician-02adf9ee_958658d9.py +19 -0
  44. test_logs/code_registry/functions/mathematician-0706fb57_5df13441.py +23 -0
  45. test_logs/code_registry/functions/mathematician-153c9c4a_ba59c918.py +83 -0
  46. test_logs/code_registry/functions/mathematician-287e61c0_41daa793.py +18 -0
  47. test_logs/code_registry/functions/mathematician-2967af5a_863c2cc6.py +17 -0
  48. test_logs/code_registry/functions/mathematician-303ca6d6_5df13441.py +23 -0
  49. test_logs/code_registry/functions/mathematician-308a4afd_cbf5064d.py +73 -0
  50. test_logs/code_registry/functions/mathematician-353f16e2_0968bcf5.py +18 -0
  51. test_logs/code_registry/functions/mathematician-3c22475a_41daa793.py +17 -0
  52. test_logs/code_registry/functions/mathematician-5bac1029_0968bcf5.py +18 -0
  53. test_logs/code_registry/functions/mathematician-640f76b2_9198780b.py +19 -0
  54. test_logs/code_registry/functions/mathematician-752fa7ea_863c2cc6.py +17 -0
  55. test_logs/code_registry/functions/mathematician-baf9ef39_0968bcf5.py +18 -0
  56. test_logs/code_registry/functions/mathematician-bc8b2a2f_5df13441.py +23 -0
  57. test_logs/code_registry/functions/mathematician-c31e4686_41daa793.py +18 -0
  58. test_logs/code_registry/functions/mathematician-cc84c84c_863c2cc6.py +17 -0
  59. test_logs/code_registry/functions/mathematician-dd7c7144_9198780b.py +19 -0
  60. test_logs/code_registry/functions/mathematician-e671c256_41ea4487.py +74 -0
  61. test_logs/code_registry/functions/report_generator-1a878fcc_18d44bdc.py +47 -0
  62. test_logs/code_registry/functions/report_generator-25c1c331_cea57d0d.py +35 -0
  63. test_logs/code_registry/functions/report_generator-37552117_e711c2b9.py +35 -0
  64. test_logs/code_registry/functions/report_generator-bc662768_e711c2b9.py +35 -0
  65. test_logs/code_registry/functions/report_generator-d6c0e76b_5e7722ec.py +44 -0
  66. test_logs/code_registry/functions/report_generator-f270fb02_680529c3.py +44 -0
  67. test_logs/code_registry/functions/text_processor-11393b14_4370d3ed.py +40 -0
  68. test_logs/code_registry/functions/text_processor-7d02dfc3_d3b569be.py +37 -0
  69. test_logs/code_registry/functions/text_processor-8adb5e32_9168c5fe.py +13 -0
  70. test_logs/code_registry/functions/text_processor-c58ffc19_78b4ceac.py +42 -0
  71. test_logs/code_registry/functions/text_processor-cd5977b1_9168c5fe.py +13 -0
  72. test_logs/code_registry/functions/text_processor-ec1c8773_9168c5fe.py +13 -0
  73. tests/test_01_analyst_standalone.py +124 -0
  74. tests/test_02_assistant_standalone.py +164 -0
  75. tests/test_03_analyst_with_framework.py +945 -0
  76. tests/test_04_assistant_with_framework.py +1002 -0
  77. tests/test_05_integration.py +1301 -0
  78. tests/test_06_real_llm_integration.py +760 -0
  79. tests/test_07_distributed_single_node.py +578 -0
  80. tests/test_08_distributed_multi_node.py +454 -0
  81. tests/test_09_distributed_autoagent.py +509 -0
  82. tests/test_10_distributed_customagent.py +787 -0
  83. tests/test_mesh.py +35 -4
  84. jarviscore_framework-0.1.1.dist-info/METADATA +0 -137
  85. jarviscore_framework-0.1.1.dist-info/RECORD +0 -69
  86. {jarviscore_framework-0.1.1.dist-info → jarviscore_framework-0.2.1.dist-info}/licenses/LICENSE +0 -0
@@ -4,11 +4,32 @@ Build your first AI agent in 5 minutes!
4
4
 
5
5
  ---
6
6
 
7
+ ## Choose Your Path
8
+
9
+ ### Profiles (How agents execute)
10
+
11
+ | Profile | Best For | LLM Required |
12
+ |---------|----------|--------------|
13
+ | **AutoAgent** | Rapid prototyping, LLM generates code from prompts | Yes |
14
+ | **CustomAgent** | Existing code, full control (LangChain, CrewAI, etc.) | Optional |
15
+
16
+ ### Execution Modes (How agents are orchestrated)
17
+
18
+ | Mode | Use Case | Start Here |
19
+ |------|----------|------------|
20
+ | **Autonomous** | Single machine, simple pipelines | ✅ This guide |
21
+ | **P2P** | Direct agent communication, swarms | [CustomAgent Guide](CUSTOMAGENT_GUIDE.md) |
22
+ | **Distributed** | Multi-node production systems | [AutoAgent Guide](AUTOAGENT_GUIDE.md) |
23
+
24
+ **Recommendation:** Start with **AutoAgent + Autonomous mode** below, then explore other modes.
25
+
26
+ ---
27
+
7
28
  ## What You'll Build
8
29
 
9
30
  An **AutoAgent** that takes natural language prompts and automatically:
10
31
  1. Generates Python code using an LLM
11
- 2. Executes the code securely
32
+ 2. Executes the code securely in a sandbox
12
33
  3. Returns the result
13
34
 
14
35
  **No manual coding required** - just describe what you want!
@@ -178,6 +199,56 @@ Execution time: 4.23s
178
199
 
179
200
  ---
180
201
 
202
+ ## Step 5: Try CustomAgent (Alternative Path)
203
+
204
+ If you have existing agents or don't need LLM code generation, use **CustomAgent**:
205
+
206
+ ```python
207
+ import asyncio
208
+ from jarviscore import Mesh
209
+ from jarviscore.profiles import CustomAgent
210
+
211
+
212
+ class MyAgent(CustomAgent):
213
+ role = "processor"
214
+ capabilities = ["data_processing"]
215
+
216
+ async def execute_task(self, task):
217
+ """Your existing logic goes here."""
218
+ data = task.get("params", {}).get("data", [])
219
+ result = [x * 2 for x in data]
220
+ return {"status": "success", "output": result}
221
+
222
+
223
+ async def main():
224
+ # CustomAgent uses "distributed" (workflow + P2P) or "p2p" (P2P only)
225
+ mesh = Mesh(mode="distributed", config={
226
+ 'bind_port': 7950,
227
+ 'node_name': 'custom-node',
228
+ })
229
+ mesh.add(MyAgent)
230
+ await mesh.start()
231
+
232
+ results = await mesh.workflow("custom-demo", [
233
+ {"agent": "processor", "task": "Process data", "params": {"data": [1, 2, 3]}}
234
+ ])
235
+
236
+ print(results[0]["output"]) # [2, 4, 6]
237
+ await mesh.stop()
238
+
239
+
240
+ asyncio.run(main())
241
+ ```
242
+
243
+ **Key Benefits:**
244
+ - No LLM API required (no costs!)
245
+ - Keep your existing logic
246
+ - Works with any framework (LangChain, CrewAI, etc.)
247
+
248
+ **For more:** See [CustomAgent Guide](CUSTOMAGENT_GUIDE.md) for P2P mode and multi-node examples.
249
+
250
+ ---
251
+
181
252
  ## What Just Happened?
182
253
 
183
254
  Behind the scenes, JarvisCore:
@@ -199,7 +270,7 @@ All from a single natural language prompt!
199
270
 
200
271
  ---
201
272
 
202
- ## Step 5: Try More Complex Examples
273
+ ## Step 5: Try More Complex AutoAgent Profile Examples
203
274
 
204
275
  ### Example 1: Data Processing
205
276
 
@@ -305,19 +376,42 @@ class MyAgent(AutoAgent):
305
376
  system_prompt = "Instructions for the LLM" # How to generate code
306
377
  ```
307
378
 
308
- ### 2. Mesh
379
+ ### 2. CustomAgent Profile
380
+
381
+ The `CustomAgent` profile lets you bring your own execution logic:
382
+
383
+ ```python
384
+ class MyAgent(CustomAgent):
385
+ role = "unique_name"
386
+ capabilities = ["skill1", "skill2"]
387
+
388
+ async def execute_task(self, task): # For workflow steps (distributed)
389
+ return {"status": "success", "output": ...}
390
+
391
+ async def run(self): # For continuous loop (p2p)
392
+ while not self.shutdown_requested:
393
+ msg = await self.peers.receive(timeout=0.5)
394
+ ...
395
+ ```
396
+
397
+ ### 3. Mesh
309
398
 
310
399
  The `Mesh` is the orchestrator that manages agents and workflows:
311
400
 
312
401
  ```python
313
- mesh = Mesh(mode="autonomous") # Autonomous mode for AutoAgent
402
+ mesh = Mesh(mode="autonomous") # Or "p2p", "distributed"
314
403
  mesh.add(MyAgent) # Register your agent
315
404
  await mesh.start() # Initialize
316
405
  results = await mesh.workflow(...) # Execute tasks
317
406
  await mesh.stop() # Cleanup
318
407
  ```
319
408
 
320
- ### 3. Workflow
409
+ **Modes:**
410
+ - `autonomous`: Workflow engine only (AutoAgent)
411
+ - `p2p`: P2P coordinator for agent-to-agent communication (CustomAgent)
412
+ - `distributed`: Both workflow engine AND P2P (CustomAgent)
413
+
414
+ ### 4. Workflow
321
415
 
322
416
  A workflow is a list of tasks to execute:
323
417
 
@@ -331,7 +425,7 @@ results = await mesh.workflow("workflow-id", [
331
425
  ])
332
426
  ```
333
427
 
334
- ### 4. Results
428
+ ### 5. Results
335
429
 
336
430
  Each task returns a result dict:
337
431
 
@@ -497,11 +591,12 @@ Check `repairs` in the result to see how many fixes were needed.
497
591
 
498
592
  ## Next Steps
499
593
 
500
- 1. **Read the User Guide**: Complete documentation at [USER_GUIDE.md](USER_GUIDE.md)
501
- 2. **Explore Examples**: Check out `examples/` directory
502
- 3. **Try the API Reference**: [API_REFERENCE.md](API_REFERENCE.md)
503
- 4. **Configuration Guide**: [CONFIGURATION.md](CONFIGURATION.md)
504
- 5. **Troubleshooting**: [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
594
+ 1. **AutoAgent Guide**: Multi-node distributed mode [AUTOAGENT_GUIDE.md](AUTOAGENT_GUIDE.md)
595
+ 2. **CustomAgent Guide**: P2P and distributed with your code → [CUSTOMAGENT_GUIDE.md](CUSTOMAGENT_GUIDE.md)
596
+ 3. **User Guide**: Complete documentation [USER_GUIDE.md](USER_GUIDE.md)
597
+ 4. **API Reference**: [API_REFERENCE.md](API_REFERENCE.md)
598
+ 5. **Configuration**: [CONFIGURATION.md](CONFIGURATION.md)
599
+ 6. **Examples**: Check out `examples/` directory
505
600
 
506
601
  ---
507
602
 
@@ -594,10 +689,8 @@ Need help?
594
689
  python -m jarviscore.cli.smoketest --verbose
595
690
  ```
596
691
  3. **Check logs**: `cat logs/<agent>/<latest>.json`
597
- 4. **Report issues**: [GitHub Issues](https://github.com/yourusername/jarviscore/issues)
692
+ 4. **Report issues**: [GitHub Issues](https://github.com/Prescott-Data/jarviscore-framework/issues)
598
693
 
599
694
  ---
600
695
 
601
696
  **🚀 Happy building with JarvisCore!**
602
-
603
- *Built for the AutoAgent/Prompt-Dev generation - where AI writes the code, you write the prompts.*
@@ -1,6 +1,6 @@
1
1
  # JarvisCore Troubleshooting Guide
2
2
 
3
- Common issues and solutions for AutoAgent/Prompt-Dev users.
3
+ Common issues and solutions for AutoAgent and CustomAgent users.
4
4
 
5
5
  ---
6
6
 
@@ -199,7 +199,68 @@ await mesh.workflow("wf-1", [
199
199
 
200
200
  ---
201
201
 
202
- ### 5. Environment Issues
202
+ ### 5. CustomAgent Issues
203
+
204
+ #### Issue: `execute_task not called`
205
+
206
+ **Cause:** Wrong mode for your use case
207
+
208
+ **Solution:**
209
+ ```python
210
+ # For workflow orchestration (autonomous/distributed modes)
211
+ class MyAgent(CustomAgent):
212
+ async def execute_task(self, task): # Called by workflow engine
213
+ return {"status": "success", "output": ...}
214
+
215
+ # For P2P mode, use run() instead
216
+ class MyAgent(CustomAgent):
217
+ async def run(self): # Called in P2P mode
218
+ while not self.shutdown_requested:
219
+ msg = await self.peers.receive(timeout=0.5)
220
+ ...
221
+ ```
222
+
223
+ #### Issue: `self.peers is None`
224
+
225
+ **Cause:** Agent not in P2P or distributed mode
226
+
227
+ **Solution:**
228
+ ```python
229
+ # Ensure mesh is in p2p or distributed mode
230
+ mesh = Mesh(mode="distributed", config={ # or "p2p"
231
+ 'bind_port': 7950,
232
+ 'node_name': 'my-node',
233
+ })
234
+
235
+ # Check peers is available before using
236
+ if self.peers:
237
+ result = await self.peers.as_tool().execute("ask_peer", {...})
238
+ ```
239
+
240
+ #### Issue: `No response from peer`
241
+
242
+ **Cause:** Target agent not listening or wrong role
243
+
244
+ **Solution:**
245
+ ```python
246
+ # Ensure target agent is running its run() loop
247
+ # In researcher agent:
248
+ async def run(self):
249
+ while not self.shutdown_requested:
250
+ msg = await self.peers.receive(timeout=0.5)
251
+ if msg and msg.is_request:
252
+ await self.peers.respond(msg, {"response": ...})
253
+
254
+ # When asking, use correct role
255
+ result = await self.peers.as_tool().execute(
256
+ "ask_peer",
257
+ {"role": "researcher", "question": "..."} # Must match agent's role
258
+ )
259
+ ```
260
+
261
+ ---
262
+
263
+ ### 6. Environment Issues
203
264
 
204
265
  #### Issue: `.env file not found`
205
266
 
@@ -234,7 +295,7 @@ python your_script.py
234
295
 
235
296
  ---
236
297
 
237
- ### 6. Sandbox Configuration
298
+ ### 7. Sandbox Configuration
238
299
 
239
300
  #### Issue: `Remote sandbox connection failed`
240
301
 
@@ -259,7 +320,78 @@ python your_script.py
259
320
 
260
321
  ---
261
322
 
262
- ### 7. Performance Issues
323
+ ### 8. P2P/Distributed Mode Issues
324
+
325
+ #### Issue: `P2P coordinator failed to start`
326
+
327
+ **Cause:** Port already in use or network issue
328
+
329
+ **Solution:**
330
+ ```bash
331
+ # Check if port is in use
332
+ lsof -i :7950
333
+
334
+ # Try different port
335
+ mesh = Mesh(mode="distributed", config={
336
+ 'bind_port': 7960, # Different port
337
+ })
338
+ ```
339
+
340
+ #### Issue: `Cannot connect to seed nodes`
341
+
342
+ **Cause:** Firewall, wrong address, or seed node not running
343
+
344
+ **Solution:**
345
+ ```bash
346
+ # Check connectivity
347
+ nc -zv 192.168.1.10 7950
348
+
349
+ # Open firewall ports
350
+ sudo ufw allow 7950/tcp
351
+ sudo ufw allow 7950/udp
352
+
353
+ # Ensure seed node is running first
354
+ # On seed node:
355
+ mesh = Mesh(mode="distributed", config={
356
+ 'bind_host': '0.0.0.0', # Listen on all interfaces
357
+ 'bind_port': 7950,
358
+ })
359
+ ```
360
+
361
+ #### Issue: `Workflow not available in p2p mode`
362
+
363
+ **Cause:** P2P mode doesn't include workflow engine
364
+
365
+ **Solution:**
366
+ ```python
367
+ # Use distributed mode for both workflow + P2P
368
+ mesh = Mesh(mode="distributed", config={...})
369
+
370
+ # Or use p2p mode with run() loops instead
371
+ mesh = Mesh(mode="p2p", config={...})
372
+ await mesh.start()
373
+ await mesh.run_forever() # Agents use run() loops
374
+ ```
375
+
376
+ #### Issue: `Agents not discovering each other`
377
+
378
+ **Cause:** Network configuration or timing
379
+
380
+ **Solution:**
381
+ ```python
382
+ # Wait for mesh to stabilize after start
383
+ await mesh.start()
384
+ await asyncio.sleep(1) # Give time for peer discovery
385
+
386
+ # Check if peers are available
387
+ agent = mesh.get_agent("my_role")
388
+ if agent.peers:
389
+ print("Peers available")
390
+ ```
391
+
392
+ ---
393
+
394
+ ### 9. Performance Issues
263
395
 
264
396
  #### Issue: Code generation is slow (>10 seconds)
265
397
 
@@ -295,7 +427,7 @@ python your_script.py
295
427
 
296
428
  ---
297
429
 
298
- ### 8. Testing Issues
430
+ ### 9. Testing Issues
299
431
 
300
432
  #### Issue: Smoke test fails but examples work
301
433
 
@@ -371,7 +503,7 @@ If issues persist:
371
503
  - Minimal code to reproduce issue
372
504
 
373
505
  4. **Create an issue:**
374
- - GitHub: https://github.com/yourusername/jarviscore/issues
506
+ - GitHub: https://github.com/Prescott-Data/jarviscore-framework/issues
375
507
  - Include diagnostics output above
376
508
 
377
509
  ---
@@ -425,4 +557,10 @@ If significantly slower:
425
557
 
426
558
  ---
427
559
 
428
- *Last updated: 2026-01-13*
560
+ *Last updated: 2026-01-23*
561
+
562
+ ---
563
+
564
+ ## Version
565
+
566
+ Troubleshooting Guide for JarvisCore v0.2.1