agentra 0.1.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.
- agentra-0.1.0/LICENSE +21 -0
- agentra-0.1.0/PKG-INFO +267 -0
- agentra-0.1.0/README.md +217 -0
- agentra-0.1.0/agentra/__init__.py +3 -0
- agentra-0.1.0/agentra/adapters/__init__.py +0 -0
- agentra-0.1.0/agentra/adapters/agents.py +231 -0
- agentra-0.1.0/agentra/benchmarks/__init__.py +0 -0
- agentra-0.1.0/agentra/benchmarks/runner.py +243 -0
- agentra-0.1.0/agentra/cli/__init__.py +0 -0
- agentra-0.1.0/agentra/cli/main.py +418 -0
- agentra-0.1.0/agentra/compliance/__init__.py +0 -0
- agentra-0.1.0/agentra/compliance/engine.py +82 -0
- agentra-0.1.0/agentra/detection/__init__.py +0 -0
- agentra-0.1.0/agentra/detection/engine.py +189 -0
- agentra-0.1.0/agentra/execution/__init__.py +0 -0
- agentra-0.1.0/agentra/execution/engine.py +187 -0
- agentra-0.1.0/agentra/governance/__init__.py +0 -0
- agentra-0.1.0/agentra/governance/engine.py +130 -0
- agentra-0.1.0/agentra/governance/policies.py +326 -0
- agentra-0.1.0/agentra/models.py +237 -0
- agentra-0.1.0/agentra/onboarding/__init__.py +0 -0
- agentra-0.1.0/agentra/onboarding/engine.py +134 -0
- agentra-0.1.0/agentra/optimizer/__init__.py +0 -0
- agentra-0.1.0/agentra/optimizer/engine.py +136 -0
- agentra-0.1.0/agentra/renderers/__init__.py +0 -0
- agentra-0.1.0/agentra/renderers/html.py +209 -0
- agentra-0.1.0/agentra/renderers/markdown.py +125 -0
- agentra-0.1.0/agentra/risk/__init__.py +0 -0
- agentra-0.1.0/agentra/risk/engine.py +47 -0
- agentra-0.1.0/agentra/skills/__init__.py +0 -0
- agentra-0.1.0/agentra/skills/registry.py +351 -0
- agentra-0.1.0/agentra/telemetry/__init__.py +0 -0
- agentra-0.1.0/agentra/telemetry/audit.py +41 -0
- agentra-0.1.0/agentra.egg-info/PKG-INFO +267 -0
- agentra-0.1.0/agentra.egg-info/SOURCES.txt +47 -0
- agentra-0.1.0/agentra.egg-info/dependency_links.txt +1 -0
- agentra-0.1.0/agentra.egg-info/entry_points.txt +2 -0
- agentra-0.1.0/agentra.egg-info/requires.txt +12 -0
- agentra-0.1.0/agentra.egg-info/top_level.txt +1 -0
- agentra-0.1.0/pyproject.toml +64 -0
- agentra-0.1.0/setup.cfg +4 -0
- agentra-0.1.0/tests/test_adapters.py +74 -0
- agentra-0.1.0/tests/test_benchmarks.py +95 -0
- agentra-0.1.0/tests/test_detection.py +112 -0
- agentra-0.1.0/tests/test_execution.py +76 -0
- agentra-0.1.0/tests/test_governance.py +112 -0
- agentra-0.1.0/tests/test_onboarding.py +39 -0
- agentra-0.1.0/tests/test_optimizer.py +80 -0
- agentra-0.1.0/tests/test_skills.py +55 -0
agentra-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arijeet Ganguli
|
|
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.
|
agentra-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentra
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Enterprise AI Engineering Control Plane — secure, token-optimized, context-aware governance for coding agents.
|
|
5
|
+
Author-email: Arijeet Ganguli <arijeetganguli@yahoo.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Arijeet Ganguli
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Keywords: ai,agents,governance,devsecops,security,llm
|
|
29
|
+
Classifier: Development Status :: 4 - Beta
|
|
30
|
+
Classifier: Intended Audience :: Developers
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
34
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
35
|
+
Requires-Python: >=3.11
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
License-File: LICENSE
|
|
38
|
+
Requires-Dist: typer<1,>=0.12
|
|
39
|
+
Requires-Dist: rich<14,>=13
|
|
40
|
+
Requires-Dist: pydantic<3,>=2
|
|
41
|
+
Requires-Dist: ruamel.yaml<1,>=0.18
|
|
42
|
+
Requires-Dist: Jinja2<4,>=3.1
|
|
43
|
+
Requires-Dist: markdown-it-py<4,>=3
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: pytest<9,>=8; extra == "dev"
|
|
46
|
+
Requires-Dist: pytest-cov<6,>=5; extra == "dev"
|
|
47
|
+
Requires-Dist: ruff<1,>=0.4; extra == "dev"
|
|
48
|
+
Requires-Dist: mypy<2,>=1.10; extra == "dev"
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
<div align="center">
|
|
52
|
+
|
|
53
|
+
# Agentra
|
|
54
|
+
|
|
55
|
+
**Enterprise AI Engineering Control Plane**
|
|
56
|
+
|
|
57
|
+
Secure, govern, and optimize AI coding agents — automatically.
|
|
58
|
+
|
|
59
|
+
[](https://python.org)
|
|
60
|
+
[](tests/)
|
|
61
|
+
[](LICENSE)
|
|
62
|
+
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
Agentra is a DevSecOps control plane for AI coding assistants. It auto-detects your project stack, enforces 21 security policies across 7 categories, manages context token budgets, and generates tailored instruction files for every major agent platform.
|
|
68
|
+
|
|
69
|
+
<table>
|
|
70
|
+
<tr><td><strong>40+</strong> Technologies Detected</td><td><strong>21</strong> Security Policies</td><td><strong>14</strong> Built-in Skills</td></tr>
|
|
71
|
+
<tr><td><strong>7</strong> Agent Platforms</td><td><strong>5</strong> Compliance Frameworks</td><td><strong>11</strong> CLI Commands</td></tr>
|
|
72
|
+
</table>
|
|
73
|
+
|
|
74
|
+
## Quick Start
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Install
|
|
78
|
+
pip install agentra
|
|
79
|
+
|
|
80
|
+
# Initialize — auto-detect stack, generate agent instruction files
|
|
81
|
+
ag init --mode quick
|
|
82
|
+
|
|
83
|
+
# Run security governance checks
|
|
84
|
+
ag enforce
|
|
85
|
+
|
|
86
|
+
# Check a command before running it
|
|
87
|
+
ag simulate "rm -rf /tmp/build"
|
|
88
|
+
|
|
89
|
+
# Run benchmarks and generate reports
|
|
90
|
+
ag benchmark
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Features
|
|
94
|
+
|
|
95
|
+
| Feature | Description |
|
|
96
|
+
|---------|-------------|
|
|
97
|
+
| 🔍 **Stack Detection** | Auto-detect languages, frameworks, databases, cloud providers, CI/CD, and agents with confidence scores |
|
|
98
|
+
| 🛡 **Security Governance** | 21 policies across database, execution, secret, git, infrastructure, prompt injection, and runtime categories |
|
|
99
|
+
| 🧩 **Skills System** | 14 domain skills (FastAPI, Terraform, K8s, Spark, Airflow, PostgreSQL, Snowflake, dbt, Kafka, OpenAI, LangChain, MCP, Databricks, Karpathy) |
|
|
100
|
+
| 📦 **Token Optimization** | Deduplicate, prioritize, compress, and budget-fit instructions — 30-60% token savings |
|
|
101
|
+
| 🔌 **Agent Adapters** | Native instruction files for Claude, Cursor, Copilot, Aider, Windsurf, Continue.dev, and universal AGENTS.md |
|
|
102
|
+
| ⚙ **Execution Safety** | Risk-classify commands, block destructive patterns, sandbox with approval gates, dry-run mode |
|
|
103
|
+
| ✓ **Compliance** | Map violations to SOC2, ISO27001, PCI DSS, HIPAA, NIST frameworks |
|
|
104
|
+
| 📊 **Benchmarking** | Before/after metrics for every skill with HTML + Markdown report generation |
|
|
105
|
+
|
|
106
|
+
## CLI Commands
|
|
107
|
+
|
|
108
|
+
| Command | Description |
|
|
109
|
+
|---------|-------------|
|
|
110
|
+
| `ag init` | Initialize project — detect stack, save config, generate agent files |
|
|
111
|
+
| `ag detect` | Scan and display detected technologies with confidence scores |
|
|
112
|
+
| `ag enforce` | Run security policies against codebase, report violations with risk scoring |
|
|
113
|
+
| `ag optimize` | Show token optimization analysis: deduplication, compression, budget fitting |
|
|
114
|
+
| `ag simulate <cmd>` | Dry-run a command through the execution safety engine |
|
|
115
|
+
| `ag explain <rule>` | Display full details of a security policy (e.g., `ag explain SEC-001`) |
|
|
116
|
+
| `ag validate` | Full pipeline: governance + compliance + optimization in one command |
|
|
117
|
+
| `ag benchmark` | Run skill benchmarks, generate Markdown + HTML reports |
|
|
118
|
+
| `ag audit` | View local audit log of all Agentra actions |
|
|
119
|
+
| `ag doctor` | Health check: verify config, agent files, .gitignore |
|
|
120
|
+
| `ag version` | Display version |
|
|
121
|
+
|
|
122
|
+
### Usage Examples
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Enterprise mode with SOC2 + ISO27001 compliance
|
|
126
|
+
ag init --mode enterprise --agents claude,copilot
|
|
127
|
+
|
|
128
|
+
# Explain a specific policy rule
|
|
129
|
+
ag explain DB-001
|
|
130
|
+
# DB-001 — no-auto-drop
|
|
131
|
+
# Severity: CRITICAL │ Category: database
|
|
132
|
+
# Never auto-execute DROP TABLE/DATABASE without explicit approval
|
|
133
|
+
|
|
134
|
+
# Full validation pipeline
|
|
135
|
+
ag validate
|
|
136
|
+
# Governance: 4 violations │ Risk: 29.0 │ Blast Radius: high
|
|
137
|
+
# Compliance: SOC2: 3 findings │ PCI_DSS: 2 findings
|
|
138
|
+
# Optimization: 3,840 → 2,112 tokens (45.0% reduction)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Security Policies
|
|
142
|
+
|
|
143
|
+
21 built-in policies across 7 categories:
|
|
144
|
+
|
|
145
|
+
| Category | Policies | Key Rules |
|
|
146
|
+
|----------|----------|-----------|
|
|
147
|
+
| **Database** | DB-001, DB-002, DB-003 | No auto-DROP, no unguarded mutations, require rollback plans |
|
|
148
|
+
| **Execution** | EX-001 – EX-004 | No inline shell, no curl\|bash, no eval/exec, no rm -rf |
|
|
149
|
+
| **Secrets** | SEC-001 – SEC-003 | No hardcoded secrets, no key logging, no secret persistence |
|
|
150
|
+
| **Git** | GIT-001 – GIT-003 | No force push, no main commits, no secret commits |
|
|
151
|
+
| **Infrastructure** | INF-001 – INF-003 | No public resources, no wildcard IAM, require encryption |
|
|
152
|
+
| **Prompt Injection** | PI-001 – PI-003 | Detect injection, hidden injections, validate external instructions |
|
|
153
|
+
| **Runtime** | RT-001, RT-002 | No debug in prod, require error handling |
|
|
154
|
+
|
|
155
|
+
## Agent Adapters
|
|
156
|
+
|
|
157
|
+
Generates native instruction files for each platform:
|
|
158
|
+
|
|
159
|
+
| Platform | Output File | Format |
|
|
160
|
+
|----------|-------------|--------|
|
|
161
|
+
| **Claude** | `CLAUDE.md` | Markdown |
|
|
162
|
+
| **Cursor** | `.cursorrules` | Markdown |
|
|
163
|
+
| **GitHub Copilot** | `.github/copilot-instructions.md` | Markdown |
|
|
164
|
+
| **Aider** | `.aider.conf.yml` | YAML |
|
|
165
|
+
| **Windsurf** | `.windsurfrules` | Markdown |
|
|
166
|
+
| **Continue.dev** | `.continue/config.json` | JSON |
|
|
167
|
+
| **Universal** | `AGENTS.md` | Markdown |
|
|
168
|
+
|
|
169
|
+
## Architecture
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
agentra/
|
|
173
|
+
├── cli/ # Typer CLI with Rich output
|
|
174
|
+
├── detection/ # Stack detection engine (40+ technologies)
|
|
175
|
+
├── governance/ # Security policy engine (21 rules, 7 categories)
|
|
176
|
+
├── optimizer/ # Token optimization (dedup, prioritize, compress, budget-fit)
|
|
177
|
+
├── adapters/ # Agent platform adapters (7 platforms)
|
|
178
|
+
├── skills/ # Domain skill packs (14 built-in)
|
|
179
|
+
├── execution/ # Execution safety engine (risk classify, sandbox, approve)
|
|
180
|
+
├── onboarding/ # Project initialization (4 modes)
|
|
181
|
+
├── compliance/ # Compliance mapping (SOC2, ISO27001, PCI DSS, HIPAA, NIST)
|
|
182
|
+
├── benchmarks/ # Skill benchmarking with before/after metrics
|
|
183
|
+
├── renderers/ # HTML + Markdown report generation
|
|
184
|
+
├── risk/ # Risk scoring and blast radius estimation
|
|
185
|
+
├── telemetry/ # Local-only JSON audit logging
|
|
186
|
+
└── models.py # Pydantic data models
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Onboarding Modes
|
|
190
|
+
|
|
191
|
+
| Mode | Security | Compliance | Token Budget | Best For |
|
|
192
|
+
|------|----------|------------|-------------|----------|
|
|
193
|
+
| `quick` | Standard | — | 12k / 4k / 2k | Fast dev setup |
|
|
194
|
+
| `guided` | Strict | All 5 frameworks | 12k / 4k / 2k | Interactive comprehensive |
|
|
195
|
+
| `enterprise` | Enterprise | SOC2 + ISO27001 | 16k / 6k / 3k | Production deployments |
|
|
196
|
+
| `ci` | Standard | — | 8k / 3k / 1.5k | CI/CD pipelines |
|
|
197
|
+
|
|
198
|
+
## Benchmarking & Reports
|
|
199
|
+
|
|
200
|
+
Every skill is benchmarked with before/after metrics:
|
|
201
|
+
|
|
202
|
+
- **Instruction Token Cost** — tokens consumed by skill instructions
|
|
203
|
+
- **Security Policy Coverage** — policies activated by the skill
|
|
204
|
+
- **Context Relevance** — stack-match relevance score (0–1)
|
|
205
|
+
- **Instruction Compression** — compression ratio achieved
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
ag benchmark --output reports/
|
|
209
|
+
# ✓ Benchmark report (MD): reports/benchmark-report.md
|
|
210
|
+
# ✓ Benchmark report (HTML): reports/benchmark-report.html
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
The HTML report is a self-contained dark-themed dashboard with stat cards, metric bars, and tables. Open it directly in a browser.
|
|
214
|
+
|
|
215
|
+
## Configuration
|
|
216
|
+
|
|
217
|
+
Agentra uses `.agentra.yml`:
|
|
218
|
+
|
|
219
|
+
```yaml
|
|
220
|
+
project:
|
|
221
|
+
name: my-project
|
|
222
|
+
languages: [python]
|
|
223
|
+
frameworks: [fastapi]
|
|
224
|
+
sdks: [openai]
|
|
225
|
+
|
|
226
|
+
security:
|
|
227
|
+
mode: enterprise
|
|
228
|
+
edr_safe: true
|
|
229
|
+
compliance: [SOC2, ISO27001]
|
|
230
|
+
|
|
231
|
+
optimization:
|
|
232
|
+
minimal_context: true
|
|
233
|
+
token_budget:
|
|
234
|
+
input: 12000
|
|
235
|
+
output: 4000
|
|
236
|
+
|
|
237
|
+
agents: [claude, copilot, cursor]
|
|
238
|
+
skills: [fastapi, postgresql, karpathy]
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Documentation
|
|
242
|
+
|
|
243
|
+
Full interactive documentation is available at [`docs/index.html`](docs/index.html) — a storybook-style guide covering every feature, command, policy, skill, and adapter with usage examples. A Markdown version is at [`docs/index.md`](docs/index.md).
|
|
244
|
+
|
|
245
|
+
## Development
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Install dev dependencies
|
|
249
|
+
pip install -e ".[dev]"
|
|
250
|
+
|
|
251
|
+
# Run tests (72 tests)
|
|
252
|
+
pytest tests/ -v
|
|
253
|
+
|
|
254
|
+
# Lint
|
|
255
|
+
ruff check agentra/
|
|
256
|
+
|
|
257
|
+
# Type check
|
|
258
|
+
mypy agentra/
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Acknowledgements
|
|
262
|
+
|
|
263
|
+
This project was inspired by [agent-policykit](https://github.com/sidrat2612/agent-policykit) by **Siddharth Rathore**. Thanks for the idea and the foundational work that sparked Agentra.
|
|
264
|
+
|
|
265
|
+
## License
|
|
266
|
+
|
|
267
|
+
MIT
|
agentra-0.1.0/README.md
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# Agentra
|
|
4
|
+
|
|
5
|
+
**Enterprise AI Engineering Control Plane**
|
|
6
|
+
|
|
7
|
+
Secure, govern, and optimize AI coding agents — automatically.
|
|
8
|
+
|
|
9
|
+
[](https://python.org)
|
|
10
|
+
[](tests/)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
Agentra is a DevSecOps control plane for AI coding assistants. It auto-detects your project stack, enforces 21 security policies across 7 categories, manages context token budgets, and generates tailored instruction files for every major agent platform.
|
|
18
|
+
|
|
19
|
+
<table>
|
|
20
|
+
<tr><td><strong>40+</strong> Technologies Detected</td><td><strong>21</strong> Security Policies</td><td><strong>14</strong> Built-in Skills</td></tr>
|
|
21
|
+
<tr><td><strong>7</strong> Agent Platforms</td><td><strong>5</strong> Compliance Frameworks</td><td><strong>11</strong> CLI Commands</td></tr>
|
|
22
|
+
</table>
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Install
|
|
28
|
+
pip install agentra
|
|
29
|
+
|
|
30
|
+
# Initialize — auto-detect stack, generate agent instruction files
|
|
31
|
+
ag init --mode quick
|
|
32
|
+
|
|
33
|
+
# Run security governance checks
|
|
34
|
+
ag enforce
|
|
35
|
+
|
|
36
|
+
# Check a command before running it
|
|
37
|
+
ag simulate "rm -rf /tmp/build"
|
|
38
|
+
|
|
39
|
+
# Run benchmarks and generate reports
|
|
40
|
+
ag benchmark
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
| Feature | Description |
|
|
46
|
+
|---------|-------------|
|
|
47
|
+
| 🔍 **Stack Detection** | Auto-detect languages, frameworks, databases, cloud providers, CI/CD, and agents with confidence scores |
|
|
48
|
+
| 🛡 **Security Governance** | 21 policies across database, execution, secret, git, infrastructure, prompt injection, and runtime categories |
|
|
49
|
+
| 🧩 **Skills System** | 14 domain skills (FastAPI, Terraform, K8s, Spark, Airflow, PostgreSQL, Snowflake, dbt, Kafka, OpenAI, LangChain, MCP, Databricks, Karpathy) |
|
|
50
|
+
| 📦 **Token Optimization** | Deduplicate, prioritize, compress, and budget-fit instructions — 30-60% token savings |
|
|
51
|
+
| 🔌 **Agent Adapters** | Native instruction files for Claude, Cursor, Copilot, Aider, Windsurf, Continue.dev, and universal AGENTS.md |
|
|
52
|
+
| ⚙ **Execution Safety** | Risk-classify commands, block destructive patterns, sandbox with approval gates, dry-run mode |
|
|
53
|
+
| ✓ **Compliance** | Map violations to SOC2, ISO27001, PCI DSS, HIPAA, NIST frameworks |
|
|
54
|
+
| 📊 **Benchmarking** | Before/after metrics for every skill with HTML + Markdown report generation |
|
|
55
|
+
|
|
56
|
+
## CLI Commands
|
|
57
|
+
|
|
58
|
+
| Command | Description |
|
|
59
|
+
|---------|-------------|
|
|
60
|
+
| `ag init` | Initialize project — detect stack, save config, generate agent files |
|
|
61
|
+
| `ag detect` | Scan and display detected technologies with confidence scores |
|
|
62
|
+
| `ag enforce` | Run security policies against codebase, report violations with risk scoring |
|
|
63
|
+
| `ag optimize` | Show token optimization analysis: deduplication, compression, budget fitting |
|
|
64
|
+
| `ag simulate <cmd>` | Dry-run a command through the execution safety engine |
|
|
65
|
+
| `ag explain <rule>` | Display full details of a security policy (e.g., `ag explain SEC-001`) |
|
|
66
|
+
| `ag validate` | Full pipeline: governance + compliance + optimization in one command |
|
|
67
|
+
| `ag benchmark` | Run skill benchmarks, generate Markdown + HTML reports |
|
|
68
|
+
| `ag audit` | View local audit log of all Agentra actions |
|
|
69
|
+
| `ag doctor` | Health check: verify config, agent files, .gitignore |
|
|
70
|
+
| `ag version` | Display version |
|
|
71
|
+
|
|
72
|
+
### Usage Examples
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Enterprise mode with SOC2 + ISO27001 compliance
|
|
76
|
+
ag init --mode enterprise --agents claude,copilot
|
|
77
|
+
|
|
78
|
+
# Explain a specific policy rule
|
|
79
|
+
ag explain DB-001
|
|
80
|
+
# DB-001 — no-auto-drop
|
|
81
|
+
# Severity: CRITICAL │ Category: database
|
|
82
|
+
# Never auto-execute DROP TABLE/DATABASE without explicit approval
|
|
83
|
+
|
|
84
|
+
# Full validation pipeline
|
|
85
|
+
ag validate
|
|
86
|
+
# Governance: 4 violations │ Risk: 29.0 │ Blast Radius: high
|
|
87
|
+
# Compliance: SOC2: 3 findings │ PCI_DSS: 2 findings
|
|
88
|
+
# Optimization: 3,840 → 2,112 tokens (45.0% reduction)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Security Policies
|
|
92
|
+
|
|
93
|
+
21 built-in policies across 7 categories:
|
|
94
|
+
|
|
95
|
+
| Category | Policies | Key Rules |
|
|
96
|
+
|----------|----------|-----------|
|
|
97
|
+
| **Database** | DB-001, DB-002, DB-003 | No auto-DROP, no unguarded mutations, require rollback plans |
|
|
98
|
+
| **Execution** | EX-001 – EX-004 | No inline shell, no curl\|bash, no eval/exec, no rm -rf |
|
|
99
|
+
| **Secrets** | SEC-001 – SEC-003 | No hardcoded secrets, no key logging, no secret persistence |
|
|
100
|
+
| **Git** | GIT-001 – GIT-003 | No force push, no main commits, no secret commits |
|
|
101
|
+
| **Infrastructure** | INF-001 – INF-003 | No public resources, no wildcard IAM, require encryption |
|
|
102
|
+
| **Prompt Injection** | PI-001 – PI-003 | Detect injection, hidden injections, validate external instructions |
|
|
103
|
+
| **Runtime** | RT-001, RT-002 | No debug in prod, require error handling |
|
|
104
|
+
|
|
105
|
+
## Agent Adapters
|
|
106
|
+
|
|
107
|
+
Generates native instruction files for each platform:
|
|
108
|
+
|
|
109
|
+
| Platform | Output File | Format |
|
|
110
|
+
|----------|-------------|--------|
|
|
111
|
+
| **Claude** | `CLAUDE.md` | Markdown |
|
|
112
|
+
| **Cursor** | `.cursorrules` | Markdown |
|
|
113
|
+
| **GitHub Copilot** | `.github/copilot-instructions.md` | Markdown |
|
|
114
|
+
| **Aider** | `.aider.conf.yml` | YAML |
|
|
115
|
+
| **Windsurf** | `.windsurfrules` | Markdown |
|
|
116
|
+
| **Continue.dev** | `.continue/config.json` | JSON |
|
|
117
|
+
| **Universal** | `AGENTS.md` | Markdown |
|
|
118
|
+
|
|
119
|
+
## Architecture
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
agentra/
|
|
123
|
+
├── cli/ # Typer CLI with Rich output
|
|
124
|
+
├── detection/ # Stack detection engine (40+ technologies)
|
|
125
|
+
├── governance/ # Security policy engine (21 rules, 7 categories)
|
|
126
|
+
├── optimizer/ # Token optimization (dedup, prioritize, compress, budget-fit)
|
|
127
|
+
├── adapters/ # Agent platform adapters (7 platforms)
|
|
128
|
+
├── skills/ # Domain skill packs (14 built-in)
|
|
129
|
+
├── execution/ # Execution safety engine (risk classify, sandbox, approve)
|
|
130
|
+
├── onboarding/ # Project initialization (4 modes)
|
|
131
|
+
├── compliance/ # Compliance mapping (SOC2, ISO27001, PCI DSS, HIPAA, NIST)
|
|
132
|
+
├── benchmarks/ # Skill benchmarking with before/after metrics
|
|
133
|
+
├── renderers/ # HTML + Markdown report generation
|
|
134
|
+
├── risk/ # Risk scoring and blast radius estimation
|
|
135
|
+
├── telemetry/ # Local-only JSON audit logging
|
|
136
|
+
└── models.py # Pydantic data models
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Onboarding Modes
|
|
140
|
+
|
|
141
|
+
| Mode | Security | Compliance | Token Budget | Best For |
|
|
142
|
+
|------|----------|------------|-------------|----------|
|
|
143
|
+
| `quick` | Standard | — | 12k / 4k / 2k | Fast dev setup |
|
|
144
|
+
| `guided` | Strict | All 5 frameworks | 12k / 4k / 2k | Interactive comprehensive |
|
|
145
|
+
| `enterprise` | Enterprise | SOC2 + ISO27001 | 16k / 6k / 3k | Production deployments |
|
|
146
|
+
| `ci` | Standard | — | 8k / 3k / 1.5k | CI/CD pipelines |
|
|
147
|
+
|
|
148
|
+
## Benchmarking & Reports
|
|
149
|
+
|
|
150
|
+
Every skill is benchmarked with before/after metrics:
|
|
151
|
+
|
|
152
|
+
- **Instruction Token Cost** — tokens consumed by skill instructions
|
|
153
|
+
- **Security Policy Coverage** — policies activated by the skill
|
|
154
|
+
- **Context Relevance** — stack-match relevance score (0–1)
|
|
155
|
+
- **Instruction Compression** — compression ratio achieved
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
ag benchmark --output reports/
|
|
159
|
+
# ✓ Benchmark report (MD): reports/benchmark-report.md
|
|
160
|
+
# ✓ Benchmark report (HTML): reports/benchmark-report.html
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The HTML report is a self-contained dark-themed dashboard with stat cards, metric bars, and tables. Open it directly in a browser.
|
|
164
|
+
|
|
165
|
+
## Configuration
|
|
166
|
+
|
|
167
|
+
Agentra uses `.agentra.yml`:
|
|
168
|
+
|
|
169
|
+
```yaml
|
|
170
|
+
project:
|
|
171
|
+
name: my-project
|
|
172
|
+
languages: [python]
|
|
173
|
+
frameworks: [fastapi]
|
|
174
|
+
sdks: [openai]
|
|
175
|
+
|
|
176
|
+
security:
|
|
177
|
+
mode: enterprise
|
|
178
|
+
edr_safe: true
|
|
179
|
+
compliance: [SOC2, ISO27001]
|
|
180
|
+
|
|
181
|
+
optimization:
|
|
182
|
+
minimal_context: true
|
|
183
|
+
token_budget:
|
|
184
|
+
input: 12000
|
|
185
|
+
output: 4000
|
|
186
|
+
|
|
187
|
+
agents: [claude, copilot, cursor]
|
|
188
|
+
skills: [fastapi, postgresql, karpathy]
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Documentation
|
|
192
|
+
|
|
193
|
+
Full interactive documentation is available at [`docs/index.html`](docs/index.html) — a storybook-style guide covering every feature, command, policy, skill, and adapter with usage examples. A Markdown version is at [`docs/index.md`](docs/index.md).
|
|
194
|
+
|
|
195
|
+
## Development
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Install dev dependencies
|
|
199
|
+
pip install -e ".[dev]"
|
|
200
|
+
|
|
201
|
+
# Run tests (72 tests)
|
|
202
|
+
pytest tests/ -v
|
|
203
|
+
|
|
204
|
+
# Lint
|
|
205
|
+
ruff check agentra/
|
|
206
|
+
|
|
207
|
+
# Type check
|
|
208
|
+
mypy agentra/
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Acknowledgements
|
|
212
|
+
|
|
213
|
+
This project was inspired by [agent-policykit](https://github.com/sidrat2612/agent-policykit) by **Siddharth Rathore**. Thanks for the idea and the foundational work that sparked Agentra.
|
|
214
|
+
|
|
215
|
+
## License
|
|
216
|
+
|
|
217
|
+
MIT
|
|
File without changes
|