jarviscore-framework 0.3.0__py3-none-any.whl → 0.3.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.
- examples/cloud_deployment_example.py +3 -3
- examples/{listeneragent_cognitive_discovery_example.py → customagent_cognitive_discovery_example.py} +6 -6
- examples/fastapi_integration_example.py +4 -4
- jarviscore/__init__.py +8 -11
- jarviscore/cli/smoketest.py +1 -1
- jarviscore/core/mesh.py +9 -0
- jarviscore/data/examples/cloud_deployment_example.py +3 -3
- jarviscore/data/examples/custom_profile_decorator.py +134 -0
- jarviscore/data/examples/custom_profile_wrap.py +168 -0
- jarviscore/data/examples/{listeneragent_cognitive_discovery_example.py → customagent_cognitive_discovery_example.py} +6 -6
- jarviscore/data/examples/fastapi_integration_example.py +4 -4
- jarviscore/docs/API_REFERENCE.md +32 -45
- jarviscore/docs/CHANGELOG.md +42 -0
- jarviscore/docs/CONFIGURATION.md +1 -1
- jarviscore/docs/CUSTOMAGENT_GUIDE.md +246 -153
- jarviscore/docs/GETTING_STARTED.md +186 -329
- jarviscore/docs/TROUBLESHOOTING.md +1 -1
- jarviscore/docs/USER_GUIDE.md +8 -9
- jarviscore/integrations/fastapi.py +4 -4
- jarviscore/p2p/peer_client.py +29 -2
- jarviscore/profiles/__init__.py +2 -4
- jarviscore/profiles/customagent.py +295 -74
- {jarviscore_framework-0.3.0.dist-info → jarviscore_framework-0.3.1.dist-info}/METADATA +61 -46
- {jarviscore_framework-0.3.0.dist-info → jarviscore_framework-0.3.1.dist-info}/RECORD +30 -29
- tests/test_13_dx_improvements.py +37 -37
- tests/test_15_llm_cognitive_discovery.py +18 -18
- tests/test_16_unified_dx_flow.py +3 -3
- jarviscore/profiles/listeneragent.py +0 -292
- {jarviscore_framework-0.3.0.dist-info → jarviscore_framework-0.3.1.dist-info}/WHEEL +0 -0
- {jarviscore_framework-0.3.0.dist-info → jarviscore_framework-0.3.1.dist-info}/licenses/LICENSE +0 -0
- {jarviscore_framework-0.3.0.dist-info → jarviscore_framework-0.3.1.dist-info}/top_level.txt +0 -0
jarviscore/docs/API_REFERENCE.md
CHANGED
|
@@ -14,7 +14,6 @@ Complete API documentation for JarvisCore framework components.
|
|
|
14
14
|
- [AutoAgent](#autoagent)
|
|
15
15
|
- [Custom Profile](#custom-profile)
|
|
16
16
|
- [CustomAgent](#customagent)
|
|
17
|
-
- [ListenerAgent (v0.3.0)](#listeneragent-v030)
|
|
18
17
|
3. [P2P Communication (v0.3.0)](#p2p-communication-v030)
|
|
19
18
|
- [PeerClient](#peerclient)
|
|
20
19
|
- [IncomingMessage](#incomingmessage)
|
|
@@ -564,33 +563,9 @@ See [CustomAgent Guide](CUSTOMAGENT_GUIDE.md) for P2P and distributed mode detai
|
|
|
564
563
|
|
|
565
564
|
---
|
|
566
565
|
|
|
567
|
-
|
|
566
|
+
#### P2P Message Handlers
|
|
568
567
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
#### Class: `ListenerAgent(CustomAgent)`
|
|
572
|
-
|
|
573
|
-
```python
|
|
574
|
-
from jarviscore.profiles import ListenerAgent
|
|
575
|
-
|
|
576
|
-
class MyAgent(ListenerAgent):
|
|
577
|
-
role = "processor"
|
|
578
|
-
capabilities = ["processing"]
|
|
579
|
-
|
|
580
|
-
async def on_peer_request(self, msg):
|
|
581
|
-
"""Handle incoming requests from peers."""
|
|
582
|
-
return {"result": msg.data.get("task", "").upper()}
|
|
583
|
-
|
|
584
|
-
async def on_peer_notify(self, msg):
|
|
585
|
-
"""Handle broadcast notifications."""
|
|
586
|
-
print(f"Notification: {msg.data}")
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
**Class Attributes:**
|
|
590
|
-
- `role` (str): Agent role identifier (required)
|
|
591
|
-
- `capabilities` (list): List of capability strings (required)
|
|
592
|
-
|
|
593
|
-
**Handler Methods:**
|
|
568
|
+
CustomAgent includes built-in P2P message handlers:
|
|
594
569
|
|
|
595
570
|
#### `async on_peer_request(msg) -> dict`
|
|
596
571
|
|
|
@@ -604,9 +579,9 @@ async def on_peer_request(self, msg):
|
|
|
604
579
|
```
|
|
605
580
|
|
|
606
581
|
**Parameters:**
|
|
607
|
-
- `msg` (IncomingMessage): Incoming message with `data`, `
|
|
582
|
+
- `msg` (IncomingMessage): Incoming message with `data`, `sender`, `correlation_id`
|
|
608
583
|
|
|
609
|
-
**Returns:** dict - Response sent back to requester
|
|
584
|
+
**Returns:** dict - Response sent back to requester (if `auto_respond=True`)
|
|
610
585
|
|
|
611
586
|
---
|
|
612
587
|
|
|
@@ -628,7 +603,29 @@ async def on_peer_notify(self, msg):
|
|
|
628
603
|
|
|
629
604
|
---
|
|
630
605
|
|
|
631
|
-
|
|
606
|
+
#### `async on_error(error, msg) -> None`
|
|
607
|
+
|
|
608
|
+
Handle errors during message processing.
|
|
609
|
+
|
|
610
|
+
```python
|
|
611
|
+
async def on_error(self, error, msg):
|
|
612
|
+
self._logger.error(f"Error processing message: {error}")
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
**Parameters:**
|
|
616
|
+
- `error` (Exception): The exception that occurred
|
|
617
|
+
- `msg` (IncomingMessage, optional): The message being processed
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
#### Configuration Attributes
|
|
622
|
+
|
|
623
|
+
- `listen_timeout` (float): Seconds to wait for messages in run loop (default: 1.0)
|
|
624
|
+
- `auto_respond` (bool): Automatically send on_peer_request return value (default: True)
|
|
625
|
+
|
|
626
|
+
---
|
|
627
|
+
|
|
628
|
+
#### Self-Registration Methods
|
|
632
629
|
|
|
633
630
|
#### `async join_mesh(seed_nodes, advertise_endpoint=None)`
|
|
634
631
|
|
|
@@ -657,16 +654,6 @@ await agent.leave_mesh()
|
|
|
657
654
|
|
|
658
655
|
---
|
|
659
656
|
|
|
660
|
-
#### `async serve_forever()`
|
|
661
|
-
|
|
662
|
-
Run the agent until shutdown signal.
|
|
663
|
-
|
|
664
|
-
```python
|
|
665
|
-
await agent.serve_forever()
|
|
666
|
-
```
|
|
667
|
-
|
|
668
|
-
---
|
|
669
|
-
|
|
670
657
|
## P2P Communication (v0.3.0)
|
|
671
658
|
|
|
672
659
|
### PeerClient
|
|
@@ -811,7 +798,7 @@ app = FastAPI(lifespan=JarvisLifespan(agent, mode="p2p"))
|
|
|
811
798
|
```
|
|
812
799
|
|
|
813
800
|
**Parameters:**
|
|
814
|
-
- `agent`:
|
|
801
|
+
- `agent`: CustomAgent instance (or list of agents)
|
|
815
802
|
- `mode` (str): "p2p" or "distributed"
|
|
816
803
|
- `bind_port` (int, optional): P2P port (default: 7950)
|
|
817
804
|
- `seed_nodes` (str, optional): Comma-separated seed node addresses
|
|
@@ -820,11 +807,11 @@ app = FastAPI(lifespan=JarvisLifespan(agent, mode="p2p"))
|
|
|
820
807
|
|
|
821
808
|
```python
|
|
822
809
|
from fastapi import FastAPI
|
|
823
|
-
from jarviscore.profiles import
|
|
810
|
+
from jarviscore.profiles import CustomAgent
|
|
824
811
|
from jarviscore.integrations.fastapi import JarvisLifespan
|
|
825
812
|
|
|
826
813
|
|
|
827
|
-
class ProcessorAgent(
|
|
814
|
+
class ProcessorAgent(CustomAgent):
|
|
828
815
|
role = "processor"
|
|
829
816
|
capabilities = ["processing"]
|
|
830
817
|
|
|
@@ -845,7 +832,7 @@ async def process(data: dict):
|
|
|
845
832
|
**Handles:**
|
|
846
833
|
- Agent setup and teardown
|
|
847
834
|
- Mesh initialization
|
|
848
|
-
- Background run loop (
|
|
835
|
+
- Background run loop (runs agent.run())
|
|
849
836
|
- Graceful shutdown
|
|
850
837
|
|
|
851
838
|
---
|
|
@@ -1433,6 +1420,6 @@ async def execute_task(self, task: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
1433
1420
|
|
|
1434
1421
|
## Version
|
|
1435
1422
|
|
|
1436
|
-
API Reference for JarvisCore v0.3.
|
|
1423
|
+
API Reference for JarvisCore v0.3.1
|
|
1437
1424
|
|
|
1438
1425
|
Last Updated: 2026-01-29
|
jarviscore/docs/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,48 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [0.3.1] - 2026-02-02
|
|
11
|
+
|
|
12
|
+
### Breaking Changes
|
|
13
|
+
|
|
14
|
+
#### ListenerAgent Removed
|
|
15
|
+
- **ListenerAgent has been merged into CustomAgent**
|
|
16
|
+
- Migration is simple - just change the import:
|
|
17
|
+
```python
|
|
18
|
+
# Before
|
|
19
|
+
from jarviscore.profiles import ListenerAgent
|
|
20
|
+
class MyAgent(ListenerAgent): ...
|
|
21
|
+
|
|
22
|
+
# After
|
|
23
|
+
from jarviscore.profiles import CustomAgent
|
|
24
|
+
class MyAgent(CustomAgent): ...
|
|
25
|
+
```
|
|
26
|
+
- All handler methods work exactly the same way
|
|
27
|
+
- No other code changes required
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
#### CustomAgent Now Includes P2P Handlers
|
|
32
|
+
- `on_peer_request(msg)` - Handle incoming requests (return value sent as response)
|
|
33
|
+
- `on_peer_notify(msg)` - Handle fire-and-forget notifications
|
|
34
|
+
- `on_error(error, msg)` - Handle errors during message processing
|
|
35
|
+
- `run()` - Built-in listener loop (no need to write your own)
|
|
36
|
+
- Configuration: `listen_timeout`, `auto_respond`
|
|
37
|
+
|
|
38
|
+
#### Simplified Profile Architecture
|
|
39
|
+
| Before (v0.3.0) | After (v0.3.1) |
|
|
40
|
+
|-----------------|----------------|
|
|
41
|
+
| AutoAgent + CustomAgent + ListenerAgent | AutoAgent + CustomAgent |
|
|
42
|
+
| "Which profile do I use?" confusion | Clear: AutoAgent (LLM) or CustomAgent (your code) |
|
|
43
|
+
|
|
44
|
+
### Documentation
|
|
45
|
+
- README.md updated with unified CustomAgent examples
|
|
46
|
+
- GETTING_STARTED.md rewritten with framework integration patterns
|
|
47
|
+
- CUSTOMAGENT_GUIDE.md updated (ListenerAgent sections removed)
|
|
48
|
+
- Added async-first framework guidance (FastAPI, aiohttp, Flask patterns)
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
10
52
|
## [0.3.0] - 2026-01-29
|
|
11
53
|
|
|
12
54
|
### Added
|