jarviscore-framework 0.1.0__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.
Files changed (99) 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 +347 -0
  6. jarviscore/__init__.py +60 -15
  7. jarviscore/adapter/__init__.py +40 -0
  8. jarviscore/adapter/decorator.py +336 -0
  9. jarviscore/adapter/wrapper.py +303 -0
  10. jarviscore/cli/check.py +18 -13
  11. jarviscore/cli/scaffold.py +178 -0
  12. jarviscore/cli/smoketest.py +3 -2
  13. jarviscore/context/__init__.py +40 -0
  14. jarviscore/context/dependency.py +160 -0
  15. jarviscore/context/jarvis_context.py +207 -0
  16. jarviscore/context/memory.py +155 -0
  17. jarviscore/core/agent.py +44 -1
  18. jarviscore/core/mesh.py +196 -35
  19. jarviscore/data/.env.example +146 -0
  20. jarviscore/data/__init__.py +7 -0
  21. jarviscore/data/examples/autoagent_distributed_example.py +211 -0
  22. jarviscore/data/examples/calculator_agent_example.py +77 -0
  23. jarviscore/data/examples/customagent_distributed_example.py +362 -0
  24. jarviscore/data/examples/customagent_p2p_example.py +347 -0
  25. jarviscore/data/examples/multi_agent_workflow.py +132 -0
  26. jarviscore/data/examples/research_agent_example.py +76 -0
  27. jarviscore/docs/API_REFERENCE.md +264 -51
  28. jarviscore/docs/AUTOAGENT_GUIDE.md +198 -0
  29. jarviscore/docs/CONFIGURATION.md +41 -23
  30. jarviscore/docs/CUSTOMAGENT_GUIDE.md +415 -0
  31. jarviscore/docs/GETTING_STARTED.md +113 -17
  32. jarviscore/docs/TROUBLESHOOTING.md +155 -13
  33. jarviscore/docs/USER_GUIDE.md +144 -363
  34. jarviscore/execution/llm.py +23 -16
  35. jarviscore/orchestration/engine.py +20 -8
  36. jarviscore/p2p/__init__.py +10 -0
  37. jarviscore/p2p/coordinator.py +129 -0
  38. jarviscore/p2p/messages.py +87 -0
  39. jarviscore/p2p/peer_client.py +576 -0
  40. jarviscore/p2p/peer_tool.py +268 -0
  41. jarviscore_framework-0.2.0.dist-info/METADATA +143 -0
  42. jarviscore_framework-0.2.0.dist-info/RECORD +132 -0
  43. {jarviscore_framework-0.1.0.dist-info → jarviscore_framework-0.2.0.dist-info}/WHEEL +1 -1
  44. {jarviscore_framework-0.1.0.dist-info → jarviscore_framework-0.2.0.dist-info}/top_level.txt +1 -0
  45. test_logs/code_registry/functions/data_generator-558779ed_560ebc37.py +7 -0
  46. test_logs/code_registry/functions/data_generator-5ed3609e_560ebc37.py +7 -0
  47. test_logs/code_registry/functions/data_generator-66da0356_43970bb9.py +25 -0
  48. test_logs/code_registry/functions/data_generator-7a2fac83_583709d9.py +36 -0
  49. test_logs/code_registry/functions/data_generator-888b670f_aa235863.py +9 -0
  50. test_logs/code_registry/functions/data_generator-9ca5f642_aa235863.py +9 -0
  51. test_logs/code_registry/functions/data_generator-bfd90775_560ebc37.py +7 -0
  52. test_logs/code_registry/functions/data_generator-e95d2f7d_aa235863.py +9 -0
  53. test_logs/code_registry/functions/data_generator-f60ca8a2_327eb8c2.py +29 -0
  54. test_logs/code_registry/functions/mathematician-02adf9ee_958658d9.py +19 -0
  55. test_logs/code_registry/functions/mathematician-0706fb57_5df13441.py +23 -0
  56. test_logs/code_registry/functions/mathematician-153c9c4a_ba59c918.py +83 -0
  57. test_logs/code_registry/functions/mathematician-287e61c0_41daa793.py +18 -0
  58. test_logs/code_registry/functions/mathematician-2967af5a_863c2cc6.py +17 -0
  59. test_logs/code_registry/functions/mathematician-303ca6d6_5df13441.py +23 -0
  60. test_logs/code_registry/functions/mathematician-308a4afd_cbf5064d.py +73 -0
  61. test_logs/code_registry/functions/mathematician-353f16e2_0968bcf5.py +18 -0
  62. test_logs/code_registry/functions/mathematician-3c22475a_41daa793.py +17 -0
  63. test_logs/code_registry/functions/mathematician-5bac1029_0968bcf5.py +18 -0
  64. test_logs/code_registry/functions/mathematician-640f76b2_9198780b.py +19 -0
  65. test_logs/code_registry/functions/mathematician-752fa7ea_863c2cc6.py +17 -0
  66. test_logs/code_registry/functions/mathematician-baf9ef39_0968bcf5.py +18 -0
  67. test_logs/code_registry/functions/mathematician-bc8b2a2f_5df13441.py +23 -0
  68. test_logs/code_registry/functions/mathematician-c31e4686_41daa793.py +18 -0
  69. test_logs/code_registry/functions/mathematician-cc84c84c_863c2cc6.py +17 -0
  70. test_logs/code_registry/functions/mathematician-dd7c7144_9198780b.py +19 -0
  71. test_logs/code_registry/functions/mathematician-e671c256_41ea4487.py +74 -0
  72. test_logs/code_registry/functions/report_generator-1a878fcc_18d44bdc.py +47 -0
  73. test_logs/code_registry/functions/report_generator-25c1c331_cea57d0d.py +35 -0
  74. test_logs/code_registry/functions/report_generator-37552117_e711c2b9.py +35 -0
  75. test_logs/code_registry/functions/report_generator-bc662768_e711c2b9.py +35 -0
  76. test_logs/code_registry/functions/report_generator-d6c0e76b_5e7722ec.py +44 -0
  77. test_logs/code_registry/functions/report_generator-f270fb02_680529c3.py +44 -0
  78. test_logs/code_registry/functions/text_processor-11393b14_4370d3ed.py +40 -0
  79. test_logs/code_registry/functions/text_processor-7d02dfc3_d3b569be.py +37 -0
  80. test_logs/code_registry/functions/text_processor-8adb5e32_9168c5fe.py +13 -0
  81. test_logs/code_registry/functions/text_processor-c58ffc19_78b4ceac.py +42 -0
  82. test_logs/code_registry/functions/text_processor-cd5977b1_9168c5fe.py +13 -0
  83. test_logs/code_registry/functions/text_processor-ec1c8773_9168c5fe.py +13 -0
  84. tests/test_01_analyst_standalone.py +124 -0
  85. tests/test_02_assistant_standalone.py +164 -0
  86. tests/test_03_analyst_with_framework.py +945 -0
  87. tests/test_04_assistant_with_framework.py +1002 -0
  88. tests/test_05_integration.py +1301 -0
  89. tests/test_06_real_llm_integration.py +760 -0
  90. tests/test_07_distributed_single_node.py +578 -0
  91. tests/test_08_distributed_multi_node.py +454 -0
  92. tests/test_09_distributed_autoagent.py +509 -0
  93. tests/test_10_distributed_customagent.py +787 -0
  94. tests/test_context.py +467 -0
  95. tests/test_decorator.py +622 -0
  96. tests/test_mesh.py +35 -4
  97. jarviscore_framework-0.1.0.dist-info/METADATA +0 -136
  98. jarviscore_framework-0.1.0.dist-info/RECORD +0 -55
  99. {jarviscore_framework-0.1.0.dist-info → jarviscore_framework-0.2.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,9 @@
1
+ async def main():
2
+ result = {
3
+ "products": [
4
+ {"name": "Wireless Bluetooth Headphones", "price": 79.99},
5
+ {"name": "Stainless Steel Water Bottle", "price": 24.95},
6
+ {"name": "Portable Phone Charger", "price": 34.50}
7
+ ]
8
+ }
9
+ return result
@@ -0,0 +1,29 @@
1
+ import random
2
+
3
+ def main():
4
+ # List of common words to choose from
5
+ word_list = [
6
+ "apple", "banana", "cherry", "dragon", "elephant",
7
+ "forest", "garden", "harmony", "island", "jungle",
8
+ "kingdom", "lantern", "mountain", "nebula", "ocean",
9
+ "phoenix", "quantum", "rainbow", "sunset", "thunder",
10
+ "umbrella", "volcano", "whisper", "xylophone", "yellow",
11
+ "zenith", "adventure", "brilliant", "cascade", "diamond",
12
+ "eclipse", "fountain", "glacier", "horizon", "infinity",
13
+ "journey", "kaleidoscope", "lighthouse", "mystery", "northern",
14
+ "orchestra", "paradise", "question", "reflection", "symphony",
15
+ "treasure", "universe", "velocity", "wanderer", "yesterday"
16
+ ]
17
+
18
+ # Select 5 random words
19
+ random_words = random.sample(word_list, 5)
20
+
21
+ result = {
22
+ "random_words": random_words,
23
+ "count": len(random_words),
24
+ "description": "A list of 5 randomly selected words"
25
+ }
26
+
27
+ return result
28
+
29
+ result = main()
@@ -0,0 +1,19 @@
1
+ async def main():
2
+ try:
3
+ import math
4
+
5
+ n = 5
6
+ factorial_result = math.factorial(n)
7
+
8
+ result = {
9
+ 'result': factorial_result,
10
+ 'calculation': f'{n}! = {factorial_result}',
11
+ 'method': 'math.factorial'
12
+ }
13
+
14
+ return result
15
+ except Exception as e:
16
+ return {
17
+ 'result': None,
18
+ 'error': str(e)
19
+ }
@@ -0,0 +1,23 @@
1
+ async def main():
2
+ try:
3
+ # Calculate sum of numbers from 1 to 100
4
+ # Using the formula: n * (n + 1) / 2
5
+ n = 100
6
+ sum_formula = n * (n + 1) // 2
7
+
8
+ # Alternative: using sum with range
9
+ sum_range = sum(range(1, 101))
10
+
11
+ result = {
12
+ 'result': sum_formula,
13
+ 'verification': sum_range,
14
+ 'method': 'Gauss formula: n*(n+1)/2',
15
+ 'n': n
16
+ }
17
+
18
+ return result
19
+ except Exception as e:
20
+ return {
21
+ 'result': None,
22
+ 'error': str(e)
23
+ }
@@ -0,0 +1,83 @@
1
+ import math
2
+
3
+ async def main():
4
+ try:
5
+ # Calculate various mathematical results
6
+ calculations = {}
7
+
8
+ # 1. Calculate the golden ratio
9
+ golden_ratio = (1 + math.sqrt(5)) / 2
10
+ calculations['golden_ratio'] = golden_ratio
11
+
12
+ # 2. Calculate e (Euler's number) using series expansion
13
+ e_approximation = sum(1 / math.factorial(n) for n in range(20))
14
+ calculations['e_approximation'] = e_approximation
15
+ calculations['e_actual'] = math.e
16
+
17
+ # 3. Calculate pi using Leibniz formula
18
+ pi_approximation = 4 * sum((-1)**n / (2*n + 1) for n in range(10000))
19
+ calculations['pi_approximation'] = pi_approximation
20
+ calculations['pi_actual'] = math.pi
21
+
22
+ # 4. Calculate factorial of 10
23
+ factorial_10 = math.factorial(10)
24
+ calculations['factorial_10'] = factorial_10
25
+
26
+ # 5. Calculate the sum of first 100 prime numbers
27
+ def is_prime(n):
28
+ if n < 2:
29
+ return False
30
+ if n == 2:
31
+ return True
32
+ if n % 2 == 0:
33
+ return False
34
+ for i in range(3, int(math.sqrt(n)) + 1, 2):
35
+ if n % i == 0:
36
+ return False
37
+ return True
38
+
39
+ primes = []
40
+ num = 2
41
+ while len(primes) < 100:
42
+ if is_prime(num):
43
+ primes.append(num)
44
+ num += 1
45
+
46
+ sum_of_primes = sum(primes)
47
+ calculations['sum_first_100_primes'] = sum_of_primes
48
+ calculations['first_10_primes'] = primes[:10]
49
+ calculations['100th_prime'] = primes[99]
50
+
51
+ # 6. Calculate Fibonacci sequence (first 20 numbers)
52
+ def fibonacci(n):
53
+ fib = [0, 1]
54
+ for i in range(2, n):
55
+ fib.append(fib[i-1] + fib[i-2])
56
+ return fib[:n]
57
+
58
+ fib_sequence = fibonacci(20)
59
+ calculations['fibonacci_20'] = fib_sequence
60
+
61
+ # 7. Calculate the area of a circle with radius 5
62
+ radius = 5
63
+ circle_area = math.pi * radius ** 2
64
+ calculations['circle_area_radius_5'] = circle_area
65
+
66
+ # 8. Calculate hypotenuse of a 3-4-5 triangle
67
+ hypotenuse = math.hypot(3, 4)
68
+ calculations['hypotenuse_3_4'] = hypotenuse
69
+
70
+ result = {
71
+ 'result': calculations,
72
+ 'status': 'success',
73
+ 'description': 'Various mathematical calculations completed successfully'
74
+ }
75
+
76
+ return result
77
+
78
+ except Exception as e:
79
+ return {
80
+ 'result': None,
81
+ 'status': 'error',
82
+ 'error': str(e)
83
+ }
@@ -0,0 +1,18 @@
1
+ import math
2
+
3
+ async def main():
4
+ try:
5
+ number = 144
6
+ square_root = math.sqrt(number)
7
+
8
+ result = {
9
+ 'result': square_root,
10
+ 'input': number,
11
+ 'operation': 'square_root'
12
+ }
13
+ return result
14
+ except Exception as e:
15
+ return {
16
+ 'result': None,
17
+ 'error': str(e)
18
+ }
@@ -0,0 +1,17 @@
1
+ async def main():
2
+ try:
3
+ calculation_result = 2 + 2
4
+ result = {
5
+ 'result': calculation_result,
6
+ 'expression': '2 + 2',
7
+ 'success': True
8
+ }
9
+ return result
10
+ except Exception as e:
11
+ result = {
12
+ 'result': None,
13
+ 'expression': '2 + 2',
14
+ 'success': False,
15
+ 'error': str(e)
16
+ }
17
+ return result
@@ -0,0 +1,23 @@
1
+ async def main():
2
+ try:
3
+ # Calculate sum of numbers from 1 to 100
4
+ # Using the formula: n * (n + 1) / 2
5
+ n = 100
6
+ sum_formula = n * (n + 1) // 2
7
+
8
+ # Alternative: using sum with range
9
+ sum_range = sum(range(1, 101))
10
+
11
+ result = {
12
+ 'result': sum_formula,
13
+ 'verification': sum_range,
14
+ 'method': 'Gauss formula: n*(n+1)/2',
15
+ 'n': n
16
+ }
17
+
18
+ return result
19
+ except Exception as e:
20
+ return {
21
+ 'result': None,
22
+ 'error': str(e)
23
+ }
@@ -0,0 +1,73 @@
1
+ import math
2
+
3
+ async def main():
4
+ try:
5
+ # Calculate various mathematical results
6
+ calculations = {}
7
+
8
+ # 1. Calculate the golden ratio
9
+ golden_ratio = (1 + math.sqrt(5)) / 2
10
+ calculations['golden_ratio'] = golden_ratio
11
+
12
+ # 2. Calculate e (Euler's number) using series expansion
13
+ e_approximation = sum(1 / math.factorial(n) for n in range(20))
14
+ calculations['e_approximation'] = e_approximation
15
+ calculations['e_actual'] = math.e
16
+
17
+ # 3. Calculate pi using Leibniz formula
18
+ pi_approximation = 4 * sum((-1)**n / (2*n + 1) for n in range(10000))
19
+ calculations['pi_approximation'] = pi_approximation
20
+ calculations['pi_actual'] = math.pi
21
+
22
+ # 4. Calculate factorial of 10
23
+ factorial_10 = math.factorial(10)
24
+ calculations['factorial_10'] = factorial_10
25
+
26
+ # 5. Calculate the sum of first 100 prime numbers
27
+ def is_prime(n):
28
+ if n < 2:
29
+ return False
30
+ for i in range(2, int(math.sqrt(n)) + 1):
31
+ if n % i == 0:
32
+ return False
33
+ return True
34
+
35
+ primes = []
36
+ num = 2
37
+ while len(primes) < 100:
38
+ if is_prime(num):
39
+ primes.append(num)
40
+ num += 1
41
+
42
+ calculations['sum_first_100_primes'] = sum(primes)
43
+ calculations['first_10_primes'] = primes[:10]
44
+
45
+ # 6. Calculate Fibonacci sequence (first 20 numbers)
46
+ def fibonacci(n):
47
+ fib = [0, 1]
48
+ for i in range(2, n):
49
+ fib.append(fib[i-1] + fib[i-2])
50
+ return fib[:n]
51
+
52
+ calculations['fibonacci_20'] = fibonacci(20)
53
+
54
+ # 7. Calculate square root of 2 (irrational number)
55
+ calculations['sqrt_2'] = math.sqrt(2)
56
+
57
+ # 8. Calculate natural logarithm of 10
58
+ calculations['ln_10'] = math.log(10)
59
+
60
+ result = {
61
+ 'result': calculations,
62
+ 'status': 'success',
63
+ 'description': 'Various mathematical calculations completed successfully'
64
+ }
65
+
66
+ return result
67
+
68
+ except Exception as e:
69
+ return {
70
+ 'result': None,
71
+ 'status': 'error',
72
+ 'error': str(e)
73
+ }
@@ -0,0 +1,18 @@
1
+ async def main():
2
+ try:
3
+ fibonacci_numbers = []
4
+ a, b = 0, 1
5
+
6
+ for _ in range(10):
7
+ fibonacci_numbers.append(a)
8
+ a, b = b, a + b
9
+
10
+ result = {
11
+ 'result': fibonacci_numbers
12
+ }
13
+ return result
14
+ except Exception as e:
15
+ return {
16
+ 'result': None,
17
+ 'error': str(e)
18
+ }
@@ -0,0 +1,17 @@
1
+ import math
2
+
3
+ async def main():
4
+ try:
5
+ number = 144
6
+ square_root = math.sqrt(number)
7
+ result = {
8
+ 'result': square_root,
9
+ 'input': number,
10
+ 'operation': 'square_root'
11
+ }
12
+ return result
13
+ except Exception as e:
14
+ return {
15
+ 'result': None,
16
+ 'error': str(e)
17
+ }
@@ -0,0 +1,18 @@
1
+ async def main():
2
+ try:
3
+ fibonacci_numbers = []
4
+ a, b = 0, 1
5
+
6
+ for _ in range(10):
7
+ fibonacci_numbers.append(a)
8
+ a, b = b, a + b
9
+
10
+ result = {
11
+ 'result': fibonacci_numbers
12
+ }
13
+ return result
14
+ except Exception as e:
15
+ return {
16
+ 'result': None,
17
+ 'error': str(e)
18
+ }
@@ -0,0 +1,19 @@
1
+ async def main():
2
+ try:
3
+ import math
4
+
5
+ n = 5
6
+ factorial_result = math.factorial(n)
7
+
8
+ result = {
9
+ 'result': factorial_result,
10
+ 'input': n,
11
+ 'calculation': f'{n}! = {factorial_result}'
12
+ }
13
+
14
+ return result
15
+ except Exception as e:
16
+ return {
17
+ 'result': None,
18
+ 'error': str(e)
19
+ }
@@ -0,0 +1,17 @@
1
+ async def main():
2
+ try:
3
+ calculation_result = 2 + 2
4
+ result = {
5
+ 'result': calculation_result,
6
+ 'expression': '2 + 2',
7
+ 'success': True
8
+ }
9
+ return result
10
+ except Exception as e:
11
+ result = {
12
+ 'result': None,
13
+ 'expression': '2 + 2',
14
+ 'success': False,
15
+ 'error': str(e)
16
+ }
17
+ return result
@@ -0,0 +1,18 @@
1
+ async def main():
2
+ try:
3
+ fibonacci_numbers = []
4
+ a, b = 0, 1
5
+
6
+ for _ in range(10):
7
+ fibonacci_numbers.append(a)
8
+ a, b = b, a + b
9
+
10
+ result = {
11
+ 'result': fibonacci_numbers
12
+ }
13
+ return result
14
+ except Exception as e:
15
+ return {
16
+ 'result': None,
17
+ 'error': str(e)
18
+ }
@@ -0,0 +1,23 @@
1
+ async def main():
2
+ try:
3
+ # Calculate sum of numbers from 1 to 100
4
+ # Using the formula: n * (n + 1) / 2
5
+ n = 100
6
+ sum_formula = n * (n + 1) // 2
7
+
8
+ # Alternative: using sum with range
9
+ sum_range = sum(range(1, 101))
10
+
11
+ result = {
12
+ 'result': sum_formula,
13
+ 'verification': sum_range,
14
+ 'method': 'Gauss formula: n*(n+1)/2',
15
+ 'n': n
16
+ }
17
+
18
+ return result
19
+ except Exception as e:
20
+ return {
21
+ 'result': None,
22
+ 'error': str(e)
23
+ }
@@ -0,0 +1,18 @@
1
+ import math
2
+
3
+ async def main():
4
+ try:
5
+ number = 144
6
+ square_root = math.sqrt(number)
7
+
8
+ result = {
9
+ 'result': square_root,
10
+ 'input': number,
11
+ 'operation': 'square_root'
12
+ }
13
+ return result
14
+ except Exception as e:
15
+ return {
16
+ 'result': None,
17
+ 'error': str(e)
18
+ }
@@ -0,0 +1,17 @@
1
+ async def main():
2
+ try:
3
+ calculation_result = 2 + 2
4
+ result = {
5
+ 'result': calculation_result,
6
+ 'expression': '2 + 2',
7
+ 'success': True
8
+ }
9
+ return result
10
+ except Exception as e:
11
+ result = {
12
+ 'result': None,
13
+ 'expression': '2 + 2',
14
+ 'success': False,
15
+ 'error': str(e)
16
+ }
17
+ return result
@@ -0,0 +1,19 @@
1
+ async def main():
2
+ try:
3
+ import math
4
+
5
+ n = 5
6
+ factorial_result = math.factorial(n)
7
+
8
+ result = {
9
+ 'result': factorial_result,
10
+ 'input': n,
11
+ 'calculation': f'{n}! = {factorial_result}'
12
+ }
13
+
14
+ return result
15
+ except Exception as e:
16
+ return {
17
+ 'result': None,
18
+ 'error': str(e)
19
+ }
@@ -0,0 +1,74 @@
1
+ import math
2
+
3
+ async def main():
4
+ try:
5
+ # Calculate various mathematical results
6
+ calculations = {}
7
+
8
+ # 1. Calculate the golden ratio
9
+ golden_ratio = (1 + math.sqrt(5)) / 2
10
+ calculations['golden_ratio'] = golden_ratio
11
+
12
+ # 2. Calculate e (Euler's number) using series expansion
13
+ e_approximation = sum(1 / math.factorial(n) for n in range(20))
14
+ calculations['e_approximation'] = e_approximation
15
+ calculations['e_actual'] = math.e
16
+
17
+ # 3. Calculate pi using Leibniz formula
18
+ pi_approximation = 4 * sum((-1)**n / (2*n + 1) for n in range(10000))
19
+ calculations['pi_approximation'] = pi_approximation
20
+ calculations['pi_actual'] = math.pi
21
+
22
+ # 4. Calculate factorial of 10
23
+ factorial_10 = math.factorial(10)
24
+ calculations['factorial_10'] = factorial_10
25
+
26
+ # 5. Calculate the sum of first 100 prime numbers
27
+ def is_prime(n):
28
+ if n < 2:
29
+ return False
30
+ for i in range(2, int(math.sqrt(n)) + 1):
31
+ if n % i == 0:
32
+ return False
33
+ return True
34
+
35
+ primes = []
36
+ num = 2
37
+ while len(primes) < 100:
38
+ if is_prime(num):
39
+ primes.append(num)
40
+ num += 1
41
+
42
+ calculations['sum_first_100_primes'] = sum(primes)
43
+ calculations['first_10_primes'] = primes[:10]
44
+
45
+ # 6. Calculate Fibonacci sequence (first 20 numbers)
46
+ def fibonacci(n):
47
+ fib = [0, 1]
48
+ for i in range(2, n):
49
+ fib.append(fib[i-1] + fib[i-2])
50
+ return fib[:n]
51
+
52
+ calculations['fibonacci_20'] = fibonacci(20)
53
+
54
+ # 7. Calculate square root of 2 (irrational number approximation)
55
+ calculations['sqrt_2'] = math.sqrt(2)
56
+
57
+ # 8. Calculate the area of a circle with radius 5
58
+ radius = 5
59
+ calculations['circle_area_r5'] = math.pi * radius ** 2
60
+
61
+ result = {
62
+ 'result': calculations,
63
+ 'status': 'success',
64
+ 'description': 'Various mathematical calculations completed successfully'
65
+ }
66
+
67
+ return result
68
+
69
+ except Exception as e:
70
+ return {
71
+ 'result': None,
72
+ 'status': 'error',
73
+ 'error_message': str(e)
74
+ }
@@ -0,0 +1,47 @@
1
+ async def main():
2
+ try:
3
+ # Get data from previous step if available, otherwise use provided defaults
4
+ previous_data = {'name': 'John', 'age': 30, 'city': 'NYC'}
5
+
6
+ # Check if we have previous step results
7
+ try:
8
+ if 'step0' in globals().get('previous_step_results', {}):
9
+ previous_data = previous_step_results['step0']
10
+ except:
11
+ pass
12
+
13
+ # Extract person data
14
+ name = previous_data.get('name', 'John')
15
+ age = previous_data.get('age', 30)
16
+ city = previous_data.get('city', 'NYC')
17
+
18
+ # Create formatted text report
19
+ report_lines = [
20
+ "=" * 40,
21
+ "PERSON INFORMATION REPORT",
22
+ "=" * 40,
23
+ "",
24
+ f"Name: {name}",
25
+ f"Age: {age}",
26
+ f"City: {city}",
27
+ "",
28
+ "-" * 40,
29
+ f"Summary: {name} is {age} years old and lives in {city}.",
30
+ "-" * 40,
31
+ "",
32
+ "Report generated successfully.",
33
+ "=" * 40
34
+ ]
35
+
36
+ report = "\n".join(report_lines)
37
+
38
+ result = {
39
+ 'report': report
40
+ }
41
+
42
+ return result
43
+
44
+ except Exception as e:
45
+ return {
46
+ 'report': f"Error generating report: {str(e)}"
47
+ }
@@ -0,0 +1,35 @@
1
+ async def main():
2
+ try:
3
+ # Create invoice header with company name and date
4
+ company_name = "Acme Corp"
5
+ date = "Jan 2024"
6
+
7
+ # Create formatted header
8
+ header_width = 50
9
+ border = "=" * header_width
10
+
11
+ # Center the company name and date
12
+ company_line = company_name.center(header_width)
13
+ date_line = date.center(header_width)
14
+ title_line = "INVOICE".center(header_width)
15
+
16
+ # Build the invoice header
17
+ invoice_header = f"""
18
+ {border}
19
+ {company_line}
20
+ {title_line}
21
+ {date_line}
22
+ {border}
23
+ """
24
+
25
+ result = {
26
+ 'report': invoice_header.strip()
27
+ }
28
+
29
+ return result
30
+
31
+ except Exception as e:
32
+ result = {
33
+ 'report': f"Error generating invoice header: {str(e)}"
34
+ }
35
+ return result