enablement-agent 1.6.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 (39) hide show
  1. enablement_agent/PKG-INFO +184 -0
  2. enablement_agent/README.md +155 -0
  3. enablement_agent/__init__.py +182 -0
  4. enablement_agent/agent_registry.py +333 -0
  5. enablement_agent/cli.py +185 -0
  6. enablement_agent/config.py +407 -0
  7. enablement_agent/content_lifecycle.py +463 -0
  8. enablement_agent/content_registry.py +385 -0
  9. enablement_agent/delivery_bridge.py +440 -0
  10. enablement_agent/freshness_monitor.py +424 -0
  11. enablement_agent/generate_install_doc.py +182 -0
  12. enablement_agent/highspot_scraper.py +552 -0
  13. enablement_agent/ingestion.py +944 -0
  14. enablement_agent/mcp_tools.py +919 -0
  15. enablement_agent/orchestrator.py +590 -0
  16. enablement_agent/permissions_cache.py +118 -0
  17. enablement_agent/project-delivery-mcp/check_docs.py +44 -0
  18. enablement_agent/project-delivery-mcp/deploy/README.md +136 -0
  19. enablement_agent/project-delivery-mcp/gen_final_docs.py +272 -0
  20. enablement_agent/project-delivery-mcp/gen_install_guide.py +138 -0
  21. enablement_agent/project-delivery-mcp/generate_docs.py +417 -0
  22. enablement_agent/project-delivery-mcp/generate_sample.py +107 -0
  23. enablement_agent/project-delivery-mcp/generate_uat_samples.py +235 -0
  24. enablement_agent/project-delivery-mcp/server.py +4865 -0
  25. enablement_agent/project-delivery-mcp/setup.py +34 -0
  26. enablement_agent/project-delivery-mcp/src/project_delivery_agent/__init__.py +11 -0
  27. enablement_agent/project-delivery-mcp/src/project_delivery_agent/__main__.py +3 -0
  28. enablement_agent/project-delivery-mcp/src/project_delivery_agent/server.py +4865 -0
  29. enablement_agent/query_handler.py +459 -0
  30. enablement_agent/rls_guard.py +696 -0
  31. enablement_agent/search.py +663 -0
  32. enablement_agent/slack_bot.py +367 -0
  33. enablement_agent/vector_store.py +425 -0
  34. enablement_agent/web_api.py +206 -0
  35. enablement_agent/wiki_scraper.py +417 -0
  36. enablement_agent-1.6.0.dist-info/METADATA +184 -0
  37. enablement_agent-1.6.0.dist-info/RECORD +39 -0
  38. enablement_agent-1.6.0.dist-info/WHEEL +4 -0
  39. enablement_agent-1.6.0.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,184 @@
