jarviscore-framework 0.1.0__py3-none-any.whl → 0.1.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.
- jarviscore/__init__.py +37 -5
- jarviscore/adapter/__init__.py +34 -0
- jarviscore/adapter/decorator.py +332 -0
- jarviscore/cli/check.py +18 -13
- jarviscore/cli/scaffold.py +178 -0
- jarviscore/context/__init__.py +40 -0
- jarviscore/context/dependency.py +160 -0
- jarviscore/context/jarvis_context.py +207 -0
- jarviscore/context/memory.py +155 -0
- jarviscore/data/.env.example +146 -0
- jarviscore/data/__init__.py +7 -0
- jarviscore/data/examples/calculator_agent_example.py +77 -0
- jarviscore/data/examples/multi_agent_workflow.py +132 -0
- jarviscore/data/examples/research_agent_example.py +76 -0
- jarviscore/docs/CONFIGURATION.md +6 -2
- jarviscore/docs/GETTING_STARTED.md +7 -4
- jarviscore/docs/TROUBLESHOOTING.md +11 -7
- jarviscore/docs/USER_GUIDE.md +6 -2
- jarviscore/execution/llm.py +23 -16
- {jarviscore_framework-0.1.0.dist-info → jarviscore_framework-0.1.1.dist-info}/METADATA +10 -9
- {jarviscore_framework-0.1.0.dist-info → jarviscore_framework-0.1.1.dist-info}/RECORD +26 -12
- tests/test_context.py +467 -0
- tests/test_decorator.py +622 -0
- {jarviscore_framework-0.1.0.dist-info → jarviscore_framework-0.1.1.dist-info}/WHEEL +0 -0
- {jarviscore_framework-0.1.0.dist-info → jarviscore_framework-0.1.1.dist-info}/licenses/LICENSE +0 -0
- {jarviscore_framework-0.1.0.dist-info → jarviscore_framework-0.1.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Calculator Agent Example - Simple Math Operations
|
|
3
|
+
|
|
4
|
+
Demonstrates AutoAgent with code generation for mathematical tasks.
|
|
5
|
+
Zero configuration required - just define the agent and run.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
python examples/calculator_agent_example.py
|
|
9
|
+
"""
|
|
10
|
+
import asyncio
|
|
11
|
+
import sys
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
# Add parent directory to path
|
|
15
|
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
16
|
+
|
|
17
|
+
from jarviscore import Mesh
|
|
18
|
+
from jarviscore.profiles import AutoAgent
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class CalculatorAgent(AutoAgent):
|
|
22
|
+
"""Math expert agent that generates code to solve problems."""
|
|
23
|
+
role = "calculator"
|
|
24
|
+
capabilities = ["math", "calculation", "arithmetic"]
|
|
25
|
+
system_prompt = """
|
|
26
|
+
You are a math expert. Generate Python code to solve mathematical problems.
|
|
27
|
+
Store the final answer in a variable named 'result'.
|
|
28
|
+
Use standard math operations and the math module when needed.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
async def main():
|
|
33
|
+
"""Run calculator agent examples."""
|
|
34
|
+
print("\n" + "="*60)
|
|
35
|
+
print("JarvisCore: Calculator Agent Example")
|
|
36
|
+
print("="*60)
|
|
37
|
+
|
|
38
|
+
# Zero-config: Framework auto-detects LLM from .env
|
|
39
|
+
# Tries: Claude → Azure → Gemini → vLLM (based on .env)
|
|
40
|
+
# Or pass custom config dict to override
|
|
41
|
+
|
|
42
|
+
# Create mesh and add agent (reads from .env automatically)
|
|
43
|
+
mesh = Mesh(mode="autonomous")
|
|
44
|
+
mesh.add(CalculatorAgent)
|
|
45
|
+
|
|
46
|
+
try:
|
|
47
|
+
await mesh.start()
|
|
48
|
+
print("✓ Mesh started successfully\n")
|
|
49
|
+
|
|
50
|
+
# Example 1: Simple calculation
|
|
51
|
+
print("Example 1: Calculate factorial of 10")
|
|
52
|
+
print("-" * 60)
|
|
53
|
+
|
|
54
|
+
results = await mesh.workflow("factorial", [
|
|
55
|
+
{
|
|
56
|
+
"agent": "calculator",
|
|
57
|
+
"task": "Calculate the factorial of 10"
|
|
58
|
+
}
|
|
59
|
+
])
|
|
60
|
+
|
|
61
|
+
result = results[0]
|
|
62
|
+
print(f"Status: {result['status']}")
|
|
63
|
+
print(f"Result: {result.get('output')}")
|
|
64
|
+
print(f"Repairs needed: {result.get('repairs', 0)}")
|
|
65
|
+
print(f"Generated code:\n{result.get('code', 'N/A')}\n")
|
|
66
|
+
|
|
67
|
+
await mesh.stop()
|
|
68
|
+
print("✓ Mesh stopped\n")
|
|
69
|
+
|
|
70
|
+
except Exception as e:
|
|
71
|
+
print(f"\n✗ Error: {e}")
|
|
72
|
+
import traceback
|
|
73
|
+
traceback.print_exc()
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
if __name__ == "__main__":
|
|
77
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Multi-Agent Workflow Example
|
|
3
|
+
|
|
4
|
+
Demonstrates multiple AutoAgents collaborating on a workflow with dependencies.
|
|
5
|
+
Shows how agents can pass data between steps automatically.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
python examples/multi_agent_workflow.py
|
|
9
|
+
"""
|
|
10
|
+
import asyncio
|
|
11
|
+
import sys
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
# Add parent directory to path
|
|
15
|
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
16
|
+
|
|
17
|
+
from jarviscore import Mesh
|
|
18
|
+
from jarviscore.profiles import AutoAgent
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class DataGeneratorAgent(AutoAgent):
|
|
22
|
+
"""Generates sample data."""
|
|
23
|
+
role = "generator"
|
|
24
|
+
capabilities = ["data_generation", "random_data"]
|
|
25
|
+
system_prompt = """
|
|
26
|
+
You are a data generator. Create sample datasets based on specifications.
|
|
27
|
+
Use Python's random module or create structured data.
|
|
28
|
+
Store the generated data in a variable named 'result'.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class DataAnalyzerAgent(AutoAgent):
|
|
33
|
+
"""Analyzes data and computes statistics."""
|
|
34
|
+
role = "analyzer"
|
|
35
|
+
capabilities = ["data_analysis", "statistics"]
|
|
36
|
+
system_prompt = """
|
|
37
|
+
You are a data analyst. Analyze datasets and compute statistics.
|
|
38
|
+
Calculate mean, median, standard deviation, and find patterns.
|
|
39
|
+
Store your analysis results in a variable named 'result'.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class ReportGeneratorAgent(AutoAgent):
|
|
44
|
+
"""Creates formatted reports."""
|
|
45
|
+
role = "reporter"
|
|
46
|
+
capabilities = ["report_generation", "formatting"]
|
|
47
|
+
system_prompt = """
|
|
48
|
+
You are a report generator. Create well-formatted reports from data.
|
|
49
|
+
Generate markdown or plain text reports with clear sections.
|
|
50
|
+
Store the formatted report in a variable named 'result'.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
async def main():
|
|
55
|
+
"""Run multi-agent workflow."""
|
|
56
|
+
print("\n" + "="*60)
|
|
57
|
+
print("JarvisCore: Multi-Agent Workflow Example")
|
|
58
|
+
print("="*60)
|
|
59
|
+
|
|
60
|
+
# Zero-config: Reads from .env automatically
|
|
61
|
+
# Framework tries: Claude → Azure → Gemini → vLLM
|
|
62
|
+
|
|
63
|
+
# Create mesh with all agents
|
|
64
|
+
mesh = Mesh(mode="autonomous")
|
|
65
|
+
mesh.add(DataGeneratorAgent)
|
|
66
|
+
mesh.add(DataAnalyzerAgent)
|
|
67
|
+
mesh.add(ReportGeneratorAgent)
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
await mesh.start()
|
|
71
|
+
print(f"✓ Mesh started with {len(mesh.agents)} agents\n")
|
|
72
|
+
|
|
73
|
+
print("Workflow: Generate → Analyze → Report")
|
|
74
|
+
print("-" * 60)
|
|
75
|
+
|
|
76
|
+
# Execute 3-step workflow with dependencies
|
|
77
|
+
results = await mesh.workflow("data-pipeline", [
|
|
78
|
+
{
|
|
79
|
+
"id": "generate",
|
|
80
|
+
"agent": "generator",
|
|
81
|
+
"task": "Generate a list of 20 random numbers between 1 and 100"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": "analyze",
|
|
85
|
+
"agent": "analyzer",
|
|
86
|
+
"task": "Calculate mean, median, min, max, and standard deviation of the data",
|
|
87
|
+
"depends_on": ["generate"] # Waits for generator to complete
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": "report",
|
|
91
|
+
"agent": "reporter",
|
|
92
|
+
"task": "Create a formatted report with the statistics",
|
|
93
|
+
"depends_on": ["analyze"] # Waits for analyzer to complete
|
|
94
|
+
}
|
|
95
|
+
])
|
|
96
|
+
|
|
97
|
+
# Display results
|
|
98
|
+
print("\n" + "="*60)
|
|
99
|
+
print("RESULTS")
|
|
100
|
+
print("="*60)
|
|
101
|
+
|
|
102
|
+
print(f"\nStep 1 - Data Generation:")
|
|
103
|
+
print(f" Status: {results[0]['status']}")
|
|
104
|
+
print(f" Output: {results[0].get('output')}")
|
|
105
|
+
|
|
106
|
+
print(f"\nStep 2 - Data Analysis:")
|
|
107
|
+
print(f" Status: {results[1]['status']}")
|
|
108
|
+
print(f" Output: {results[1].get('output')}")
|
|
109
|
+
|
|
110
|
+
print(f"\nStep 3 - Report Generation:")
|
|
111
|
+
print(f" Status: {results[2]['status']}")
|
|
112
|
+
print(f" Report:\n{results[2].get('output')}")
|
|
113
|
+
|
|
114
|
+
print(f"\n" + "="*60)
|
|
115
|
+
print("WORKFLOW SUMMARY")
|
|
116
|
+
print("="*60)
|
|
117
|
+
total_repairs = sum(r.get('repairs', 0) for r in results)
|
|
118
|
+
print(f"Total steps: {len(results)}")
|
|
119
|
+
print(f"Successful: {sum(1 for r in results if r['status'] == 'success')}")
|
|
120
|
+
print(f"Total repairs: {total_repairs}")
|
|
121
|
+
|
|
122
|
+
await mesh.stop()
|
|
123
|
+
print("\n✓ Workflow completed\n")
|
|
124
|
+
|
|
125
|
+
except Exception as e:
|
|
126
|
+
print(f"\n✗ Error: {e}")
|
|
127
|
+
import traceback
|
|
128
|
+
traceback.print_exc()
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
if __name__ == "__main__":
|
|
132
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Research Agent Example - Internet Search & Data Extraction
|
|
3
|
+
|
|
4
|
+
Demonstrates AutoAgent with internet search capabilities.
|
|
5
|
+
Agent automatically gets access to web search tools (DuckDuckGo).
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
python examples/research_agent_example.py
|
|
9
|
+
"""
|
|
10
|
+
import asyncio
|
|
11
|
+
import sys
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
# Add parent directory to path
|
|
15
|
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
16
|
+
|
|
17
|
+
from jarviscore import Mesh
|
|
18
|
+
from jarviscore.profiles import AutoAgent
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ResearchAgent(AutoAgent):
|
|
22
|
+
"""Research assistant with internet access."""
|
|
23
|
+
role = "researcher"
|
|
24
|
+
capabilities = ["research", "web_search", "information_gathering"]
|
|
25
|
+
system_prompt = """
|
|
26
|
+
You are a research assistant with internet access.
|
|
27
|
+
Search the web for information and provide concise summaries.
|
|
28
|
+
Use the 'search' object available in your code:
|
|
29
|
+
- await search.search(query, max_results=5)
|
|
30
|
+
- await search.extract_content(url)
|
|
31
|
+
- await search.search_and_extract(query, num_results=3)
|
|
32
|
+
Store your findings in a variable named 'result'.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
async def main():
|
|
37
|
+
"""Run research agent example."""
|
|
38
|
+
print("\n" + "="*60)
|
|
39
|
+
print("JarvisCore: Research Agent Example")
|
|
40
|
+
print("="*60)
|
|
41
|
+
|
|
42
|
+
# Zero-config: Reads from .env automatically
|
|
43
|
+
# Framework auto-detects: Claude → Azure → Gemini → vLLM
|
|
44
|
+
mesh = Mesh(mode="autonomous")
|
|
45
|
+
mesh.add(ResearchAgent)
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
await mesh.start()
|
|
49
|
+
print("✓ Mesh started with internet search enabled\n")
|
|
50
|
+
|
|
51
|
+
print("Example: Research Python asyncio")
|
|
52
|
+
print("-" * 60)
|
|
53
|
+
|
|
54
|
+
results = await mesh.workflow("research-asyncio", [
|
|
55
|
+
{
|
|
56
|
+
"agent": "researcher",
|
|
57
|
+
"task": "Search for 'Python asyncio tutorial' and summarize the top 2 results"
|
|
58
|
+
}
|
|
59
|
+
])
|
|
60
|
+
|
|
61
|
+
result = results[0]
|
|
62
|
+
print(f"Status: {result['status']}")
|
|
63
|
+
print(f"Summary:\n{result.get('output')}")
|
|
64
|
+
print(f"\nRepairs needed: {result.get('repairs', 0)}")
|
|
65
|
+
|
|
66
|
+
await mesh.stop()
|
|
67
|
+
print("\n✓ Research completed\n")
|
|
68
|
+
|
|
69
|
+
except Exception as e:
|
|
70
|
+
print(f"\n✗ Error: {e}")
|
|
71
|
+
import traceback
|
|
72
|
+
traceback.print_exc()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
asyncio.run(main())
|
jarviscore/docs/CONFIGURATION.md
CHANGED
|
@@ -52,9 +52,13 @@ That's it! The framework handles the rest.
|
|
|
52
52
|
|
|
53
53
|
### Configuration File
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
Initialize your project and create `.env` file:
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
+
# Initialize project (creates .env.example)
|
|
59
|
+
python -m jarviscore.cli.scaffold
|
|
60
|
+
|
|
61
|
+
# Copy and configure
|
|
58
62
|
cp .env.example .env
|
|
59
63
|
# Edit .env with your values
|
|
60
64
|
```
|
|
@@ -716,7 +720,7 @@ LOG_DIRECTORY=/tmp/jarviscore-logs
|
|
|
716
720
|
| `AZURE_DEPLOYMENT` | None | Azure deployment name |
|
|
717
721
|
| `AZURE_API_VERSION` | 2024-02-15-preview | Azure API version |
|
|
718
722
|
| `GEMINI_API_KEY` | None | Google Gemini key |
|
|
719
|
-
| `GEMINI_MODEL` | gemini-
|
|
723
|
+
| `GEMINI_MODEL` | gemini-2.0-flash | Gemini model |
|
|
720
724
|
| `LLM_TIMEOUT` | 120.0 | LLM timeout (seconds) |
|
|
721
725
|
| `LLM_TEMPERATURE` | 0.7 | Sampling temperature |
|
|
722
726
|
| `SANDBOX_MODE` | local | Execution mode |
|
|
@@ -29,17 +29,20 @@ An **AutoAgent** that takes natural language prompts and automatically:
|
|
|
29
29
|
## Step 1: Install JarvisCore (30 seconds)
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
pip install jarviscore
|
|
32
|
+
pip install jarviscore-framework
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
37
|
## Step 2: Configure Your LLM (2 minutes)
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Initialize your project and create configuration files:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
#
|
|
42
|
+
# Initialize project (creates .env.example and optionally examples)
|
|
43
|
+
python -m jarviscore.cli.scaffold --examples
|
|
44
|
+
|
|
45
|
+
# Copy and configure your environment
|
|
43
46
|
cp .env.example .env
|
|
44
47
|
```
|
|
45
48
|
|
|
@@ -368,7 +371,7 @@ Fine-tune LLM behavior:
|
|
|
368
371
|
# Model selection (provider-specific)
|
|
369
372
|
CLAUDE_MODEL=claude-sonnet-4 # Claude
|
|
370
373
|
AZURE_DEPLOYMENT=gpt-4o # Azure
|
|
371
|
-
GEMINI_MODEL=gemini-
|
|
374
|
+
GEMINI_MODEL=gemini-2.0-flash # Gemini
|
|
372
375
|
LLM_MODEL=Qwen/Qwen2.5-Coder-32B # vLLM
|
|
373
376
|
|
|
374
377
|
# Generation parameters
|
|
@@ -32,7 +32,7 @@ python -m jarviscore.cli.smoketest --verbose
|
|
|
32
32
|
|
|
33
33
|
**Solution:**
|
|
34
34
|
```bash
|
|
35
|
-
pip install jarviscore
|
|
35
|
+
pip install jarviscore-framework
|
|
36
36
|
|
|
37
37
|
# Or install in development mode
|
|
38
38
|
cd jarviscore
|
|
@@ -45,8 +45,8 @@ pip install -e .
|
|
|
45
45
|
|
|
46
46
|
**Solution:**
|
|
47
47
|
```bash
|
|
48
|
-
pip uninstall jarviscore
|
|
49
|
-
pip install jarviscore
|
|
48
|
+
pip uninstall jarviscore-framework
|
|
49
|
+
pip install jarviscore-framework
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
---
|
|
@@ -58,8 +58,9 @@ pip install jarviscore
|
|
|
58
58
|
**Cause:** Missing API key in `.env`
|
|
59
59
|
|
|
60
60
|
**Solution:**
|
|
61
|
-
1.
|
|
61
|
+
1. Initialize project and copy example config:
|
|
62
62
|
```bash
|
|
63
|
+
python -m jarviscore.cli.scaffold
|
|
63
64
|
cp .env.example .env
|
|
64
65
|
```
|
|
65
66
|
|
|
@@ -204,7 +205,10 @@ await mesh.workflow("wf-1", [
|
|
|
204
205
|
|
|
205
206
|
**Solution:**
|
|
206
207
|
```bash
|
|
207
|
-
#
|
|
208
|
+
# Initialize project first (creates .env.example)
|
|
209
|
+
python -m jarviscore.cli.scaffold
|
|
210
|
+
|
|
211
|
+
# Then copy and configure
|
|
208
212
|
cp .env.example .env
|
|
209
213
|
|
|
210
214
|
# Or create manually
|
|
@@ -361,7 +365,7 @@ If issues persist:
|
|
|
361
365
|
|
|
362
366
|
3. **Provide this info when asking for help:**
|
|
363
367
|
- Python version: `python --version`
|
|
364
|
-
- JarvisCore version: `pip show jarviscore`
|
|
368
|
+
- JarvisCore version: `pip show jarviscore-framework`
|
|
365
369
|
- LLM provider used (Claude/Azure/Gemini)
|
|
366
370
|
- Error message and logs
|
|
367
371
|
- Minimal code to reproduce issue
|
|
@@ -391,7 +395,7 @@ If issues persist:
|
|
|
391
395
|
|
|
392
396
|
4. **Keep dependencies updated:**
|
|
393
397
|
```bash
|
|
394
|
-
pip install --upgrade jarviscore
|
|
398
|
+
pip install --upgrade jarviscore-framework
|
|
395
399
|
```
|
|
396
400
|
|
|
397
401
|
5. **Use version control for `.env`:**
|
jarviscore/docs/USER_GUIDE.md
CHANGED
|
@@ -26,14 +26,18 @@ Practical guide to building agent systems with JarvisCore.
|
|
|
26
26
|
### Step 1: Installation (1 minute)
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
pip install jarviscore
|
|
29
|
+
pip install jarviscore-framework
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
### Step 2: Configuration (2 minutes)
|
|
33
33
|
|
|
34
|
-
JarvisCore needs an LLM provider to generate code for AutoAgent.
|
|
34
|
+
JarvisCore needs an LLM provider to generate code for AutoAgent. Initialize your project:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
+
# Initialize project (creates .env.example and examples)
|
|
38
|
+
python -m jarviscore.cli.scaffold --examples
|
|
39
|
+
|
|
40
|
+
# Copy and configure your environment
|
|
37
41
|
cp .env.example .env
|
|
38
42
|
```
|
|
39
43
|
|
jarviscore/execution/llm.py
CHANGED
|
@@ -13,11 +13,11 @@ logger = logging.getLogger(__name__)
|
|
|
13
13
|
|
|
14
14
|
# Try importing optional LLM SDKs
|
|
15
15
|
try:
|
|
16
|
-
|
|
16
|
+
from google import genai
|
|
17
17
|
GEMINI_AVAILABLE = True
|
|
18
18
|
except ImportError:
|
|
19
19
|
GEMINI_AVAILABLE = False
|
|
20
|
-
logger.debug("Gemini SDK not available (pip install google-
|
|
20
|
+
logger.debug("Gemini SDK not available (pip install google-genai)")
|
|
21
21
|
|
|
22
22
|
try:
|
|
23
23
|
from openai import AsyncAzureOpenAI
|
|
@@ -153,11 +153,10 @@ class UnifiedLLMClient:
|
|
|
153
153
|
gemini_key = self.config.get('gemini_api_key')
|
|
154
154
|
if gemini_key:
|
|
155
155
|
try:
|
|
156
|
-
genai.
|
|
157
|
-
|
|
158
|
-
self.gemini_client = genai.GenerativeModel(model_name)
|
|
156
|
+
self.gemini_client = genai.Client(api_key=gemini_key)
|
|
157
|
+
self.gemini_model = self.config.get('gemini_model', 'gemini-2.0-flash')
|
|
159
158
|
self.provider_order.append(LLMProvider.GEMINI)
|
|
160
|
-
logger.info(f"✓ Gemini provider available: {
|
|
159
|
+
logger.info(f"✓ Gemini provider available: {self.gemini_model}")
|
|
161
160
|
except Exception as e:
|
|
162
161
|
logger.warning(f"Failed to setup Gemini: {e}")
|
|
163
162
|
|
|
@@ -310,7 +309,7 @@ class UnifiedLLMClient:
|
|
|
310
309
|
}
|
|
311
310
|
|
|
312
311
|
async def _call_gemini(self, messages: List[Dict], temperature: float, max_tokens: int, **kwargs) -> Dict:
|
|
313
|
-
"""Call Google Gemini."""
|
|
312
|
+
"""Call Google Gemini using the new google.genai SDK."""
|
|
314
313
|
if not self.gemini_client:
|
|
315
314
|
raise RuntimeError("Gemini client not initialized")
|
|
316
315
|
|
|
@@ -318,10 +317,12 @@ class UnifiedLLMClient:
|
|
|
318
317
|
prompt = self._messages_to_prompt(messages)
|
|
319
318
|
|
|
320
319
|
start_time = time.time()
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
320
|
+
|
|
321
|
+
# Use the new async API via client.aio.models
|
|
322
|
+
response = await self.gemini_client.aio.models.generate_content(
|
|
323
|
+
model=self.gemini_model,
|
|
324
|
+
contents=prompt,
|
|
325
|
+
config={
|
|
325
326
|
"temperature": temperature,
|
|
326
327
|
"max_output_tokens": max_tokens
|
|
327
328
|
}
|
|
@@ -330,11 +331,17 @@ class UnifiedLLMClient:
|
|
|
330
331
|
|
|
331
332
|
content = response.text
|
|
332
333
|
|
|
333
|
-
#
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
334
|
+
# Get usage metadata if available, otherwise estimate
|
|
335
|
+
usage_metadata = getattr(response, 'usage_metadata', None)
|
|
336
|
+
if usage_metadata:
|
|
337
|
+
input_tokens = getattr(usage_metadata, 'prompt_token_count', 0)
|
|
338
|
+
output_tokens = getattr(usage_metadata, 'candidates_token_count', 0)
|
|
339
|
+
else:
|
|
340
|
+
# Estimate tokens (fallback)
|
|
341
|
+
input_tokens = int(len(prompt.split()) * 1.3)
|
|
342
|
+
output_tokens = int(len(content.split()) * 1.3)
|
|
343
|
+
|
|
344
|
+
model_name = self.gemini_model
|
|
338
345
|
pricing = TOKEN_PRICING.get(model_name, {"input": 0.10, "output": 0.30})
|
|
339
346
|
cost = (input_tokens * pricing['input'] + output_tokens * pricing['output']) / 1_000_000
|
|
340
347
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jarviscore-framework
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Build autonomous AI agents in 3 lines of code. Production-ready orchestration with P2P mesh networking.
|
|
5
5
|
Author-email: Ruth Mutua <mutuandinda82@gmail.com>, Muyukani Kizito <muyukani@prescottdata.io>
|
|
6
6
|
Maintainer-email: Prescott Data <info@prescottdata.io>
|
|
7
7
|
License: MIT
|
|
@@ -29,7 +29,7 @@ Requires-Dist: aiohttp>=3.9.0
|
|
|
29
29
|
Requires-Dist: beautifulsoup4>=4.12.0
|
|
30
30
|
Requires-Dist: anthropic>=0.18.0
|
|
31
31
|
Requires-Dist: openai>=1.0.0
|
|
32
|
-
Requires-Dist: google-
|
|
32
|
+
Requires-Dist: google-genai>=1.0.0
|
|
33
33
|
Requires-Dist: httpx>=0.25.0
|
|
34
34
|
Provides-Extra: dev
|
|
35
35
|
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
@@ -44,7 +44,7 @@ Dynamic: license-file
|
|
|
44
44
|
|
|
45
45
|
# JarvisCore Framework
|
|
46
46
|
|
|
47
|
-
**
|
|
47
|
+
**Build autonomous AI agents in 3 lines of code. Production-ready orchestration with P2P mesh networking.**
|
|
48
48
|
|
|
49
49
|
## Features
|
|
50
50
|
|
|
@@ -56,16 +56,18 @@ Dynamic: license-file
|
|
|
56
56
|
## Installation
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
|
-
pip install jarviscore
|
|
59
|
+
pip install jarviscore-framework
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
## Setup & Validation
|
|
63
63
|
|
|
64
|
-
### 1.
|
|
65
|
-
|
|
66
|
-
Copy the example config and add your API key:
|
|
64
|
+
### 1. Initialize Project
|
|
67
65
|
|
|
68
66
|
```bash
|
|
67
|
+
# Create .env.example and example files in your project
|
|
68
|
+
python -m jarviscore.cli.scaffold --examples
|
|
69
|
+
|
|
70
|
+
# Configure your environment
|
|
69
71
|
cp .env.example .env
|
|
70
72
|
# Edit .env and add one of: CLAUDE_API_KEY, AZURE_API_KEY, GEMINI_API_KEY, or LLM_ENDPOINT
|
|
71
73
|
```
|
|
@@ -129,7 +131,6 @@ JarvisCore is built on three layers:
|
|
|
129
131
|
## Development Status
|
|
130
132
|
|
|
131
133
|
**Version:** 0.1.0 (Alpha)
|
|
132
|
-
**Day 1:** Core framework foundation ✅
|
|
133
134
|
|
|
134
135
|
## License
|
|
135
136
|
|
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
examples/calculator_agent_example.py,sha256=x7TrzE45WT_1DqwEnw8U3Fw56WpR9jBe3SLZz5vsKWc,2276
|
|
2
2
|
examples/multi_agent_workflow.py,sha256=Sygx3iEBM9WzorVMXqtiwn4rLYrW9BsxsiQSKceuzsE,4303
|
|
3
3
|
examples/research_agent_example.py,sha256=phJ5AHNnZ_pxCfiKvHoTp_IFwOAW7VD1fRNHlXvfgj4,2287
|
|
4
|
-
jarviscore/__init__.py,sha256=
|
|
4
|
+
jarviscore/__init__.py,sha256=oBtxDmo0XAe_95wRMkuL_qRJmBpfKtbQUi2EhNv4QLo,2500
|
|
5
|
+
jarviscore/adapter/__init__.py,sha256=s78Y-q7se72kkA6mguUgsp5E3za8a9c0FRcN-J_-yDE,951
|
|
6
|
+
jarviscore/adapter/decorator.py,sha256=FMHFEyypzsMfghg6YXX2UYIqGhfl2-oFX86auuSA610,11804
|
|
5
7
|
jarviscore/cli/__init__.py,sha256=OnpJ37xDcbh3jFhALLY1jimgp1mxlB1-VhsKhGS6TDY,123
|
|
6
8
|
jarviscore/cli/__main__.py,sha256=GuIqW9NKJ3n70ei54ItzrBYEVaWG5dAWGxdu87w7YgI,829
|
|
7
|
-
jarviscore/cli/check.py,sha256=
|
|
9
|
+
jarviscore/cli/check.py,sha256=eWvk6fkRsJ8hpgT60XUoAn_0nyzF0PFKRl65m7U9cxQ,13955
|
|
10
|
+
jarviscore/cli/scaffold.py,sha256=nhTqmxKMh8L7lHogCWDT_UKZy_kKoavQzl31o1JPfxc,4829
|
|
8
11
|
jarviscore/cli/smoketest.py,sha256=1qek9Vb7DlX9YAtQwLg-L7Gr90q61oMy4elaF7rQA4I,13363
|
|
9
12
|
jarviscore/config/__init__.py,sha256=ZLjbRHSi5azaDyoSOFr9cQ65J5Fvi56xI-WHdczc204,178
|
|
10
13
|
jarviscore/config/settings.py,sha256=ueYpJAZxT1zoEPymzrn0OHAXZxQXBqSMs87VwolPdhg,3516
|
|
14
|
+
jarviscore/context/__init__.py,sha256=FdMfHUPs1vDRDaz2WR_F3IJi9k4FIVBvsGVKD5dJBrQ,1171
|
|
15
|
+
jarviscore/context/dependency.py,sha256=ns6IwTsMBBuP0w8oBRt60iiNsu5k7RomEViUi4kkmBg,4750
|
|
16
|
+
jarviscore/context/jarvis_context.py,sha256=6ai2TjDE5PRiBxF5lTdyBMoK3b8wv6cr0a6q55PoUSk,5775
|
|
17
|
+
jarviscore/context/memory.py,sha256=taonyl24ZUe-NZ5VtvrxljNv6f_BebuH6VE7l0B9S7A,4442
|
|
11
18
|
jarviscore/core/__init__.py,sha256=30K2aqZckYTRZupn6X-mGV2QDSqWCgJ1cpN6Zk1gqlQ,177
|
|
12
19
|
jarviscore/core/agent.py,sha256=qcqdhRVoYNxIhO_FYmttiDFA354EYtSaM2xp-TNDWGM,5402
|
|
13
20
|
jarviscore/core/mesh.py,sha256=880H25tyteX7ppoI7KkTOnPQoCjoQ3_YdMPzWTb3Zzc,16380
|
|
14
21
|
jarviscore/core/profile.py,sha256=sTrGTxV9mAqbt5l3z0-BSNOeWzq8YDLR3mlaPFSgt1c,2190
|
|
22
|
+
jarviscore/data/.env.example,sha256=TCPdye7tYNDOEpcgaEuzUsQ-H7m9G6rsyzNZV9IYQ9s,5156
|
|
23
|
+
jarviscore/data/__init__.py,sha256=757nsqMkytYV0zXiM_mh3LqtGZZ1lgFuMzvaLrW51PM,151
|
|
24
|
+
jarviscore/data/examples/calculator_agent_example.py,sha256=x7TrzE45WT_1DqwEnw8U3Fw56WpR9jBe3SLZz5vsKWc,2276
|
|
25
|
+
jarviscore/data/examples/multi_agent_workflow.py,sha256=Sygx3iEBM9WzorVMXqtiwn4rLYrW9BsxsiQSKceuzsE,4303
|
|
26
|
+
jarviscore/data/examples/research_agent_example.py,sha256=phJ5AHNnZ_pxCfiKvHoTp_IFwOAW7VD1fRNHlXvfgj4,2287
|
|
15
27
|
jarviscore/docs/API_REFERENCE.md,sha256=26OhRSfX6n3eSSgvtQdoeITmjzDjl9qUOU4PuH1NqKM,20066
|
|
16
|
-
jarviscore/docs/CONFIGURATION.md,sha256=
|
|
17
|
-
jarviscore/docs/GETTING_STARTED.md,sha256=
|
|
18
|
-
jarviscore/docs/TROUBLESHOOTING.md,sha256=
|
|
19
|
-
jarviscore/docs/USER_GUIDE.md,sha256=
|
|
28
|
+
jarviscore/docs/CONFIGURATION.md,sha256=tATnnDcKOxgAFLmzX59ySBtXKBp6AgeC1qWm-GsJORE,14201
|
|
29
|
+
jarviscore/docs/GETTING_STARTED.md,sha256=PJef680gyLqNN64pnvPmrRcPCE_X0sm5BSF0Bs1mOTY,13774
|
|
30
|
+
jarviscore/docs/TROUBLESHOOTING.md,sha256=lIGHQRM1HpoG5lVUKCftnAiyag1Czai1eWux25txo90,8476
|
|
31
|
+
jarviscore/docs/USER_GUIDE.md,sha256=qdfuisZyqtVtxtmtW2QB7BD6LrrHMXXb5yqlB5Z0irM,21330
|
|
20
32
|
jarviscore/execution/__init__.py,sha256=yDAMehMO2dVvdKjxVx7zQV2AaxySmvymA24QF3O9tlY,1754
|
|
21
33
|
jarviscore/execution/code_registry.py,sha256=C3_hAVXIeCG31qwSBUrmBBicmd2vnUrXJhJgj8MKlJw,9213
|
|
22
34
|
jarviscore/execution/generator.py,sha256=zY7IxxDu4xoifeuCGZZN8_l8zQCsB5eUO9HGIiLIttw,8696
|
|
23
|
-
jarviscore/execution/llm.py,sha256=
|
|
35
|
+
jarviscore/execution/llm.py,sha256=a04W7buLXP1BvQoSR9u6hybGwaJqpjStZDipLIVCDVA,16794
|
|
24
36
|
jarviscore/execution/repair.py,sha256=yy6GTX6nFoA38S9V1ZGvqOeH3iRThRkMI3GZ6F_2WrU,9092
|
|
25
37
|
jarviscore/execution/result_handler.py,sha256=7SKr-teFksqNgejhnZNrjAzKbtDXbOSV3Tv7gfYsdig,10590
|
|
26
38
|
jarviscore/execution/sandbox.py,sha256=IVkccce_WHDxXO6l8BCcuxAB5iueJfYtbryydoE972c,19981
|
|
@@ -38,18 +50,20 @@ jarviscore/p2p/swim_manager.py,sha256=Mdr6D0uxJR0h1JMO_faAda2Ojv6gfjoY-ZOzD9q_DW
|
|
|
38
50
|
jarviscore/profiles/__init__.py,sha256=vBV6W5vszx3px4UOZwCh2wsH-TYzIoPp4Zo_STT8pNo,154
|
|
39
51
|
jarviscore/profiles/autoagent.py,sha256=1nJAVf1oU9lLO47BP1xFGBDZtypXXkwKy6kZjtpdlX0,10424
|
|
40
52
|
jarviscore/profiles/customagent.py,sha256=GRauTYlWyYSgZrWyYZlAPNkJoVgjDHjfY_c0rdeoOgM,4618
|
|
41
|
-
jarviscore_framework-0.1.
|
|
53
|
+
jarviscore_framework-0.1.1.dist-info/licenses/LICENSE,sha256=SjsXanvmQJFYz_SVFa17O85-bKIa_aG99wrkPpWtypo,1101
|
|
42
54
|
tests/conftest.py,sha256=vK5f8DVxCkOGTz3K1835ru5vRgHnaDL_V9M5AUaJ2Zw,974
|
|
43
55
|
tests/test_agent.py,sha256=qx9SFDTP4DlcQi6hV8y6LZyEYX6IB8D3VnM7fODnW9s,5182
|
|
44
56
|
tests/test_autoagent.py,sha256=_mzinLdQwskOn6a-yGqdfoOsqw2f52XSyTCmj8hLqlg,4628
|
|
45
57
|
tests/test_autoagent_day4.py,sha256=TTb0kSImF9stMsq4cMlkGahf9UBpYjoNXAkgnkKuuQA,4719
|
|
58
|
+
tests/test_context.py,sha256=MftpCCeLkmORo-jBzLZtNjMlEZqkvH9Vyt2h5FPHBzo,15628
|
|
46
59
|
tests/test_customagent.py,sha256=auxU6j3GVVT1r2kwoxarFUSCHtwSTjCrxBTqZzezqzw,8310
|
|
60
|
+
tests/test_decorator.py,sha256=cqJL6gbszWbtEwk8yDcRDbdXcykvM0uvGpjWUUqmw_8,20398
|
|
47
61
|
tests/test_integration.py,sha256=X9TYRW2WKF1doLFARTEyCCYLFAnYsazsshDwBzQZcZE,9191
|
|
48
62
|
tests/test_llm_fallback.py,sha256=CNajpKkQ6MO503dRbgaP2cz9kXHwUGKo5381tHKTe4c,5742
|
|
49
63
|
tests/test_mesh.py,sha256=QD0qbVRms7__ox2Ye7Ps4tfuH63m3_EoJzikjHIHjbc,10902
|
|
50
64
|
tests/test_p2p_integration.py,sha256=F9B21eWlwRzSRphm2Kacs9nM1FgSbSzi6RSLPDvvt2U,10995
|
|
51
65
|
tests/test_remote_sandbox.py,sha256=80ebc0pWInauWnywsQ0VSzlk8OexSCgGL7BcJUCPkR8,3268
|
|
52
|
-
jarviscore_framework-0.1.
|
|
53
|
-
jarviscore_framework-0.1.
|
|
54
|
-
jarviscore_framework-0.1.
|
|
55
|
-
jarviscore_framework-0.1.
|
|
66
|
+
jarviscore_framework-0.1.1.dist-info/METADATA,sha256=fTfNWNQ0mEbSMXXe6NjhAPE3_QuPB0dZU4u4d6g7bIA,4313
|
|
67
|
+
jarviscore_framework-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
68
|
+
jarviscore_framework-0.1.1.dist-info/top_level.txt,sha256=P1SVqN5qA97MpLqnuowxDioZ49zccGrx0tjKz-7wz5o,26
|
|
69
|
+
jarviscore_framework-0.1.1.dist-info/RECORD,,
|