Amsha 3.0.0__tar.gz

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 (119) hide show
  1. amsha-3.0.0/LICENSE +21 -0
  2. amsha-3.0.0/PKG-INFO +173 -0
  3. amsha-3.0.0/README.md +145 -0
  4. amsha-3.0.0/pyproject.toml +49 -0
  5. amsha-3.0.0/setup.cfg +4 -0
  6. amsha-3.0.0/src/nikhil/Amsha.egg-info/PKG-INFO +173 -0
  7. amsha-3.0.0/src/nikhil/Amsha.egg-info/SOURCES.txt +117 -0
  8. amsha-3.0.0/src/nikhil/Amsha.egg-info/dependency_links.txt +1 -0
  9. amsha-3.0.0/src/nikhil/Amsha.egg-info/requires.txt +18 -0
  10. amsha-3.0.0/src/nikhil/Amsha.egg-info/top_level.txt +1 -0
  11. amsha-3.0.0/src/nikhil/amsha/__init__.py +0 -0
  12. amsha-3.0.0/src/nikhil/amsha/common/__init__.py +4 -0
  13. amsha-3.0.0/src/nikhil/amsha/common/logger.py +273 -0
  14. amsha-3.0.0/src/nikhil/amsha/configuration/application/configuration_manager.py +57 -0
  15. amsha-3.0.0/src/nikhil/amsha/configuration/domain/models/amsha_app_config.py +9 -0
  16. amsha-3.0.0/src/nikhil/amsha/configuration/domain/models/amsha_job_config.py +35 -0
  17. amsha-3.0.0/src/nikhil/amsha/configuration/domain/models/amsha_llm_config.py +38 -0
  18. amsha-3.0.0/src/nikhil/amsha/configuration/exceptions/amsha_configuration_exception.py +16 -0
  19. amsha-3.0.0/src/nikhil/amsha/configuration/infrastructure/strict_validator.py +50 -0
  20. amsha-3.0.0/src/nikhil/amsha/crew_forge/__init__.py +4 -0
  21. amsha-3.0.0/src/nikhil/amsha/crew_forge/dependency/__init__.py +0 -0
  22. amsha-3.0.0/src/nikhil/amsha/crew_forge/domain/__init__.py +0 -0
  23. amsha-3.0.0/src/nikhil/amsha/crew_forge/domain/enum/__init__.py +0 -0
  24. amsha-3.0.0/src/nikhil/amsha/crew_forge/domain/models/__init__.py +0 -0
  25. amsha-3.0.0/src/nikhil/amsha/crew_forge/domain/models/agent_data.py +34 -0
  26. amsha-3.0.0/src/nikhil/amsha/crew_forge/domain/models/crew_data.py +30 -0
  27. amsha-3.0.0/src/nikhil/amsha/crew_forge/domain/models/mcp_data.py +49 -0
  28. amsha-3.0.0/src/nikhil/amsha/crew_forge/domain/models/task_data.py +22 -0
  29. amsha-3.0.0/src/nikhil/amsha/crew_forge/exceptions/__init__.py +24 -0
  30. amsha-3.0.0/src/nikhil/amsha/crew_forge/exceptions/crew_configuration_exception.py +39 -0
  31. amsha-3.0.0/src/nikhil/amsha/crew_forge/exceptions/crew_execution_exception.py +38 -0
  32. amsha-3.0.0/src/nikhil/amsha/crew_forge/exceptions/crew_forge_exception.py +37 -0
  33. amsha-3.0.0/src/nikhil/amsha/crew_forge/exceptions/crew_manager_exception.py +38 -0
  34. amsha-3.0.0/src/nikhil/amsha/crew_forge/exceptions/error_context.py +206 -0
  35. amsha-3.0.0/src/nikhil/amsha/crew_forge/exceptions/input_preparation_exception.py +38 -0
  36. amsha-3.0.0/src/nikhil/amsha/crew_forge/knowledge/__init__.py +0 -0
  37. amsha-3.0.0/src/nikhil/amsha/crew_forge/knowledge/amsha_crew_docling_source.py +136 -0
  38. amsha-3.0.0/src/nikhil/amsha/crew_forge/knowledge/amsha_json_knowledge_source.py +56 -0
  39. amsha-3.0.0/src/nikhil/amsha/crew_forge/orchestrator/__init__.py +0 -0
  40. amsha-3.0.0/src/nikhil/amsha/crew_forge/orchestrator/file/__init__.py +0 -0
  41. amsha-3.0.0/src/nikhil/amsha/crew_forge/orchestrator/file/amsha_crew_file_application.py +223 -0
  42. amsha-3.0.0/src/nikhil/amsha/crew_forge/orchestrator/file/atomic_crew_file_manager.py +128 -0
  43. amsha-3.0.0/src/nikhil/amsha/crew_forge/orchestrator/file/file_crew_orchestrator.py +153 -0
  44. amsha-3.0.0/src/nikhil/amsha/crew_forge/orchestrator/flow/__init__.py +3 -0
  45. amsha-3.0.0/src/nikhil/amsha/crew_forge/orchestrator/flow/flow_crew_pipeline.py +134 -0
  46. amsha-3.0.0/src/nikhil/amsha/crew_forge/protocols/__init__.py +0 -0
  47. amsha-3.0.0/src/nikhil/amsha/crew_forge/protocols/crew_application.py +99 -0
  48. amsha-3.0.0/src/nikhil/amsha/crew_forge/protocols/crew_manager.py +69 -0
  49. amsha-3.0.0/src/nikhil/amsha/crew_forge/protocols/crew_orchestrator.py +72 -0
  50. amsha-3.0.0/src/nikhil/amsha/crew_forge/protocols/input_preparation_service.py +61 -0
  51. amsha-3.0.0/src/nikhil/amsha/crew_forge/seeding/__init__.py +0 -0
  52. amsha-3.0.0/src/nikhil/amsha/crew_forge/seeding/parser/__init__.py +0 -0
  53. amsha-3.0.0/src/nikhil/amsha/crew_forge/seeding/parser/crew_parser.py +48 -0
  54. amsha-3.0.0/src/nikhil/amsha/crew_forge/service/__init__.py +0 -0
  55. amsha-3.0.0/src/nikhil/amsha/crew_forge/service/atomic_yaml_builder.py +77 -0
  56. amsha-3.0.0/src/nikhil/amsha/crew_forge/service/base_crew_orchestrator.py +322 -0
  57. amsha-3.0.0/src/nikhil/amsha/crew_forge/service/crew_builder_service.py +247 -0
  58. amsha-3.0.0/src/nikhil/amsha/crew_forge/service/shared_input_preparation_service.py +203 -0
  59. amsha-3.0.0/src/nikhil/amsha/crew_forge/service/shared_json_file_service.py +179 -0
  60. amsha-3.0.0/src/nikhil/amsha/crew_forge/service/shared_llm_initialization_service.py +159 -0
  61. amsha-3.0.0/src/nikhil/amsha/crew_forge/service/tool_registry.py +58 -0
  62. amsha-3.0.0/src/nikhil/amsha/crew_monitor/__init__.py +13 -0
  63. amsha-3.0.0/src/nikhil/amsha/crew_monitor/service/__init__.py +0 -0
  64. amsha-3.0.0/src/nikhil/amsha/crew_monitor/service/amsha_event_listener.py +238 -0
  65. amsha-3.0.0/src/nikhil/amsha/crew_monitor/service/contribution_analyzer.py +109 -0
  66. amsha-3.0.0/src/nikhil/amsha/crew_monitor/service/crew_performance_monitor.py +165 -0
  67. amsha-3.0.0/src/nikhil/amsha/crew_monitor/service/reporting_tool.py +164 -0
  68. amsha-3.0.0/src/nikhil/amsha/execution_runtime/__init__.py +0 -0
  69. amsha-3.0.0/src/nikhil/amsha/execution_runtime/domain/__init__.py +2 -0
  70. amsha-3.0.0/src/nikhil/amsha/execution_runtime/domain/execution_handle.py +29 -0
  71. amsha-3.0.0/src/nikhil/amsha/execution_runtime/domain/execution_mode.py +9 -0
  72. amsha-3.0.0/src/nikhil/amsha/execution_runtime/service/__init__.py +1 -0
  73. amsha-3.0.0/src/nikhil/amsha/execution_runtime/service/runtime_engine.py +89 -0
  74. amsha-3.0.0/src/nikhil/amsha/execution_state/__init__.py +0 -0
  75. amsha-3.0.0/src/nikhil/amsha/execution_state/domain/__init__.py +2 -0
  76. amsha-3.0.0/src/nikhil/amsha/execution_state/domain/enums.py +12 -0
  77. amsha-3.0.0/src/nikhil/amsha/execution_state/domain/execution_state.py +60 -0
  78. amsha-3.0.0/src/nikhil/amsha/execution_state/service/__init__.py +1 -0
  79. amsha-3.0.0/src/nikhil/amsha/execution_state/service/state_manager.py +67 -0
  80. amsha-3.0.0/src/nikhil/amsha/llm_factory/__init__.py +0 -0
  81. amsha-3.0.0/src/nikhil/amsha/llm_factory/adapters/__init__.py +0 -0
  82. amsha-3.0.0/src/nikhil/amsha/llm_factory/adapters/crewai_adapter.py +22 -0
  83. amsha-3.0.0/src/nikhil/amsha/llm_factory/adapters/lmstudio_lifecycle_client.py +125 -0
  84. amsha-3.0.0/src/nikhil/amsha/llm_factory/dependency/__init__.py +0 -0
  85. amsha-3.0.0/src/nikhil/amsha/llm_factory/dependency/llm_container.py +33 -0
  86. amsha-3.0.0/src/nikhil/amsha/llm_factory/domain/__init__.py +0 -0
  87. amsha-3.0.0/src/nikhil/amsha/llm_factory/domain/llm_type.py +5 -0
  88. amsha-3.0.0/src/nikhil/amsha/llm_factory/domain/model/__init__.py +0 -0
  89. amsha-3.0.0/src/nikhil/amsha/llm_factory/domain/model/llm_build_result.py +17 -0
  90. amsha-3.0.0/src/nikhil/amsha/llm_factory/domain/model/llm_model_capabilities.py +15 -0
  91. amsha-3.0.0/src/nikhil/amsha/llm_factory/domain/model/llm_model_config.py +17 -0
  92. amsha-3.0.0/src/nikhil/amsha/llm_factory/domain/model/llm_output_config.py +19 -0
  93. amsha-3.0.0/src/nikhil/amsha/llm_factory/domain/model/llm_parameters.py +12 -0
  94. amsha-3.0.0/src/nikhil/amsha/llm_factory/domain/model/llm_type.py +7 -0
  95. amsha-3.0.0/src/nikhil/amsha/llm_factory/domain/model/llm_use_case_config.py +9 -0
  96. amsha-3.0.0/src/nikhil/amsha/llm_factory/domain/model/lmstudio_lifecycle_config.py +19 -0
  97. amsha-3.0.0/src/nikhil/amsha/llm_factory/domain/provider_protocol.py +21 -0
  98. amsha-3.0.0/src/nikhil/amsha/llm_factory/exceptions.py +2 -0
  99. amsha-3.0.0/src/nikhil/amsha/llm_factory/service/__init__.py +0 -0
  100. amsha-3.0.0/src/nikhil/amsha/llm_factory/service/llm_builder.py +75 -0
  101. amsha-3.0.0/src/nikhil/amsha/llm_factory/settings/__init__.py +0 -0
  102. amsha-3.0.0/src/nikhil/amsha/llm_factory/settings/llm_settings.py +62 -0
  103. amsha-3.0.0/src/nikhil/amsha/llm_factory/utils/__init__.py +0 -0
  104. amsha-3.0.0/src/nikhil/amsha/llm_factory/utils/deprecated_compat.py +60 -0
  105. amsha-3.0.0/src/nikhil/amsha/llm_factory/utils/llm_utils.py +35 -0
  106. amsha-3.0.0/src/nikhil/amsha/output_process/__init__.py +0 -0
  107. amsha-3.0.0/src/nikhil/amsha/output_process/evaluation/__init__.py +0 -0
  108. amsha-3.0.0/src/nikhil/amsha/output_process/evaluation/evaluation_aggregate_tool.py +0 -0
  109. amsha-3.0.0/src/nikhil/amsha/output_process/evaluation/evaluation_processing_tool.py +0 -0
  110. amsha-3.0.0/src/nikhil/amsha/output_process/evaluation/evaluation_report_tool.py +0 -0
  111. amsha-3.0.0/src/nikhil/amsha/output_process/optimization/__init__.py +0 -0
  112. amsha-3.0.0/src/nikhil/amsha/output_process/optimization/json_cleaner_utils.py +182 -0
  113. amsha-3.0.0/src/nikhil/amsha/output_process/validation/__init__.py +0 -0
  114. amsha-3.0.0/src/nikhil/amsha/output_process/validation/crew_validator.py +0 -0
  115. amsha-3.0.0/src/nikhil/amsha/output_process/validation/json_output_validator.py +0 -0
  116. amsha-3.0.0/src/nikhil/amsha/utils/__init__.py +0 -0
  117. amsha-3.0.0/src/nikhil/amsha/utils/json_utils.py +50 -0
  118. amsha-3.0.0/src/nikhil/amsha/utils/utf8_utils.py +51 -0
  119. amsha-3.0.0/src/nikhil/amsha/utils/yaml_utils.py +19 -0