1
+ Metadata-Version: 2.4
2
+ Name: enablement-agent
3
+ Version: 1.6.0
4
+ Summary: Centralized Enablement Agent — the canonical knowledge hub for Partner Core enablement content.
5
+ Project-URL: Homepage, https://w.amazon.com/bin/view/AWS/Teams/PartnerCore/EnablementAgent/
6
+ Project-URL: Repository, https://code.amazon.com/packages/EnablementAgent
7
+ Author: Partner Core - Enablement Shared Services
8
+ License-Expression: MIT
9
+ Keywords: enablement,knowledge-hub,mcp,partner-core
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Python: >=3.11
14
+ Requires-Dist: aiohttp>=3.9.0
15
+ Requires-Dist: boto3>=1.34.0
16
+ Requires-Dist: fastmcp>=2.0.0
17
+ Requires-Dist: mcp>=1.0.0
18
+ Requires-Dist: opensearch-py>=2.4.0
19
+ Requires-Dist: pdfplumber>=0.10.0
20
+ Requires-Dist: python-docx>=1.0.0
21
+ Requires-Dist: requests-aws4auth>=1.2.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: moto[athena,s3]>=5.0.0; extra == 'dev'
24
+ Requires-Dist: mypy>=1.9.0; extra == 'dev'
25
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
26
+ Requires-Dist: pytest>=7.0; extra == 'dev'
27
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # Centralized Enablement Agent
31
+
32
+ The canonical knowledge hub for all enablement content across Partner Core.
33
+
34
+ ## What it does
35
+
36
+ This agent ingests, indexes, and serves enablement content — user guides, FAQs, demo scripts, training decks, playbooks, and more. Anyone in Partner Core can query it for answers, search for content, and monitor content freshness.
37
+
38
+ ## Architecture
39
+
40
+ ```
41
+ ┌─────────────────────────────────────────────────────────────────┐
42
+ │ Content IN │
43
+ │ ┌──────────────┐ ┌──────────────┐ ┌────────────┐ ┌──────────┐ │
44
+ │ │ Delivery │ │ Manual │ │ Wiki │ │ Highspot │ │
45
+ │ │ Agent Push │ │ Upload │ │ Scraper │ │ Scraper │ │
46
+ │ └──────┬───────┘ └──────┬───────┘ └─────┬──────┘ └────┬─────┘ │
47
+ │ │ │ │ │ │
48
+ │ └────────────────┴───────────────┴──────────────┘ │
49
+ │ │ │
50
+ │ ┌───────▼───────┐ │
51
+ │ │ Orchestrator │ │
52
+ │ └───────┬───────┘ │
53
+ │ │ │
54
+ │ ┌────────────────────────┼────────────────────┐ │
55
+ │ │ │ │ │
56
+ │ ┌──────▼──────┐ ┌─────────────▼────────┐ ┌───────▼───────┐ │
57
+ │ │ S3 Bucket │ │ OpenSearch Serverless │ │ Content │ │
58
+ │ │ (raw files) │ │ (vector embeddings) │ │ Registry │ │
59
+ │ └─────────────┘ └──────────────────────┘ └───────────────┘ │
60
+ │ │
61
+ │ Content OUT (MCP Tools via SSE) │
62
+ │ ┌──────────────────────────────────────────────────────────┐ │
63
+ │ │ query · search · upload · status · stale · refresh │ │
64
+ │ │ check_permissions · request_access │ │
65
+ │ └──────────────────────────────────────────────────────────┘ │
66
+ └─────────────────────────────────────────────────────────────────┘
67
+ ```
68
+
69
+ ## Quick Start (for users)
70
+
71
+ Install and configure in one step:
72
+
73
+ ```bash
74
+ pip install enablement-agent
75
+ enablement-agent configure
76
+ ```
77
+
78
+ Or if you use `uvx` (recommended):
79
+
80
+ ```bash
81
+ uvx enablement-agent configure
82
+ ```
83
+
84
+ This writes your `~/.kiro/settings/mcp.json` with:
85
+
86
+ ```json
87
+ {
88
+ "mcpServers": {
89
+ "enablement-agent": {
90
+ "command": "uvx",
91
+ "args": ["enablement-agent", "serve"],
92
+ "env": {
93
+ "AWS_REGION": "us-east-1"
94
+ },
95
+ "disabled": false,
96
+ "autoApprove": ["ask", "status"]
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ Or add it manually — that's the whole config.
103
+
104
+ **Prerequisites:** AWS credentials configured (`midway` or `~/.aws/config`) with access to the shared S3 bucket, OpenSearch, and Bedrock.
105
+
106
+ ## Deployment
107
+
108
+ Two modes:
109
+
110
+ ### Local (stdio) — current default
111
+ Users install from PyPI and run locally. Shared backend (S3, OpenSearch, Bedrock) is accessed directly via AWS credentials.
112
+
113
+ ### Centralized (SSE) — future
114
+ Once a domain + HTTPS cert is provisioned, the server can run on ECS Fargate with SSE transport. Users would just add a URL to their mcp.json.
115
+
116
+ ### Backend Infrastructure (shared, required for both modes)
117
+
118
+ Deploy with CDK:
119
+
120
+ ```bash
121
+ cd infra/
122
+ pip install aws-cdk-lib constructs
123
+ cdk deploy
124
+ ```
125
+
126
+ ### Environment Variables
127
+
128
+ | Variable | Description |
129
+ |----------|-------------|
130
+ | `OPENSEARCH_ENDPOINT` | OpenSearch Serverless collection endpoint |
131
+ | `S3_BUCKET` | S3 bucket name for content storage |
132
+ | `AWS_REGION` | AWS region (default: us-east-1) |
133
+ | `HIGHSPOT_API_KEY` | Highspot API key (or loaded from Secrets Manager) |
134
+ | `LOG_LEVEL` | Logging level (default: INFO) |
135
+
136
+ ## Development
137
+
138
+ ```bash
139
+ # Install with dev dependencies
140
+ pip install -e ".[dev]"
141
+
142
+ # Run tests
143
+ pytest
144
+
145
+ # Lint
146
+ ruff check .
147
+
148
+ # Type check
149
+ mypy enablement_agent/
150
+ ```
151
+
152
+ ## Modules
153
+
154
+ | Module | Purpose |
155
+ |--------|---------|
156
+ | `orchestrator.py` | Central coordinator, request routing, background jobs |
157
+ | `mcp_tools.py` | FastMCP tool registration (9 tools) |
158
+ | `search.py` | Hybrid BM25 + vector + metadata search engine |
159
+ | `vector_store.py` | OpenSearch Serverless knn integration |
160
+ | `query_handler.py` | NL question answering with LLM synthesis |
161
+ | `ingestion.py` | 4 ingestion pipelines |
162
+ | `content_registry.py` | Metadata store with CRUD and bulk queries |
163
+ | `freshness_monitor.py` | Staleness detection and auto-refresh |
164
+ | `rls_guard.py` | Unified RLS enforcement via Galaxi |
165
+ | `permissions_cache.py` | TTL cache for RLS permission lookups |
166
+ | `wiki_scraper.py` | Wiki page discovery and change detection |
167
+ | `highspot_scraper.py` | Highspot spot monitoring |
168
+ | `config.py` | All configuration constants and enums |
169
+ | `cli.py` | CLI entry point (serve, configure, health) |
170
+
171
+ ## RLS (Row-Level Security)
172
+
173
+ Content containing customer data is automatically classified:
174
+
175
+ - **NONE** — General enablement, open to all ASP/SMGS
176
+ - **TERRITORY** — Contains territory-level customer data
177
+ - **PARTNER** — Contains partner-specific data (SPMS IDs)
178
+ - **BROAD** — Requires Geo+ level access (L8 approval)
179
+
180
+ Blocked content is always *visible* (title + lock icon) but redacted. Users get links to request access.
181
+
182
+ ## Freshness
183
+
184
+ Content is flagged stale after 4 months (120 days) without update. Wiki and Highspot sources auto-refresh when the source changes. Notifications go to the `enablement-freshness-alerts` channel.
@@ -0,0 +1,155 @@
1
+ # Centralized Enablement Agent
2
+
3
+ The canonical knowledge hub for all enablement content across Partner Core.
4
+
5
+ ## What it does
6
+
7
+ This agent ingests, indexes, and serves enablement content — user guides, FAQs, demo scripts, training decks, playbooks, and more. Anyone in Partner Core can query it for answers, search for content, and monitor content freshness.
8
+
9
+ ## Architecture
10
+
11
+ ```
12
+ ┌─────────────────────────────────────────────────────────────────┐
13
+ │ Content IN │
14
+ │ ┌──────────────┐ ┌──────────────┐ ┌────────────┐ ┌──────────┐ │
15
+ │ │ Delivery │ │ Manual │ │ Wiki │ │ Highspot │ │
16
+ │ │ Agent Push │ │ Upload │ │ Scraper │ │ Scraper │ │
17
+ │ └──────┬───────┘ └──────┬───────┘ └─────┬──────┘ └────┬─────┘ │
18
+ │ │ │ │ │ │
19
+ │ └────────────────┴───────────────┴──────────────┘ │
20
+ │ │ │
21
+ │ ┌───────▼───────┐ │
22
+ │ │ Orchestrator │ │
23
+ │ └───────┬───────┘ │
24
+ │ │ │
25
+ │ ┌────────────────────────┼────────────────────┐ │
26
+ │ │ │ │ │
27
+ │ ┌──────▼──────┐ ┌─────────────▼────────┐ ┌───────▼───────┐ │
28
+ │ │ S3 Bucket │ │ OpenSearch Serverless │ │ Content │ │
29
+ │ │ (raw files) │ │ (vector embeddings) │ │ Registry │ │
30
+ │ └─────────────┘ └──────────────────────┘ └───────────────┘ │
31
+ │ │
32
+ │ Content OUT (MCP Tools via SSE) │
33
+ │ ┌──────────────────────────────────────────────────────────┐ │
34
+ │ │ query · search · upload · status · stale · refresh │ │
35
+ │ │ check_permissions · request_access │ │
36
+ │ └──────────────────────────────────────────────────────────┘ │
37
+ └─────────────────────────────────────────────────────────────────┘
38
+ ```
39
+
40
+ ## Quick Start (for users)
41
+
42
+ Install and configure in one step:
43
+
44
+ ```bash
45
+ pip install enablement-agent
46
+ enablement-agent configure
47
+ ```
48
+
49
+ Or if you use `uvx` (recommended):
50
+
51
+ ```bash
52
+ uvx enablement-agent configure
53
+ ```
54
+
55
+ This writes your `~/.kiro/settings/mcp.json` with:
56
+
57
+ ```json
58
+ {
59
+ "mcpServers": {
60
+ "enablement-agent": {
61
+ "command": "uvx",
62
+ "args": ["enablement-agent", "serve"],
63
+ "env": {
64
+ "AWS_REGION": "us-east-1"
65
+ },
66
+ "disabled": false,
67
+ "autoApprove": ["ask", "status"]
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ Or add it manually — that's the whole config.
74
+
75
+ **Prerequisites:** AWS credentials configured (`midway` or `~/.aws/config`) with access to the shared S3 bucket, OpenSearch, and Bedrock.
76
+
77
+ ## Deployment
78
+
79
+ Two modes:
80
+
81
+ ### Local (stdio) — current default
82
+ Users install from PyPI and run locally. Shared backend (S3, OpenSearch, Bedrock) is accessed directly via AWS credentials.
83
+
84
+ ### Centralized (SSE) — future
85
+ Once a domain + HTTPS cert is provisioned, the server can run on ECS Fargate with SSE transport. Users would just add a URL to their mcp.json.
86
+
87
+ ### Backend Infrastructure (shared, required for both modes)
88
+
89
+ Deploy with CDK:
90
+
91
+ ```bash
92
+ cd infra/
93
+ pip install aws-cdk-lib constructs
94
+ cdk deploy
95
+ ```
96
+
97
+ ### Environment Variables
98
+
99
+ | Variable | Description |
100
+ |----------|-------------|
101
+ | `OPENSEARCH_ENDPOINT` | OpenSearch Serverless collection endpoint |
102
+ | `S3_BUCKET` | S3 bucket name for content storage |
103
+ | `AWS_REGION` | AWS region (default: us-east-1) |
104
+ | `HIGHSPOT_API_KEY` | Highspot API key (or loaded from Secrets Manager) |
105
+ | `LOG_LEVEL` | Logging level (default: INFO) |
106
+
107
+ ## Development
108
+
109
+ ```bash
110
+ # Install with dev dependencies
111
+ pip install -e ".[dev]"
112
+
113
+ # Run tests
114
+ pytest
115
+
116
+ # Lint
117
+ ruff check .
118
+
119
+ # Type check
120
+ mypy enablement_agent/
121
+ ```
122
+
123
+ ## Modules
124
+
125
+ | Module | Purpose |
126
+ |--------|---------|
127
+ | `orchestrator.py` | Central coordinator, request routing, background jobs |
128
+ | `mcp_tools.py` | FastMCP tool registration (9 tools) |
129
+ | `search.py` | Hybrid BM25 + vector + metadata search engine |
130
+ | `vector_store.py` | OpenSearch Serverless knn integration |
131
+ | `query_handler.py` | NL question answering with LLM synthesis |
132
+ | `ingestion.py` | 4 ingestion pipelines |
133
+ | `content_registry.py` | Metadata store with CRUD and bulk queries |
134
+ | `freshness_monitor.py` | Staleness detection and auto-refresh |
135
+ | `rls_guard.py` | Unified RLS enforcement via Galaxi |
136
+ | `permissions_cache.py` | TTL cache for RLS permission lookups |
137
+ | `wiki_scraper.py` | Wiki page discovery and change detection |
138
+ | `highspot_scraper.py` | Highspot spot monitoring |
139
+ | `config.py` | All configuration constants and enums |
140
+ | `cli.py` | CLI entry point (serve, configure, health) |
141
+
142
+ ## RLS (Row-Level Security)
143
+
144
+ Content containing customer data is automatically classified:
145
+
146
+ - **NONE** — General enablement, open to all ASP/SMGS
147
+ - **TERRITORY** — Contains territory-level customer data
148
+ - **PARTNER** — Contains partner-specific data (SPMS IDs)
149
+ - **BROAD** — Requires Geo+ level access (L8 approval)
150
+
151
+ Blocked content is always *visible* (title + lock icon) but redacted. Users get links to request access.
152
+
153
+ ## Freshness
154
+
155
+ Content is flagged stale after 4 months (120 days) without update. Wiki and Highspot sources auto-refresh when the source changes. Notifications go to the `enablement-freshness-alerts` channel.
@@ -0,0 +1,182 @@
1
+ """
2
+ enablement_agent
3
+ ================
4
+
5
+ Centralized Enablement Agent — the canonical knowledge hub for all
6
+ enablement content across Partner Core.
7
+
8
+ This agent is a sister to the Project Delivery Agent and CM Engine.
9
+ It serves as the single place anyone in Partner Core goes to learn
10
+ about anything that's been launched or is being launched.
11
+
12
+ Architecture:
13
+ Content IN: 4 ingestion pipelines (Delivery Agent push, manual upload,
14
+ wiki scraper, Highspot scraper)
15
+ Storage: S3 + vector embeddings index with unified metadata
16
+ Content OUT: MCP tools for query, search, upload, and management
17
+
18
+ Key Modules:
19
+ orchestrator - Main entry point and request router
20
+ ingestion - 4 ingestion pipelines (delivery, manual, wiki, highspot)
21
+ wiki_scraper - Wiki discovery and change-detection scraping
22
+ highspot_scraper - Highspot spot monitoring and content pulling
23
+ search - Hybrid BM25 + vector + metadata search engine
24
+ query_handler - NL question answering with LLM synthesis
25
+ content_registry - Metadata store with CRUD and bulk queries
26
+ freshness_monitor - Staleness detection and auto-refresh
27
+ mcp_tools - FastMCP tool registration for external access
28
+ config - All configuration constants and enums
29
+
30
+ Usage:
31
+ # As MCP server
32
+ from enablement_agent.mcp_tools import serve
33
+ serve(port=8400)
34
+
35
+ # Programmatic access
36
+ from enablement_agent import get_orchestrator
37
+ orchestrator = get_orchestrator()
38
+ await orchestrator.initialize()
39
+ answer = await orchestrator.handle_query("How does PBP work?")
40
+
41
+ # Delivery Agent integration
42
+ from enablement_agent import ingest_from_delivery_agent
43
+ result = await orchestrator.handle_delivery_agent_push(asset)
44
+ """
45
+
46
+ __version__ = "1.0.0"
47
+ __author__ = "Partner Core — Enablement Shared Services"
48
+
49
+ # ---------------------------------------------------------------------------
50
+ # Public API Exports
51
+ # ---------------------------------------------------------------------------
52
+
53
+ from .config import (
54
+ AGENT,
55
+ Audience,
56
+ ContentSource,
57
+ ContentType,
58
+ EMBEDDING,
59
+ FRESHNESS,
60
+ FreshnessStatus,
61
+ HIGHSPOT_SPOTS,
62
+ Phase,
63
+ S3,
64
+ SCHEDULE,
65
+ SEARCH,
66
+ )
67
+ from .content_registry import ContentItem, ContentRegistry, compute_content_hash
68
+ from .freshness_monitor import FreshnessMonitor, FreshnessReport
69
+ from .highspot_scraper import (
70
+ HighspotClient,
71
+ HighspotItem,
72
+ extract_highspot_metadata,
73
+ fetch_highspot_item,
74
+ fetch_spot_items_since,
75
+ run_scheduled_sync as run_highspot_sync,
76
+ )
77
+ from .ingestion import (
78
+ IngestionResult,
79
+ TextChunk,
80
+ chunk_text,
81
+ extract_text,
82
+ ingest_from_delivery_agent,
83
+ ingest_from_highspot,
84
+ ingest_from_wiki,
85
+ ingest_manual_upload,
86
+ )
87
+ from .mcp_tools import create_mcp_server, serve
88
+ from .orchestrator import Orchestrator, get_orchestrator
89
+ from .permissions_cache import PermissionsCache, get_partner_cache, get_user_cache
90
+ from .query_handler import Citation, EnablementAnswer, QueryHandler
91
+ from .search import (
92
+ BM25Index,
93
+ SearchEngine,
94
+ SearchFilters,
95
+ SearchResponse,
96
+ SearchResult,
97
+ VectorIndex,
98
+ )
99
+ from .vector_store import EmbeddingService, OpenSearchConfig, VectorStore
100
+ from .wiki_scraper import (
101
+ WikiPage,
102
+ crawl_wiki_tree,
103
+ discover_wikis_for_project,
104
+ fetch_wiki_page,
105
+ infer_project_from_url,
106
+ register_project_wiki,
107
+ run_scheduled_scrape as run_wiki_scrape,
108
+ )
109
+
110
+ __all__ = [
111
+ # Version
112
+ "__version__",
113
+ # Config & Enums
114
+ "AGENT",
115
+ "Audience",
116
+ "ContentSource",
117
+ "ContentType",
118
+ "EMBEDDING",
119
+ "FRESHNESS",
120
+ "FreshnessStatus",
121
+ "HIGHSPOT_SPOTS",
122
+ "Phase",
123
+ "S3",
124
+ "SCHEDULE",
125
+ "SEARCH",
126
+ # Orchestrator
127
+ "Orchestrator",
128
+ "get_orchestrator",
129
+ # Content Registry
130
+ "ContentItem",
131
+ "ContentRegistry",
132
+ "compute_content_hash",
133
+ # Ingestion
134
+ "IngestionResult",
135
+ "TextChunk",
136
+ "chunk_text",
137
+ "extract_text",
138
+ "ingest_from_delivery_agent",
139
+ "ingest_from_highspot",
140
+ "ingest_from_wiki",
141
+ "ingest_manual_upload",
142
+ # Wiki Scraper
143
+ "WikiPage",
144
+ "crawl_wiki_tree",
145
+ "discover_wikis_for_project",
146
+ "fetch_wiki_page",
147
+ "infer_project_from_url",
148
+ "register_project_wiki",
149
+ "run_wiki_scrape",
150
+ # Highspot Scraper
151
+ "HighspotClient",
152
+ "HighspotItem",
153
+ "extract_highspot_metadata",
154
+ "fetch_highspot_item",
155
+ "fetch_spot_items_since",
156
+ "run_highspot_sync",
157
+ # Search
158
+ "BM25Index",
159
+ "SearchEngine",
160
+ "SearchFilters",
161
+ "SearchResponse",
162
+ "SearchResult",
163
+ "VectorIndex",
164
+ # Query Handler
165
+ "Citation",
166
+ "EnablementAnswer",
167
+ "QueryHandler",
168
+ # Freshness
169
+ "FreshnessMonitor",
170
+ "FreshnessReport",
171
+ # MCP
172
+ "create_mcp_server",
173
+ "serve",
174
+ # Vector Store
175
+ "EmbeddingService",
176
+ "OpenSearchConfig",
177
+ "VectorStore",
178
+ # Permissions Cache
179
+ "PermissionsCache",
180
+ "get_user_cache",
181
+ "get_partner_cache",
182
+ ]