jarviscore-framework 0.1.1__py3-none-any.whl → 0.2.0__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/autoagent_distributed_example.py +211 -0
- examples/custom_profile_decorator.py +134 -0
- examples/custom_profile_wrap.py +168 -0
- examples/customagent_distributed_example.py +362 -0
- examples/customagent_p2p_example.py +347 -0
- jarviscore/__init__.py +49 -36
- jarviscore/adapter/__init__.py +15 -9
- jarviscore/adapter/decorator.py +23 -19
- jarviscore/adapter/wrapper.py +303 -0
- jarviscore/cli/scaffold.py +1 -1
- jarviscore/cli/smoketest.py +3 -2
- jarviscore/core/agent.py +44 -1
- jarviscore/core/mesh.py +196 -35
- jarviscore/data/examples/autoagent_distributed_example.py +211 -0
- jarviscore/data/examples/customagent_distributed_example.py +362 -0
- jarviscore/data/examples/customagent_p2p_example.py +347 -0
- jarviscore/docs/API_REFERENCE.md +264 -51
- jarviscore/docs/AUTOAGENT_GUIDE.md +198 -0
- jarviscore/docs/CONFIGURATION.md +35 -21
- jarviscore/docs/CUSTOMAGENT_GUIDE.md +415 -0
- jarviscore/docs/GETTING_STARTED.md +106 -13
- jarviscore/docs/TROUBLESHOOTING.md +144 -6
- jarviscore/docs/USER_GUIDE.md +138 -361
- jarviscore/orchestration/engine.py +20 -8
- jarviscore/p2p/__init__.py +10 -0
- jarviscore/p2p/coordinator.py +129 -0
- jarviscore/p2p/messages.py +87 -0
- jarviscore/p2p/peer_client.py +576 -0
- jarviscore/p2p/peer_tool.py +268 -0
- {jarviscore_framework-0.1.1.dist-info → jarviscore_framework-0.2.0.dist-info}/METADATA +60 -54
- jarviscore_framework-0.2.0.dist-info/RECORD +132 -0
- {jarviscore_framework-0.1.1.dist-info → jarviscore_framework-0.2.0.dist-info}/WHEEL +1 -1
- {jarviscore_framework-0.1.1.dist-info → jarviscore_framework-0.2.0.dist-info}/top_level.txt +1 -0
- test_logs/code_registry/functions/data_generator-558779ed_560ebc37.py +7 -0
- test_logs/code_registry/functions/data_generator-5ed3609e_560ebc37.py +7 -0
- test_logs/code_registry/functions/data_generator-66da0356_43970bb9.py +25 -0
- test_logs/code_registry/functions/data_generator-7a2fac83_583709d9.py +36 -0
- test_logs/code_registry/functions/data_generator-888b670f_aa235863.py +9 -0
- test_logs/code_registry/functions/data_generator-9ca5f642_aa235863.py +9 -0
- test_logs/code_registry/functions/data_generator-bfd90775_560ebc37.py +7 -0
- test_logs/code_registry/functions/data_generator-e95d2f7d_aa235863.py +9 -0
- test_logs/code_registry/functions/data_generator-f60ca8a2_327eb8c2.py +29 -0
- test_logs/code_registry/functions/mathematician-02adf9ee_958658d9.py +19 -0
- test_logs/code_registry/functions/mathematician-0706fb57_5df13441.py +23 -0
- test_logs/code_registry/functions/mathematician-153c9c4a_ba59c918.py +83 -0
- test_logs/code_registry/functions/mathematician-287e61c0_41daa793.py +18 -0
- test_logs/code_registry/functions/mathematician-2967af5a_863c2cc6.py +17 -0
- test_logs/code_registry/functions/mathematician-303ca6d6_5df13441.py +23 -0
- test_logs/code_registry/functions/mathematician-308a4afd_cbf5064d.py +73 -0
- test_logs/code_registry/functions/mathematician-353f16e2_0968bcf5.py +18 -0
- test_logs/code_registry/functions/mathematician-3c22475a_41daa793.py +17 -0
- test_logs/code_registry/functions/mathematician-5bac1029_0968bcf5.py +18 -0
- test_logs/code_registry/functions/mathematician-640f76b2_9198780b.py +19 -0
- test_logs/code_registry/functions/mathematician-752fa7ea_863c2cc6.py +17 -0
- test_logs/code_registry/functions/mathematician-baf9ef39_0968bcf5.py +18 -0
- test_logs/code_registry/functions/mathematician-bc8b2a2f_5df13441.py +23 -0
- test_logs/code_registry/functions/mathematician-c31e4686_41daa793.py +18 -0
- test_logs/code_registry/functions/mathematician-cc84c84c_863c2cc6.py +17 -0
- test_logs/code_registry/functions/mathematician-dd7c7144_9198780b.py +19 -0
- test_logs/code_registry/functions/mathematician-e671c256_41ea4487.py +74 -0
- test_logs/code_registry/functions/report_generator-1a878fcc_18d44bdc.py +47 -0
- test_logs/code_registry/functions/report_generator-25c1c331_cea57d0d.py +35 -0
- test_logs/code_registry/functions/report_generator-37552117_e711c2b9.py +35 -0
- test_logs/code_registry/functions/report_generator-bc662768_e711c2b9.py +35 -0
- test_logs/code_registry/functions/report_generator-d6c0e76b_5e7722ec.py +44 -0
- test_logs/code_registry/functions/report_generator-f270fb02_680529c3.py +44 -0
- test_logs/code_registry/functions/text_processor-11393b14_4370d3ed.py +40 -0
- test_logs/code_registry/functions/text_processor-7d02dfc3_d3b569be.py +37 -0
- test_logs/code_registry/functions/text_processor-8adb5e32_9168c5fe.py +13 -0
- test_logs/code_registry/functions/text_processor-c58ffc19_78b4ceac.py +42 -0
- test_logs/code_registry/functions/text_processor-cd5977b1_9168c5fe.py +13 -0
- test_logs/code_registry/functions/text_processor-ec1c8773_9168c5fe.py +13 -0
- tests/test_01_analyst_standalone.py +124 -0
- tests/test_02_assistant_standalone.py +164 -0
- tests/test_03_analyst_with_framework.py +945 -0
- tests/test_04_assistant_with_framework.py +1002 -0
- tests/test_05_integration.py +1301 -0
- tests/test_06_real_llm_integration.py +760 -0
- tests/test_07_distributed_single_node.py +578 -0
- tests/test_08_distributed_multi_node.py +454 -0
- tests/test_09_distributed_autoagent.py +509 -0
- tests/test_10_distributed_customagent.py +787 -0
- tests/test_mesh.py +35 -4
- jarviscore_framework-0.1.1.dist-info/RECORD +0 -69
- {jarviscore_framework-0.1.1.dist-info → jarviscore_framework-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test 2: Standalone Assistant
|
|
3
|
+
|
|
4
|
+
The Assistant agent working alone - no framework.
|
|
5
|
+
Has local tools (search, calculate) but cannot talk to other agents.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Assistant:
|
|
10
|
+
"""
|
|
11
|
+
Standalone Assistant agent.
|
|
12
|
+
|
|
13
|
+
Capabilities:
|
|
14
|
+
- Search the web
|
|
15
|
+
- Calculate expressions
|
|
16
|
+
- Chat with user
|
|
17
|
+
|
|
18
|
+
Tools available to LLM:
|
|
19
|
+
- search
|
|
20
|
+
- calculate
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self):
|
|
24
|
+
self.name = "assistant"
|
|
25
|
+
|
|
26
|
+
def search(self, query: str) -> str:
|
|
27
|
+
"""Search the web for information."""
|
|
28
|
+
# Simulated search
|
|
29
|
+
return f"Search results for '{query}': Found 10 relevant articles."
|
|
30
|
+
|
|
31
|
+
def calculate(self, expression: str) -> str:
|
|
32
|
+
"""Calculate a math expression."""
|
|
33
|
+
try:
|
|
34
|
+
result = eval(expression)
|
|
35
|
+
return f"Result: {result}"
|
|
36
|
+
except Exception as e:
|
|
37
|
+
return f"Error: {e}"
|
|
38
|
+
|
|
39
|
+
def get_tools(self) -> list:
|
|
40
|
+
"""Return tool definitions for LLM."""
|
|
41
|
+
return [
|
|
42
|
+
{
|
|
43
|
+
"name": "search",
|
|
44
|
+
"description": "Search the web for information",
|
|
45
|
+
"parameters": {"query": "string"}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "calculate",
|
|
49
|
+
"description": "Calculate a math expression",
|
|
50
|
+
"parameters": {"expression": "string"}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
def execute_tool(self, tool_name: str, args: dict) -> str:
|
|
55
|
+
"""Execute a tool by name."""
|
|
56
|
+
if tool_name == "search":
|
|
57
|
+
return self.search(args.get("query", ""))
|
|
58
|
+
elif tool_name == "calculate":
|
|
59
|
+
return self.calculate(args.get("expression", ""))
|
|
60
|
+
else:
|
|
61
|
+
return f"Unknown tool: {tool_name}"
|
|
62
|
+
|
|
63
|
+
def chat(self, message: str) -> str:
|
|
64
|
+
"""Simple chat response."""
|
|
65
|
+
return f"I received: {message}"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# ═══════════════════════════════════════════════════════════════════════════════
|
|
69
|
+
# TESTS
|
|
70
|
+
# ═══════════════════════════════════════════════════════════════════════════════
|
|
71
|
+
|
|
72
|
+
def test_assistant_init():
|
|
73
|
+
"""Assistant initializes correctly."""
|
|
74
|
+
assistant = Assistant()
|
|
75
|
+
assert assistant.name == "assistant"
|
|
76
|
+
print("✓ Assistant initialized")
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def test_assistant_search():
|
|
80
|
+
"""Assistant can search."""
|
|
81
|
+
assistant = Assistant()
|
|
82
|
+
result = assistant.search("market trends 2024")
|
|
83
|
+
|
|
84
|
+
assert "Search results" in result
|
|
85
|
+
assert "market trends" in result
|
|
86
|
+
print(f"✓ Search: {result}")
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def test_assistant_calculate():
|
|
90
|
+
"""Assistant can calculate."""
|
|
91
|
+
assistant = Assistant()
|
|
92
|
+
|
|
93
|
+
result1 = assistant.calculate("2 + 2")
|
|
94
|
+
assert "4" in result1
|
|
95
|
+
print(f"✓ Calculate 2+2: {result1}")
|
|
96
|
+
|
|
97
|
+
result2 = assistant.calculate("100 * 0.15")
|
|
98
|
+
assert "15" in result2
|
|
99
|
+
print(f"✓ Calculate 100*0.15: {result2}")
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def test_assistant_get_tools():
|
|
103
|
+
"""Assistant returns tool definitions."""
|
|
104
|
+
assistant = Assistant()
|
|
105
|
+
tools = assistant.get_tools()
|
|
106
|
+
tool_names = [t["name"] for t in tools]
|
|
107
|
+
|
|
108
|
+
assert "search" in tool_names
|
|
109
|
+
assert "calculate" in tool_names
|
|
110
|
+
assert len(tools) == 2
|
|
111
|
+
print(f"✓ Tools: {tool_names}")
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def test_assistant_execute_tool():
|
|
115
|
+
"""Assistant can execute tools by name."""
|
|
116
|
+
assistant = Assistant()
|
|
117
|
+
|
|
118
|
+
result = assistant.execute_tool("search", {"query": "python tutorials"})
|
|
119
|
+
assert "python tutorials" in result
|
|
120
|
+
print(f"✓ Execute search: {result}")
|
|
121
|
+
|
|
122
|
+
result = assistant.execute_tool("calculate", {"expression": "10 / 2"})
|
|
123
|
+
assert "5" in result
|
|
124
|
+
print(f"✓ Execute calculate: {result}")
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def test_assistant_cannot_talk_to_peers():
|
|
128
|
+
"""Assistant has NO way to talk to other agents."""
|
|
129
|
+
assistant = Assistant()
|
|
130
|
+
tools = assistant.get_tools()
|
|
131
|
+
tool_names = [t["name"] for t in tools]
|
|
132
|
+
|
|
133
|
+
# No peer communication tools
|
|
134
|
+
assert "ask_peer" not in tool_names
|
|
135
|
+
assert "broadcast_update" not in tool_names
|
|
136
|
+
assert "list_peers" not in tool_names
|
|
137
|
+
|
|
138
|
+
# No peers attribute
|
|
139
|
+
assert not hasattr(assistant, 'peers')
|
|
140
|
+
|
|
141
|
+
print("✓ Assistant CANNOT talk to peers (limitation)")
|
|
142
|
+
print(f" Available tools: {tool_names}")
|
|
143
|
+
print(f" Missing: ask_peer, broadcast_update, list_peers")
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
# ═══════════════════════════════════════════════════════════════════════════════
|
|
147
|
+
# RUN
|
|
148
|
+
# ═══════════════════════════════════════════════════════════════════════════════
|
|
149
|
+
|
|
150
|
+
if __name__ == "__main__":
|
|
151
|
+
print("\n" + "="*60)
|
|
152
|
+
print("TEST 2: STANDALONE ASSISTANT")
|
|
153
|
+
print("="*60 + "\n")
|
|
154
|
+
|
|
155
|
+
test_assistant_init()
|
|
156
|
+
test_assistant_search()
|
|
157
|
+
test_assistant_calculate()
|
|
158
|
+
test_assistant_get_tools()
|
|
159
|
+
test_assistant_execute_tool()
|
|
160
|
+
test_assistant_cannot_talk_to_peers()
|
|
161
|
+
|
|
162
|
+
print("\n" + "-"*60)
|
|
163
|
+
print("Assistant works, but cannot talk to other agents.")
|
|
164
|
+
print("-"*60 + "\n")
|