amsha-3.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Nikhil Vijayakumar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
amsha-3.0.0/PKG-INFO ADDED
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.4
2
+ Name: Amsha
3
+ Version: 3.0.0
4
+ Summary: Amsha is a lightweight library designed to provide common configuration and helper utilities for CrewAI orchestration. It serves as a foundational component for building scalable and maintainable AI agent systems
5
+ License-Expression: MIT
6
+ Project-URL: Repository, https://github.com/NikhilVijayakumar/Amsha
7
+ Requires-Python: <3.14,>=3.12
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: PyYAML==6.0.3
11
+ Requires-Dist: crewai==1.15.18
12
+ Requires-Dist: crewai-tools==1.15.18
13
+ Requires-Dist: dependency-injector==4.48.2
14
+ Requires-Dist: pandas==2.3.2
15
+ Requires-Dist: openpyxl==3.1.5
16
+ Requires-Dist: pydantic==2.11.9
17
+ Requires-Dist: docling==2.53.0
18
+ Requires-Dist: psutil==7.1.3
19
+ Requires-Dist: chardet==5.2.0
20
+ Requires-Dist: nvidia-ml-py==13.580.82
21
+ Requires-Dist: litellm>=1.99.0
22
+ Provides-Extra: research
23
+ Requires-Dist: scikit-learn>=1.3.0; extra == "research"
24
+ Requires-Dist: matplotlib>=3.7.0; extra == "research"
25
+ Requires-Dist: seaborn>=0.12.0; extra == "research"
26
+ Requires-Dist: jupyter>=1.0.0; extra == "research"
27
+ Dynamic: license-file
28
+
29
+ # Amsha
30
+
31
+ **Amsha** is a lightweight library for **CrewAI** orchestration. It provides configuration management, agent/task definition, knowledge integration, and monitoring utilities — letting you define crews in YAML and run them with minimal boilerplate.
32
+
33
+ ---
34
+
35
+ ## Key Features
36
+
37
+ ### Crew Forge & Orchestration
38
+ - **File-Based**: Define agents and tasks in version-controlled YAML files.
39
+ - **Flows**: Multi-crew pipelines via CrewAI `Flow` — ordered execution with shared state.
40
+ - **Memory & Checkpointing**: Opt-in per crew (`memory: true`, `checkpoint:` config) — off by default.
41
+ - **Tracing**: Opt-in CrewAI native tracing (`tracing: true`) — off by default, sends prompts to CrewAI's hosted dashboard.
42
+
43
+ ### Tools & MCP
44
+ - **Tool Registry**: Agents and tasks declare tools by name in YAML (`tools: [file_read, directory_read]`). Ships with built-in tools; extend with `register_tool()`.
45
+ - **MCP Servers**: Agents connect to MCP servers via structured YAML (`mcp_servers:`) — stdio, HTTP, or SSE transports.
46
+
47
+ ### Knowledge Management
48
+ - **Multi-Format**: Docling-powered sources for Markdown, PDF, DOCX, HTML, XLSX, PPTX, images.
49
+ - **JSON Native**: CrewAI's `JSONKnowledgeSource` for structured JSON files.
50
+ - **Auto-Routing**: `.json` paths route to JSON source; everything else to Docling.
51
+
52
+ ### Skills
53
+ - **Runtime Skills**: Agents reference CrewAI skills by name in YAML (`skills: ["domain-skills"]`). Amsha resolves names to skill search paths.
54
+
55
+ ### Monitoring & Observability
56
+ - **CrewPerformanceMonitor**: Real-time CPU/GPU/memory tracking during execution.
57
+ - **AmshaEventListener**: Event-bus subscriber for per-task, per-LLM-call, per-tool-call lifecycle logs — local, no cloud dependency.
58
+ - **Contribution Analysis & Reporting**: Feature attribution analysis and Excel report generation.
59
+
60
+ ### LLM Factory
61
+ - **Unified Config**: One YAML for all LLM providers (Ollama, LM Studio, OpenRouter, Gemini).
62
+ - **Purpose Profiles**: Creative (high temperature) vs. Evaluation (deterministic) modes.
63
+
64
+ ---
65
+
66
+ ## Installation
67
+
68
+ ```bash
69
+ pip install amsha
70
+ ```
71
+
72
+ Amsha currently declares Docling as a runtime dependency. Until the first PyPI release is published, use the existing source installation. See [release guidance](docs/releasing.md) for the publishing process.
73
+
74
+ ---
75
+
76
+ ## Migration to 3.0
77
+
78
+ **Migration:** Azure-qualified LLM models (`azure/` and `azure_ai/`) are no longer supported. Configure another provider before upgrading to the next major version.
79
+
80
+ ## Quick Start
81
+
82
+ ```python
83
+ from amsha.crew_forge.orchestrator.file.amsha_crew_file_application import AmshaCrewFileApplication
84
+ from amsha.llm_factory.domain.model.llm_type import LLMType
85
+
86
+ config_paths = {
87
+ "app": "config/app_config.yaml",
88
+ "job": "config/job_config.yaml",
89
+ "llm": "config/llm_config.yaml"
90
+ }
91
+
92
+ app = AmshaCrewFileApplication(config_paths=config_paths, llm_type=LLMType.CREATIVE)
93
+ ```
94
+
95
+ ### Agent YAML with Tools, Skills, and MCP
96
+
97
+ ```yaml
98
+ # agents/researcher_agent.yaml
99
+ agent:
100
+ role: "Researcher"
101
+ goal: "Research topics thoroughly"
102
+ backstory: "Expert researcher with access to web and files"
103
+ tools: [file_read, directory_read]
104
+ skills: ["domain-skills"]
105
+ mcp_servers:
106
+ - transport: stdio
107
+ command: python
108
+ args: [servers/db_server.py]
109
+ env:
110
+ DB_HOST: localhost
111
+ ```
112
+
113
+ ### Crew Config with Memory, Checkpointing, Tracing
114
+
115
+ ```yaml
116
+ # job_config.yaml
117
+ crews:
118
+ research_crew:
119
+ memory: true
120
+ checkpoint:
121
+ enabled: true
122
+ provider: json
123
+ location: "./.Amsha/execution/checkpoints"
124
+ tracing: true # opt-in: sends prompts to CrewAI dashboard
125
+ steps:
126
+ - task_key: research_task
127
+ agent_key: researcher_agent
128
+ ```
129
+
130
+ ### Multi-Crew Pipeline
131
+
132
+ ```yaml
133
+ pipeline:
134
+ - "research_crew"
135
+ - "writing_crew"
136
+ ```
137
+
138
+ ```python
139
+ outputs = app.run_pipeline({"brief": "..."})
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Configuration Structure
145
+
146
+ - **`app_config.yaml`**: Global settings (directories, output paths).
147
+ - **`job_config.yaml`**: Crew definitions, steps, pipelines, knowledge sources.
148
+ - **`llm_config.yaml`**: LLM provider, model, API keys, creative/evaluation profiles.
149
+
150
+ ---
151
+
152
+ ## Testing
153
+
154
+ ```bash
155
+ python -m pytest tests/unit/
156
+ ```
157
+
158
+ With coverage:
159
+ ```bash
160
+ python -m pytest tests/unit/ --cov=amsha --cov-report=term-missing
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Documentation
166
+
167
+ - [Crew Forge](docs/feature/crew_forge/About.md) — orchestration, YAML schema, tools, MCP, flows
168
+ - [Crew Monitor](docs/feature/crew_monitor/About.md) — performance monitoring, event observability
169
+ - [LLM Factory](docs/feature/llm_factory/About.md) — LLM configuration and profiles
170
+
171
+ ## License
172
+
173
+ Copyright (c) 2025 Nikhil Vijayakumar. Licensed under the [MIT License](LICENSE).
amsha-3.0.0/README.md ADDED
@@ -0,0 +1,145 @@
1
+ # Amsha
2
+
3
+ **Amsha** is a lightweight library for **CrewAI** orchestration. It provides configuration management, agent/task definition, knowledge integration, and monitoring utilities — letting you define crews in YAML and run them with minimal boilerplate.
4
+
5
+ ---
6
+
7
+ ## Key Features
8
+
9
+ ### Crew Forge & Orchestration
10
+ - **File-Based**: Define agents and tasks in version-controlled YAML files.
11
+ - **Flows**: Multi-crew pipelines via CrewAI `Flow` — ordered execution with shared state.
12
+ - **Memory & Checkpointing**: Opt-in per crew (`memory: true`, `checkpoint:` config) — off by default.
13
+ - **Tracing**: Opt-in CrewAI native tracing (`tracing: true`) — off by default, sends prompts to CrewAI's hosted dashboard.
14
+
15
+ ### Tools & MCP
16
+ - **Tool Registry**: Agents and tasks declare tools by name in YAML (`tools: [file_read, directory_read]`). Ships with built-in tools; extend with `register_tool()`.
17
+ - **MCP Servers**: Agents connect to MCP servers via structured YAML (`mcp_servers:`) — stdio, HTTP, or SSE transports.
18
+
19
+ ### Knowledge Management
20
+ - **Multi-Format**: Docling-powered sources for Markdown, PDF, DOCX, HTML, XLSX, PPTX, images.
21
+ - **JSON Native**: CrewAI's `JSONKnowledgeSource` for structured JSON files.
22
+ - **Auto-Routing**: `.json` paths route to JSON source; everything else to Docling.
23
+
24
+ ### Skills
25
+ - **Runtime Skills**: Agents reference CrewAI skills by name in YAML (`skills: ["domain-skills"]`). Amsha resolves names to skill search paths.
26
+
27
+ ### Monitoring & Observability
28
+ - **CrewPerformanceMonitor**: Real-time CPU/GPU/memory tracking during execution.
29
+ - **AmshaEventListener**: Event-bus subscriber for per-task, per-LLM-call, per-tool-call lifecycle logs — local, no cloud dependency.
30
+ - **Contribution Analysis & Reporting**: Feature attribution analysis and Excel report generation.
31
+
32
+ ### LLM Factory
33
+ - **Unified Config**: One YAML for all LLM providers (Ollama, LM Studio, OpenRouter, Gemini).
34
+ - **Purpose Profiles**: Creative (high temperature) vs. Evaluation (deterministic) modes.
35
+
36
+ ---
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ pip install amsha
42
+ ```
43
+
44
+ Amsha currently declares Docling as a runtime dependency. Until the first PyPI release is published, use the existing source installation. See [release guidance](docs/releasing.md) for the publishing process.
45
+
46
+ ---
47
+
48
+ ## Migration to 3.0
49
+
50
+ **Migration:** Azure-qualified LLM models (`azure/` and `azure_ai/`) are no longer supported. Configure another provider before upgrading to the next major version.
51
+
52
+ ## Quick Start
53
+
54
+ ```python
55
+ from amsha.crew_forge.orchestrator.file.amsha_crew_file_application import AmshaCrewFileApplication
56
+ from amsha.llm_factory.domain.model.llm_type import LLMType
57
+
58
+ config_paths = {
59
+ "app": "config/app_config.yaml",
60
+ "job": "config/job_config.yaml",
61
+ "llm": "config/llm_config.yaml"
62
+ }
63
+
64
+ app = AmshaCrewFileApplication(config_paths=config_paths, llm_type=LLMType.CREATIVE)
65
+ ```
66
+
67
+ ### Agent YAML with Tools, Skills, and MCP
68
+
69
+ ```yaml
70
+ # agents/researcher_agent.yaml
71
+ agent:
72
+ role: "Researcher"
73
+ goal: "Research topics thoroughly"
74
+ backstory: "Expert researcher with access to web and files"
75
+ tools: [file_read, directory_read]
76
+ skills: ["domain-skills"]
77
+ mcp_servers:
78
+ - transport: stdio
79
+ command: python
80
+ args: [servers/db_server.py]
81
+ env:
82
+ DB_HOST: localhost
83
+ ```
84
+
85
+ ### Crew Config with Memory, Checkpointing, Tracing
86
+
87
+ ```yaml
88
+ # job_config.yaml
89
+ crews:
90
+ research_crew:
91
+ memory: true
92
+ checkpoint:
93
+ enabled: true
94
+ provider: json
95
+ location: "./.Amsha/execution/checkpoints"
96
+ tracing: true # opt-in: sends prompts to CrewAI dashboard
97
+ steps:
98
+ - task_key: research_task
99
+ agent_key: researcher_agent
100
+ ```
101
+
102
+ ### Multi-Crew Pipeline
103
+
104
+ ```yaml
105
+ pipeline:
106
+ - "research_crew"
107
+ - "writing_crew"
108
+ ```
109
+
110
+ ```python
111
+ outputs = app.run_pipeline({"brief": "..."})
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Configuration Structure
117
+
118
+ - **`app_config.yaml`**: Global settings (directories, output paths).
119
+ - **`job_config.yaml`**: Crew definitions, steps, pipelines, knowledge sources.
120
+ - **`llm_config.yaml`**: LLM provider, model, API keys, creative/evaluation profiles.
121
+
122
+ ---
123
+
124
+ ## Testing
125
+
126
+ ```bash
127
+ python -m pytest tests/unit/
128
+ ```
129
+
130
+ With coverage:
131
+ ```bash
132
+ python -m pytest tests/unit/ --cov=amsha --cov-report=term-missing
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Documentation
138
+
139
+ - [Crew Forge](docs/feature/crew_forge/About.md) — orchestration, YAML schema, tools, MCP, flows
140
+ - [Crew Monitor](docs/feature/crew_monitor/About.md) — performance monitoring, event observability
141
+ - [LLM Factory](docs/feature/llm_factory/About.md) — LLM configuration and profiles
142
+
143
+ ## License
144
+
145
+ Copyright (c) 2025 Nikhil Vijayakumar. Licensed under the [MIT License](LICENSE).
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "Amsha"
7
+ version = "3.0.0"
8
+ description = "Amsha is a lightweight library designed to provide common configuration and helper utilities for CrewAI orchestration. It serves as a foundational component for building scalable and maintainable AI agent systems"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.12,<3.14"
12
+ dependencies = [
13
+ "PyYAML ==6.0.3",
14
+ "crewai == 1.15.18",
15
+ "crewai-tools == 1.15.18",
16
+ "dependency-injector == 4.48.2",
17
+ "pandas == 2.3.2",
18
+ "openpyxl == 3.1.5",
19
+ "pydantic == 2.11.9",
20
+ "docling == 2.53.0",
21
+ "psutil == 7.1.3",
22
+ "chardet == 5.2.0",
23
+ "nvidia-ml-py == 13.580.82",
24
+ "litellm>=1.99.0",
25
+ ]
26
+
27
+ [project.urls]
28
+ Repository = "https://github.com/NikhilVijayakumar/Amsha"
29
+
30
+ [project.optional-dependencies]
31
+ research = [
32
+ "scikit-learn >= 1.3.0",
33
+ "matplotlib >= 3.7.0",
34
+ "seaborn >= 0.12.0",
35
+ "jupyter >= 1.0.0"
36
+ ]
37
+
38
+ [tool.setuptools]
39
+ package-dir = { "" = "src/nikhil" }
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["src/nikhil"]
43
+
44
+ [dependency-groups]
45
+ dev = [
46
+ "hypothesis>=6.167.1",
47
+ "pytest>=9.1.1",
48
+ "pytest-cov>=7.1.0",
49
+ ]
amsha-3.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.4
2
+ Name: Amsha
3
+ Version: 3.0.0
4
+ Summary: Amsha is a lightweight library designed to provide common configuration and helper utilities for CrewAI orchestration. It serves as a foundational component for building scalable and maintainable AI agent systems
5
+ License-Expression: MIT
6
+ Project-URL: Repository, https://github.com/NikhilVijayakumar/Amsha
7
+ Requires-Python: <3.14,>=3.12
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: PyYAML==6.0.3
11
+ Requires-Dist: crewai==1.15.18
12
+ Requires-Dist: crewai-tools==1.15.18
13
+ Requires-Dist: dependency-injector==4.48.2
14
+ Requires-Dist: pandas==2.3.2
15
+ Requires-Dist: openpyxl==3.1.5
16
+ Requires-Dist: pydantic==2.11.9
17
+ Requires-Dist: docling==2.53.0
18
+ Requires-Dist: psutil==7.1.3
19
+ Requires-Dist: chardet==5.2.0
20
+ Requires-Dist: nvidia-ml-py==13.580.82
21
+ Requires-Dist: litellm>=1.99.0
22
+ Provides-Extra: research
23
+ Requires-Dist: scikit-learn>=1.3.0; extra == "research"
24
+ Requires-Dist: matplotlib>=3.7.0; extra == "research"
25
+ Requires-Dist: seaborn>=0.12.0; extra == "research"
26
+ Requires-Dist: jupyter>=1.0.0; extra == "research"
27
+ Dynamic: license-file
28
+
29
+ # Amsha
30
+
31
+ **Amsha** is a lightweight library for **CrewAI** orchestration. It provides configuration management, agent/task definition, knowledge integration, and monitoring utilities — letting you define crews in YAML and run them with minimal boilerplate.
32
+
33
+ ---
34
+
35
+ ## Key Features
36
+
37
+ ### Crew Forge & Orchestration
38
+ - **File-Based**: Define agents and tasks in version-controlled YAML files.
39
+ - **Flows**: Multi-crew pipelines via CrewAI `Flow` — ordered execution with shared state.
40
+ - **Memory & Checkpointing**: Opt-in per crew (`memory: true`, `checkpoint:` config) — off by default.
41
+ - **Tracing**: Opt-in CrewAI native tracing (`tracing: true`) — off by default, sends prompts to CrewAI's hosted dashboard.
42
+
43
+ ### Tools & MCP
44
+ - **Tool Registry**: Agents and tasks declare tools by name in YAML (`tools: [file_read, directory_read]`). Ships with built-in tools; extend with `register_tool()`.
45
+ - **MCP Servers**: Agents connect to MCP servers via structured YAML (`mcp_servers:`) — stdio, HTTP, or SSE transports.
46
+
47
+ ### Knowledge Management
48
+ - **Multi-Format**: Docling-powered sources for Markdown, PDF, DOCX, HTML, XLSX, PPTX, images.
49
+ - **JSON Native**: CrewAI's `JSONKnowledgeSource` for structured JSON files.
50
+ - **Auto-Routing**: `.json` paths route to JSON source; everything else to Docling.
51
+
52
+ ### Skills
53
+ - **Runtime Skills**: Agents reference CrewAI skills by name in YAML (`skills: ["domain-skills"]`). Amsha resolves names to skill search paths.
54
+
55
+ ### Monitoring & Observability
56
+ - **CrewPerformanceMonitor**: Real-time CPU/GPU/memory tracking during execution.
57
+ - **AmshaEventListener**: Event-bus subscriber for per-task, per-LLM-call, per-tool-call lifecycle logs — local, no cloud dependency.
58
+ - **Contribution Analysis & Reporting**: Feature attribution analysis and Excel report generation.
59
+
60
+ ### LLM Factory
61
+ - **Unified Config**: One YAML for all LLM providers (Ollama, LM Studio, OpenRouter, Gemini).
62
+ - **Purpose Profiles**: Creative (high temperature) vs. Evaluation (deterministic) modes.
63
+
64
+ ---
65
+
66
+ ## Installation
67
+
68
+ ```bash
69
+ pip install amsha
70
+ ```
71
+
72
+ Amsha currently declares Docling as a runtime dependency. Until the first PyPI release is published, use the existing source installation. See [release guidance](docs/releasing.md) for the publishing process.
73
+
74
+ ---
75
+
76
+ ## Migration to 3.0
77
+
78
+ **Migration:** Azure-qualified LLM models (`azure/` and `azure_ai/`) are no longer supported. Configure another provider before upgrading to the next major version.
79
+
80
+ ## Quick Start
81
+
82
+ ```python
83
+ from amsha.crew_forge.orchestrator.file.amsha_crew_file_application import AmshaCrewFileApplication
84
+ from amsha.llm_factory.domain.model.llm_type import LLMType
85
+
86
+ config_paths = {
87
+ "app": "config/app_config.yaml",
88
+ "job": "config/job_config.yaml",
89
+ "llm": "config/llm_config.yaml"
90
+ }
91
+
92
+ app = AmshaCrewFileApplication(config_paths=config_paths, llm_type=LLMType.CREATIVE)
93
+ ```
94
+
95
+ ### Agent YAML with Tools, Skills, and MCP
96
+
97
+ ```yaml
98
+ # agents/researcher_agent.yaml
99
+ agent:
100
+ role: "Researcher"
101
+ goal: "Research topics thoroughly"
102
+ backstory: "Expert researcher with access to web and files"
103
+ tools: [file_read, directory_read]
104
+ skills: ["domain-skills"]
105
+ mcp_servers:
106
+ - transport: stdio
107
+ command: python
108
+ args: [servers/db_server.py]
109
+ env:
110
+ DB_HOST: localhost
111
+ ```
112
+
113
+ ### Crew Config with Memory, Checkpointing, Tracing
114
+
115
+ ```yaml
116
+ # job_config.yaml
117
+ crews:
118
+ research_crew:
119
+ memory: true
120
+ checkpoint:
121
+ enabled: true
122
+ provider: json
123
+ location: "./.Amsha/execution/checkpoints"
124
+ tracing: true # opt-in: sends prompts to CrewAI dashboard
125
+ steps:
126
+ - task_key: research_task
127
+ agent_key: researcher_agent
128
+ ```
129
+
130
+ ### Multi-Crew Pipeline
131
+
132
+ ```yaml
133
+ pipeline:
134
+ - "research_crew"
135
+ - "writing_crew"
136
+ ```
137
+
138
+ ```python
139
+ outputs = app.run_pipeline({"brief": "..."})
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Configuration Structure
145
+
146
+ - **`app_config.yaml`**: Global settings (directories, output paths).
147
+ - **`job_config.yaml`**: Crew definitions, steps, pipelines, knowledge sources.
148
+ - **`llm_config.yaml`**: LLM provider, model, API keys, creative/evaluation profiles.
149
+
150
+ ---
151
+
152
+ ## Testing
153
+
154
+ ```bash
155
+ python -m pytest tests/unit/
156
+ ```
157
+
158
+ With coverage:
159
+ ```bash
160
+ python -m pytest tests/unit/ --cov=amsha --cov-report=term-missing
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Documentation
166
+
167
+ - [Crew Forge](docs/feature/crew_forge/About.md) — orchestration, YAML schema, tools, MCP, flows
168
+ - [Crew Monitor](docs/feature/crew_monitor/About.md) — performance monitoring, event observability
169
+ - [LLM Factory](docs/feature/llm_factory/About.md) — LLM configuration and profiles
170
+
171
+ ## License
172
+
173
+ Copyright (c) 2025 Nikhil Vijayakumar. Licensed under the [MIT License](LICENSE).
@@ -0,0 +1,117 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/nikhil/Amsha.egg-info/PKG-INFO
5
+ src/nikhil/Amsha.egg-info/SOURCES.txt
6
+ src/nikhil/Amsha.egg-info/dependency_links.txt
7
+ src/nikhil/Amsha.egg-info/requires.txt
8
+ src/nikhil/Amsha.egg-info/top_level.txt
9
+ src/nikhil/amsha/__init__.py
10
+ src/nikhil/amsha/common/__init__.py
11
+ src/nikhil/amsha/common/logger.py
12
+ src/nikhil/amsha/configuration/application/configuration_manager.py
13
+ src/nikhil/amsha/configuration/domain/models/amsha_app_config.py
14
+ src/nikhil/amsha/configuration/domain/models/amsha_job_config.py
15
+ src/nikhil/amsha/configuration/domain/models/amsha_llm_config.py
16
+ src/nikhil/amsha/configuration/exceptions/amsha_configuration_exception.py
17
+ src/nikhil/amsha/configuration/infrastructure/strict_validator.py
18
+ src/nikhil/amsha/crew_forge/__init__.py
19
+ src/nikhil/amsha/crew_forge/dependency/__init__.py
20
+ src/nikhil/amsha/crew_forge/domain/__init__.py
21
+ src/nikhil/amsha/crew_forge/domain/enum/__init__.py
22
+ src/nikhil/amsha/crew_forge/domain/models/__init__.py
23
+ src/nikhil/amsha/crew_forge/domain/models/agent_data.py
24
+ src/nikhil/amsha/crew_forge/domain/models/crew_data.py
25
+ src/nikhil/amsha/crew_forge/domain/models/mcp_data.py
26
+ src/nikhil/amsha/crew_forge/domain/models/task_data.py
27
+ src/nikhil/amsha/crew_forge/exceptions/__init__.py
28
+ src/nikhil/amsha/crew_forge/exceptions/crew_configuration_exception.py
29
+ src/nikhil/amsha/crew_forge/exceptions/crew_execution_exception.py
30
+ src/nikhil/amsha/crew_forge/exceptions/crew_forge_exception.py
31
+ src/nikhil/amsha/crew_forge/exceptions/crew_manager_exception.py
32
+ src/nikhil/amsha/crew_forge/exceptions/error_context.py
33
+ src/nikhil/amsha/crew_forge/exceptions/input_preparation_exception.py
34
+ src/nikhil/amsha/crew_forge/knowledge/__init__.py
35
+ src/nikhil/amsha/crew_forge/knowledge/amsha_crew_docling_source.py
36
+ src/nikhil/amsha/crew_forge/knowledge/amsha_json_knowledge_source.py
37
+ src/nikhil/amsha/crew_forge/orchestrator/__init__.py
38
+ src/nikhil/amsha/crew_forge/orchestrator/file/__init__.py
39
+ src/nikhil/amsha/crew_forge/orchestrator/file/amsha_crew_file_application.py
40
+ src/nikhil/amsha/crew_forge/orchestrator/file/atomic_crew_file_manager.py
41
+ src/nikhil/amsha/crew_forge/orchestrator/file/file_crew_orchestrator.py
42
+ src/nikhil/amsha/crew_forge/orchestrator/flow/__init__.py
43
+ src/nikhil/amsha/crew_forge/orchestrator/flow/flow_crew_pipeline.py
44
+ src/nikhil/amsha/crew_forge/protocols/__init__.py
45
+ src/nikhil/amsha/crew_forge/protocols/crew_application.py
46
+ src/nikhil/amsha/crew_forge/protocols/crew_manager.py
47
+ src/nikhil/amsha/crew_forge/protocols/crew_orchestrator.py
48
+ src/nikhil/amsha/crew_forge/protocols/input_preparation_service.py
49
+ src/nikhil/amsha/crew_forge/seeding/__init__.py
50
+ src/nikhil/amsha/crew_forge/seeding/parser/__init__.py
51
+ src/nikhil/amsha/crew_forge/seeding/parser/crew_parser.py
52
+ src/nikhil/amsha/crew_forge/service/__init__.py
53
+ src/nikhil/amsha/crew_forge/service/atomic_yaml_builder.py
54
+ src/nikhil/amsha/crew_forge/service/base_crew_orchestrator.py
55
+ src/nikhil/amsha/crew_forge/service/crew_builder_service.py
56
+ src/nikhil/amsha/crew_forge/service/shared_input_preparation_service.py
57
+ src/nikhil/amsha/crew_forge/service/shared_json_file_service.py
58
+ src/nikhil/amsha/crew_forge/service/shared_llm_initialization_service.py
59
+ src/nikhil/amsha/crew_forge/service/tool_registry.py
60
+ src/nikhil/amsha/crew_monitor/__init__.py
61
+ src/nikhil/amsha/crew_monitor/service/__init__.py
62
+ src/nikhil/amsha/crew_monitor/service/amsha_event_listener.py
63
+ src/nikhil/amsha/crew_monitor/service/contribution_analyzer.py
64
+ src/nikhil/amsha/crew_monitor/service/crew_performance_monitor.py
65
+ src/nikhil/amsha/crew_monitor/service/reporting_tool.py
66
+ src/nikhil/amsha/execution_runtime/__init__.py
67
+ src/nikhil/amsha/execution_runtime/domain/__init__.py
68
+ src/nikhil/amsha/execution_runtime/domain/execution_handle.py
69
+ src/nikhil/amsha/execution_runtime/domain/execution_mode.py
70
+ src/nikhil/amsha/execution_runtime/service/__init__.py
71
+ src/nikhil/amsha/execution_runtime/service/runtime_engine.py
72
+ src/nikhil/amsha/execution_state/__init__.py
73
+ src/nikhil/amsha/execution_state/domain/__init__.py
74
+ src/nikhil/amsha/execution_state/domain/enums.py
75
+ src/nikhil/amsha/execution_state/domain/execution_state.py
76
+ src/nikhil/amsha/execution_state/service/__init__.py
77
+ src/nikhil/amsha/execution_state/service/state_manager.py
78
+ src/nikhil/amsha/llm_factory/__init__.py
79
+ src/nikhil/amsha/llm_factory/exceptions.py
80
+ src/nikhil/amsha/llm_factory/adapters/__init__.py
81
+ src/nikhil/amsha/llm_factory/adapters/crewai_adapter.py
82
+ src/nikhil/amsha/llm_factory/adapters/lmstudio_lifecycle_client.py
83
+ src/nikhil/amsha/llm_factory/dependency/__init__.py
84
+ src/nikhil/amsha/llm_factory/dependency/llm_container.py
85
+ src/nikhil/amsha/llm_factory/domain/__init__.py
86
+ src/nikhil/amsha/llm_factory/domain/llm_type.py
87
+ src/nikhil/amsha/llm_factory/domain/provider_protocol.py
88
+ src/nikhil/amsha/llm_factory/domain/model/__init__.py
89
+ src/nikhil/amsha/llm_factory/domain/model/llm_build_result.py
90
+ src/nikhil/amsha/llm_factory/domain/model/llm_model_capabilities.py
91
+ src/nikhil/amsha/llm_factory/domain/model/llm_model_config.py
92
+ src/nikhil/amsha/llm_factory/domain/model/llm_output_config.py
93
+ src/nikhil/amsha/llm_factory/domain/model/llm_parameters.py
94
+ src/nikhil/amsha/llm_factory/domain/model/llm_type.py
95
+ src/nikhil/amsha/llm_factory/domain/model/llm_use_case_config.py
96
+ src/nikhil/amsha/llm_factory/domain/model/lmstudio_lifecycle_config.py
97
+ src/nikhil/amsha/llm_factory/service/__init__.py
98
+ src/nikhil/amsha/llm_factory/service/llm_builder.py
99
+ src/nikhil/amsha/llm_factory/settings/__init__.py
100
+ src/nikhil/amsha/llm_factory/settings/llm_settings.py
101
+ src/nikhil/amsha/llm_factory/utils/__init__.py
102
+ src/nikhil/amsha/llm_factory/utils/deprecated_compat.py
103
+ src/nikhil/amsha/llm_factory/utils/llm_utils.py
104
+ src/nikhil/amsha/output_process/__init__.py
105
+ src/nikhil/amsha/output_process/evaluation/__init__.py
106
+ src/nikhil/amsha/output_process/evaluation/evaluation_aggregate_tool.py
107
+ src/nikhil/amsha/output_process/evaluation/evaluation_processing_tool.py
108
+ src/nikhil/amsha/output_process/evaluation/evaluation_report_tool.py
109
+ src/nikhil/amsha/output_process/optimization/__init__.py
110
+ src/nikhil/amsha/output_process/optimization/json_cleaner_utils.py
111
+ src/nikhil/amsha/output_process/validation/__init__.py
112
+ src/nikhil/amsha/output_process/validation/crew_validator.py
113
+ src/nikhil/amsha/output_process/validation/json_output_validator.py
114
+ src/nikhil/amsha/utils/__init__.py
115
+ src/nikhil/amsha/utils/json_utils.py
116
+ src/nikhil/amsha/utils/utf8_utils.py
117
+ src/nikhil/amsha/utils/yaml_utils.py