briefcase-ai 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.
- briefcase_ai-0.1.0/LICENSE +21 -0
- briefcase_ai-0.1.0/LICENSE-OVERVIEW.md +1 -0
- briefcase_ai-0.1.0/PKG-INFO +41 -0
- briefcase_ai-0.1.0/README.md +324 -0
- briefcase_ai-0.1.0/briefcase/__init__.py +104 -0
- briefcase_ai-0.1.0/briefcase_ai.egg-info/PKG-INFO +41 -0
- briefcase_ai-0.1.0/briefcase_ai.egg-info/SOURCES.txt +64 -0
- briefcase_ai-0.1.0/briefcase_ai.egg-info/dependency_links.txt +1 -0
- briefcase_ai-0.1.0/briefcase_ai.egg-info/entry_points.txt +2 -0
- briefcase_ai-0.1.0/briefcase_ai.egg-info/requires.txt +27 -0
- briefcase_ai-0.1.0/briefcase_ai.egg-info/top_level.txt +3 -0
- briefcase_ai-0.1.0/enterprise/__init__.py +48 -0
- briefcase_ai-0.1.0/enterprise/analytics/__init__.py +18 -0
- briefcase_ai-0.1.0/enterprise/analytics/dashboards.py +131 -0
- briefcase_ai-0.1.0/enterprise/analytics/insights.py +137 -0
- briefcase_ai-0.1.0/enterprise/analytics/metrics.py +286 -0
- briefcase_ai-0.1.0/enterprise/auth/__init__.py +15 -0
- briefcase_ai-0.1.0/enterprise/auth/rbac.py +166 -0
- briefcase_ai-0.1.0/enterprise/auth/sso.py +214 -0
- briefcase_ai-0.1.0/enterprise/compliance/__init__.py +19 -0
- briefcase_ai-0.1.0/enterprise/compliance/audit.py +271 -0
- briefcase_ai-0.1.0/enterprise/compliance/reporting.py +320 -0
- briefcase_ai-0.1.0/enterprise/compliance/retention.py +347 -0
- briefcase_ai-0.1.0/enterprise/config_example.py +164 -0
- briefcase_ai-0.1.0/enterprise/extensions.py +463 -0
- briefcase_ai-0.1.0/enterprise/hosted/__init__.py +19 -0
- briefcase_ai-0.1.0/enterprise/hosted/replay_service.py +371 -0
- briefcase_ai-0.1.0/enterprise/hosted/scaling.py +452 -0
- briefcase_ai-0.1.0/enterprise/hosted/tenant.py +441 -0
- briefcase_ai-0.1.0/oss/__init__.py +7 -0
- briefcase_ai-0.1.0/oss/api/__init__.py +8 -0
- briefcase_ai-0.1.0/oss/api/app.py +113 -0
- briefcase_ai-0.1.0/oss/api/auth.py +94 -0
- briefcase_ai-0.1.0/oss/api/routers/__init__.py +5 -0
- briefcase_ai-0.1.0/oss/api/routers/policies.py +361 -0
- briefcase_ai-0.1.0/oss/api/routers/replay.py +310 -0
- briefcase_ai-0.1.0/oss/api/routers/snapshots.py +316 -0
- briefcase_ai-0.1.0/oss/api/websocket.py +239 -0
- briefcase_ai-0.1.0/oss/cli/__init__.py +76 -0
- briefcase_ai-0.1.0/oss/cli.py +113 -0
- briefcase_ai-0.1.0/oss/replay/__init__.py +47 -0
- briefcase_ai-0.1.0/oss/replay/diff.py +695 -0
- briefcase_ai-0.1.0/oss/replay/engine.py +488 -0
- briefcase_ai-0.1.0/oss/replay/orchestrator.py +563 -0
- briefcase_ai-0.1.0/oss/replay/policies.py +587 -0
- briefcase_ai-0.1.0/oss/sdk/__init__.py +75 -0
- briefcase_ai-0.1.0/oss/sdk/capture.py +471 -0
- briefcase_ai-0.1.0/oss/sdk/client.py +484 -0
- briefcase_ai-0.1.0/oss/sdk/fixtures.py +117 -0
- briefcase_ai-0.1.0/oss/sdk/models.py +185 -0
- briefcase_ai-0.1.0/oss/sdk/schema.py +52 -0
- briefcase_ai-0.1.0/oss/sdk/serialization.py +336 -0
- briefcase_ai-0.1.0/oss/storage/__init__.py +95 -0
- briefcase_ai-0.1.0/oss/storage/artifacts.py +445 -0
- briefcase_ai-0.1.0/oss/storage/cli.py +477 -0
- briefcase_ai-0.1.0/oss/storage/compression.py +229 -0
- briefcase_ai-0.1.0/oss/storage/config.py +362 -0
- briefcase_ai-0.1.0/oss/storage/database.py +149 -0
- briefcase_ai-0.1.0/oss/storage/encryption.py +407 -0
- briefcase_ai-0.1.0/oss/storage/management.py +454 -0
- briefcase_ai-0.1.0/oss/storage/models.py +239 -0
- briefcase_ai-0.1.0/oss/storage/repository.py +438 -0
- briefcase_ai-0.1.0/oss/storage/snapshot_repository.py +461 -0
- briefcase_ai-0.1.0/oss/storage/test_storage.py +1 -0
- briefcase_ai-0.1.0/setup.cfg +4 -0
- briefcase_ai-0.1.0/setup.py +47 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 briefcase-ai Contributors
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# briefcase-ai Licensing Overview ## Dual Licensing Model briefcase-ai uses a dual licensing model to balance open source innovation with sustainable development: ### 1. OSS Core (MIT License) - **Location**: `/oss/` directory and root `LICENSE` file - **License**: MIT License - permissive open source - **Includes**: - SDK for instrumentation - Storage layer - Replay engine - Policy framework - API and UI - CLI tools - **Usage**: Free for any purpose including commercial use - **Modifications**: Allowed and encouraged - **Distribution**: Permitted with attribution ### 2. Enterprise Extensions (Commercial License) - **Location**: `/enterprise/` directory - **License**: Proprietary commercial license - **Includes**: - RBAC and SSO integration - Compliance reporting - Hosted service components - Advanced analytics - Priority support - **Usage**: Requires valid Enterprise License Agreement - **Pricing**: Contact enterprise@briefcasebrain.com ## License Boundaries ``` briefcase/ LICENSE (MIT) # Root license for OSS oss/ LICENSE (MIT) # OSS components - free to use enterprise/ LICENSE (Commercial) # Enterprise extensions - requires license ``` ## Key Points 1. **OSS is Fully Functional**: The OSS core provides complete observability and replay functionality without requiring any enterprise components. 2. **No License Mixing**: OSS and enterprise code are clearly separated. You can use OSS without touching enterprise code. 3. **Enterprise is Optional**: Enterprise features extend OSS capabilities but are not required for core functionality. 4. **Clear Attribution**: When using OSS, include the MIT license and attribution in your distribution. ## Common Scenarios ### For Individual Developers - Use OSS freely for personal or commercial projects - Modify and distribute OSS components - Contribute improvements back to the community ### For Startups - Start with OSS for free - Upgrade to Enterprise when you need advanced features - No vendor lock-in - OSS remains free ### For Enterprises - Evaluate with OSS - Purchase Enterprise license for: - SSO/SAML integration - Compliance reporting - SLA guarantees - Priority support ## License Compliance ### Using OSS 1. Include the MIT license in distributions 2. Maintain copyright notices 3. No warranty provided (as-is basis) ### Using Enterprise 1. Maintain valid Enterprise Agreement 2. Respect usage limits 3. Do not redistribute enterprise code 4. Submit to periodic compliance audits ## Questions? - **OSS Licensing**: See `LICENSE` file or create a GitHub issue - **Enterprise Licensing**: Contact enterprise@briefcasebrain.com - **Contributions**: See `GOVERNANCE.md` for contribution guidelines ## License Headers ### For OSS Files ```python # Copyright (c) 2024 briefcase-ai Contributors # Licensed under the MIT License. See LICENSE file for details. ``` ### For Enterprise Files ```python # Copyright (c) 2024 briefcase-ai Corporation # PROPRIETARY AND CONFIDENTIAL # Unauthorized use, distribution, or disclosure is strictly prohibited. # See enterprise/LICENSE for details. ```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: briefcase-ai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Deterministic observability & replay for AI systems
|
|
5
|
+
Author: briefcase-ai Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: LICENSE-OVERVIEW.md
|
|
10
|
+
Requires-Dist: pydantic>=2.0.0
|
|
11
|
+
Requires-Dist: fastapi>=0.100.0
|
|
12
|
+
Requires-Dist: uvicorn>=0.23.0
|
|
13
|
+
Requires-Dist: sqlalchemy>=2.0.0
|
|
14
|
+
Requires-Dist: alembic>=1.11.0
|
|
15
|
+
Requires-Dist: httpx>=0.24.0
|
|
16
|
+
Requires-Dist: click>=8.1.0
|
|
17
|
+
Requires-Dist: python-multipart>=0.0.6
|
|
18
|
+
Requires-Dist: websockets>=11.0.0
|
|
19
|
+
Requires-Dist: aiofiles>=23.0.0
|
|
20
|
+
Requires-Dist: python-jose[cryptography]>=3.3.0
|
|
21
|
+
Requires-Dist: passlib[bcrypt]>=1.7.4
|
|
22
|
+
Requires-Dist: email-validator>=2.0.0
|
|
23
|
+
Requires-Dist: lz4>=4.0.0
|
|
24
|
+
Requires-Dist: cryptography>=41.0.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff>=0.0.270; extra == "dev"
|
|
32
|
+
Provides-Extra: enterprise
|
|
33
|
+
Requires-Dist: python-saml>=1.15.0; extra == "enterprise"
|
|
34
|
+
Requires-Dist: ldap3>=2.9.0; extra == "enterprise"
|
|
35
|
+
Dynamic: author
|
|
36
|
+
Dynamic: license
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
Dynamic: provides-extra
|
|
39
|
+
Dynamic: requires-dist
|
|
40
|
+
Dynamic: requires-python
|
|
41
|
+
Dynamic: summary
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# briefcase-ai
|
|
2
|
+
|
|
3
|
+
**Deterministic observability and replay for AI systems**
|
|
4
|
+
|
|
5
|
+
briefcase-ai provides complete visibility into AI decision-making through immutable snapshots, deterministic replay, and comprehensive instrumentation. Built for production environments, it captures every model interaction with full context, enabling teams to debug, validate, and improve AI systems with confidence.
|
|
6
|
+
|
|
7
|
+
## Key Features
|
|
8
|
+
|
|
9
|
+
- **Complete Observability**: Capture every AI decision with full input/output context
|
|
10
|
+
- **Deterministic Replay**: Reproduce any model behavior for debugging and validation
|
|
11
|
+
- **Agentic Design Patterns**: 10 production-ready patterns with real business examples
|
|
12
|
+
- **Multi-Provider Support**: Works with OpenAI, Anthropic, Google Gemini, and custom models
|
|
13
|
+
- **Enterprise Ready**: Built-in compliance, audit trails, and security features
|
|
14
|
+
- **Production Tested**: Comprehensive test suite with CI/CD integration
|
|
15
|
+
|
|
16
|
+
## Architecture
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
briefcase-ai/
|
|
20
|
+
├── oss/ # Open source core
|
|
21
|
+
│ ├── sdk/ # Instrumentation & data models
|
|
22
|
+
│ ├── storage/ # SQLite backend & repositories
|
|
23
|
+
│ ├── replay/ # Deterministic replay engine
|
|
24
|
+
│ ├── api/ # FastAPI backend
|
|
25
|
+
│ ├── ui/ # Next.js dashboard
|
|
26
|
+
│ └── cli.py # Command-line interface
|
|
27
|
+
├── enterprise/ # Commercial extensions
|
|
28
|
+
│ ├── auth/ # RBAC & SSO integration
|
|
29
|
+
│ ├── compliance/ # Audit & retention policies
|
|
30
|
+
│ ├── hosted/ # Multi-tenant replay service
|
|
31
|
+
│ └── analytics/ # Advanced metrics & insights
|
|
32
|
+
├── examples/ # Comprehensive examples
|
|
33
|
+
│ ├── notebooks/ # Interactive tutorials
|
|
34
|
+
│ ├── agents/ # Agentic design patterns
|
|
35
|
+
│ └── providers/ # Multi-provider examples
|
|
36
|
+
├── tests/ # Full test suite (431 lines)
|
|
37
|
+
└── scripts/ # Development & deployment tools
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Core Components
|
|
41
|
+
|
|
42
|
+
### SDK & Instrumentation
|
|
43
|
+
- **Function Decorators**: Seamless capture with `@instrument_function`
|
|
44
|
+
- **Context Management**: Automatic request correlation and metadata
|
|
45
|
+
- **Serialization**: Complete artifact capture and deduplication
|
|
46
|
+
- **Policy Framework**: Configurable replay and validation rules
|
|
47
|
+
|
|
48
|
+
### Storage & Replay
|
|
49
|
+
- **Immutable Snapshots**: Complete decision audit trail
|
|
50
|
+
- **SQLite Backend**: Zero-config local storage with migration support
|
|
51
|
+
- **Repository Pattern**: Extensible to PostgreSQL and cloud storage
|
|
52
|
+
- **Deterministic Replay**: Bit-perfect reproduction of model behavior
|
|
53
|
+
|
|
54
|
+
### API & Interface
|
|
55
|
+
- **FastAPI Backend**: RESTful API with WebSocket real-time updates
|
|
56
|
+
- **Next.js Dashboard**: Production-ready web interface
|
|
57
|
+
- **CLI Tools**: Complete command-line workflow integration
|
|
58
|
+
- **Authentication**: Token-based auth with enterprise SSO support
|
|
59
|
+
|
|
60
|
+
## Agentic Design Patterns
|
|
61
|
+
|
|
62
|
+
This repository includes a comprehensive series of 10 interactive notebooks demonstrating production-ready agentic design patterns through **TechCorp's AI-Powered Customer Intelligence Platform** case study.
|
|
63
|
+
|
|
64
|
+
### Foundation Patterns
|
|
65
|
+
1. **[Prompt Chaining](examples/notebooks/patterns/01_prompt_chaining_customer_analysis.ipynb)** - Multi-step customer analysis (70% faster processing)
|
|
66
|
+
2. **[Intelligent Routing](examples/notebooks/patterns/02_routing_intelligent_dispatch.ipynb)** - Optimal model selection (40% cost reduction)
|
|
67
|
+
3. **[Memory Management](examples/notebooks/patterns/03_memory_conversation_context.ipynb)** - Context preservation (25% satisfaction improvement)
|
|
68
|
+
|
|
69
|
+
### Safety & Enhancement
|
|
70
|
+
4. **[Guardrails](examples/notebooks/patterns/04_guardrails_safety_compliance.ipynb)** - GDPR compliance & content safety (100% compliance rate)
|
|
71
|
+
5. **[Human-in-the-Loop](examples/notebooks/patterns/05_human_in_loop_escalation.ipynb)** - Smart escalation (95% first-call resolution)
|
|
72
|
+
6. **[RAG Knowledge](examples/notebooks/patterns/06_rag_knowledge_enhanced.ipynb)** - Enhanced retrieval (5x accuracy improvement)
|
|
73
|
+
|
|
74
|
+
### Optimization & Resilience
|
|
75
|
+
7. **[Goal Monitoring](examples/notebooks/patterns/07_goal_monitoring_sla_tracking.ipynb)** - SLA tracking (99% achievement rate)
|
|
76
|
+
8. **[Resource Optimization](examples/notebooks/patterns/08_resource_optimization_cost_management.ipynb)** - Cost management ($30k/month savings)
|
|
77
|
+
9. **[Exception Recovery](examples/notebooks/patterns/09_exception_recovery_resilience.ipynb)** - Failure handling (99.9% uptime)
|
|
78
|
+
|
|
79
|
+
### Advanced Integration
|
|
80
|
+
10. **[Inter-Agent Communication](examples/notebooks/patterns/10_inter_agent_collaboration.ipynb)** - Multi-agent orchestration
|
|
81
|
+
|
|
82
|
+
**Combined Impact**: 70% faster responses, 40% cost reduction, $2M additional revenue, 100% compliance
|
|
83
|
+
|
|
84
|
+
## Multi-Provider Examples
|
|
85
|
+
|
|
86
|
+
### OpenAI Integration
|
|
87
|
+
```python
|
|
88
|
+
# examples/providers/openai/basic_chat_completion.py
|
|
89
|
+
@instrument_function(model_parameters=ModelParameters(
|
|
90
|
+
model_name="gpt-4", model_version="1.0"
|
|
91
|
+
))
|
|
92
|
+
def analyze_sentiment(text: str) -> str:
|
|
93
|
+
response = openai.ChatCompletion.create(
|
|
94
|
+
model="gpt-4",
|
|
95
|
+
messages=[{"role": "user", "content": f"Analyze sentiment: {text}"}]
|
|
96
|
+
)
|
|
97
|
+
return response.choices[0].message.content
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Anthropic Claude
|
|
101
|
+
```python
|
|
102
|
+
# examples/providers/anthropic/constitutional_ai.py
|
|
103
|
+
@instrument_function(model_parameters=ModelParameters(
|
|
104
|
+
model_name="claude-3", model_version="1.0"
|
|
105
|
+
))
|
|
106
|
+
def safe_content_generation(prompt: str) -> str:
|
|
107
|
+
response = anthropic.completions.create(
|
|
108
|
+
model="claude-3-sonnet",
|
|
109
|
+
max_tokens=1000,
|
|
110
|
+
prompt=f"Human: {prompt}\n\nAssistant:"
|
|
111
|
+
)
|
|
112
|
+
return response.completion
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Google Gemini
|
|
116
|
+
```python
|
|
117
|
+
# examples/providers/gemini/multimodal.py
|
|
118
|
+
@instrument_function(model_parameters=ModelParameters(
|
|
119
|
+
model_name="gemini-pro", model_version="1.0"
|
|
120
|
+
))
|
|
121
|
+
def analyze_image_and_text(image_data: bytes, text: str) -> str:
|
|
122
|
+
response = genai.GenerativeModel('gemini-pro-vision').generate_content([
|
|
123
|
+
text, {"mime_type": "image/jpeg", "data": image_data}
|
|
124
|
+
])
|
|
125
|
+
return response.text
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Quick Start
|
|
129
|
+
|
|
130
|
+
### Installation
|
|
131
|
+
```bash
|
|
132
|
+
# Clone and setup
|
|
133
|
+
git clone https://github.com/briefcasebrain/briefcase-ai-core.git
|
|
134
|
+
cd briefcase-ai-core
|
|
135
|
+
|
|
136
|
+
# Quick setup (recommended)
|
|
137
|
+
make quick
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Basic Usage
|
|
141
|
+
```python
|
|
142
|
+
from briefcase.sdk import BriefcaseClient, ModelParameters, instrument_function
|
|
143
|
+
|
|
144
|
+
# Initialize client
|
|
145
|
+
client = BriefcaseClient()
|
|
146
|
+
set_default_client(client)
|
|
147
|
+
|
|
148
|
+
# Instrument any function
|
|
149
|
+
@instrument_function(
|
|
150
|
+
model_parameters=ModelParameters(
|
|
151
|
+
model_name="fraud-detector",
|
|
152
|
+
model_version="1.0",
|
|
153
|
+
parameters={"temperature": 0.2}
|
|
154
|
+
)
|
|
155
|
+
)
|
|
156
|
+
def score_transaction(prompt: str) -> str:
|
|
157
|
+
# Your AI model logic here
|
|
158
|
+
return "approve" if "safe" in prompt.lower() else "review"
|
|
159
|
+
|
|
160
|
+
# Use normally - everything is captured
|
|
161
|
+
result = score_transaction("Is this transaction safe?")
|
|
162
|
+
|
|
163
|
+
# Access decision history
|
|
164
|
+
decision = client.list_decisions()[-1]
|
|
165
|
+
print(f"Function: {decision.function_name}")
|
|
166
|
+
print(f"Input: {decision.inputs[0].value}")
|
|
167
|
+
print(f"Output: {decision.output}")
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Web Interface
|
|
171
|
+
```bash
|
|
172
|
+
# Start services
|
|
173
|
+
make dev
|
|
174
|
+
|
|
175
|
+
# Access dashboard
|
|
176
|
+
open http://localhost:3000
|
|
177
|
+
# Login: admin / briefcase
|
|
178
|
+
|
|
179
|
+
# API documentation
|
|
180
|
+
open http://localhost:8000/docs
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Development & Testing
|
|
184
|
+
|
|
185
|
+
### Running Tests
|
|
186
|
+
```bash
|
|
187
|
+
# Full test suite (15 tests, 431 lines coverage)
|
|
188
|
+
make test
|
|
189
|
+
|
|
190
|
+
# Individual components
|
|
191
|
+
pytest tests/sdk/ # SDK instrumentation
|
|
192
|
+
pytest tests/storage/ # Storage layer
|
|
193
|
+
pytest tests/replay/ # Replay engine
|
|
194
|
+
pytest tests/api/ # API endpoints
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Development Workflow
|
|
198
|
+
```bash
|
|
199
|
+
# Setup development environment
|
|
200
|
+
make install
|
|
201
|
+
make setup
|
|
202
|
+
|
|
203
|
+
# Code quality
|
|
204
|
+
make lint # Run linting
|
|
205
|
+
make format # Format code
|
|
206
|
+
|
|
207
|
+
# Database operations
|
|
208
|
+
briefcase-ai init-db # Initialize database
|
|
209
|
+
briefcase-ai serve # Start API server
|
|
210
|
+
briefcase-ai ui # Start UI server
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Continuous Integration
|
|
214
|
+
```bash
|
|
215
|
+
# CI script (runs on GitHub Actions)
|
|
216
|
+
scripts/run_ci.sh
|
|
217
|
+
|
|
218
|
+
# Manual CI run
|
|
219
|
+
bash scripts/run_ci.sh
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Agent Examples
|
|
223
|
+
|
|
224
|
+
### Reasoning Patterns
|
|
225
|
+
- **[Chain of Thought](examples/agents/reasoning/chain_of_thought.py)** - Step-by-step reasoning
|
|
226
|
+
- **[Self Reflection](examples/agents/reasoning/self_reflection.py)** - Self-improvement loops
|
|
227
|
+
|
|
228
|
+
### Workflow Orchestration
|
|
229
|
+
- **[Sequential Workflow](examples/agents/workflows/sequential_workflow.py)** - Linear task processing
|
|
230
|
+
- **[Parallel Workflow](examples/agents/workflows/parallel_workflow.py)** - Concurrent task execution
|
|
231
|
+
|
|
232
|
+
### Multi-Agent Coordination
|
|
233
|
+
- **[Multi-Agent System](examples/agents/coordination/multi_agent_system.py)** - Agent collaboration
|
|
234
|
+
- **[Customer Service](examples/agents/industry/customer_service.py)** - Industry-specific implementation
|
|
235
|
+
|
|
236
|
+
## Production Deployment
|
|
237
|
+
|
|
238
|
+
### Scaling Considerations
|
|
239
|
+
- **Horizontal Scaling**: Each component scales independently
|
|
240
|
+
- **Caching Strategy**: Redis for session state and routing decisions
|
|
241
|
+
- **Queue Management**: RabbitMQ/Kafka for async processing
|
|
242
|
+
- **Load Balancing**: Multi-instance deployment support
|
|
243
|
+
- **Monitoring**: Prometheus + Grafana integration ready
|
|
244
|
+
|
|
245
|
+
### Enterprise Features
|
|
246
|
+
```python
|
|
247
|
+
# Enterprise authentication
|
|
248
|
+
from enterprise.auth import RBACManager, SSOProvider
|
|
249
|
+
|
|
250
|
+
# Compliance and audit
|
|
251
|
+
from enterprise.compliance import AuditLogger, RetentionPolicy
|
|
252
|
+
|
|
253
|
+
# Hosted replay service
|
|
254
|
+
from enterprise.hosted import TenantManager, ReplayService
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Production Checklist
|
|
258
|
+
- [ ] Configure authentication and authorization
|
|
259
|
+
- [ ] Set up database migrations and backups
|
|
260
|
+
- [ ] Implement monitoring and alerting
|
|
261
|
+
- [ ] Configure retention and compliance policies
|
|
262
|
+
- [ ] Set up load balancing and scaling
|
|
263
|
+
- [ ] Test disaster recovery procedures
|
|
264
|
+
|
|
265
|
+
## CLI Reference
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
# Core operations
|
|
269
|
+
briefcase-ai serve # Start API server
|
|
270
|
+
briefcase-ai ui # Launch web interface
|
|
271
|
+
briefcase-ai init-db # Initialize database
|
|
272
|
+
briefcase-ai test # Run test suite
|
|
273
|
+
|
|
274
|
+
# Development tools
|
|
275
|
+
briefcase-ai format # Code formatting
|
|
276
|
+
briefcase-ai lint # Code linting
|
|
277
|
+
briefcase-ai clean # Clean temporary files
|
|
278
|
+
|
|
279
|
+
# Database management
|
|
280
|
+
briefcase-ai migrate # Run migrations
|
|
281
|
+
briefcase-ai reset # Reset database
|
|
282
|
+
briefcase-ai backup # Create backup
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Contributing
|
|
286
|
+
|
|
287
|
+
We welcome contributions! Areas for enhancement:
|
|
288
|
+
|
|
289
|
+
- **Pattern Implementations**: Additional agentic design patterns
|
|
290
|
+
- **Provider Integration**: New model provider examples
|
|
291
|
+
- **Performance**: Optimization and scaling improvements
|
|
292
|
+
- **Documentation**: Tutorials and best practices
|
|
293
|
+
- **Testing**: Increased test coverage and scenarios
|
|
294
|
+
|
|
295
|
+
### Development Setup
|
|
296
|
+
1. Fork the repository
|
|
297
|
+
2. Create a feature branch: `git checkout -b feature-name`
|
|
298
|
+
3. Make changes and add tests
|
|
299
|
+
4. Run the test suite: `make test`
|
|
300
|
+
5. Submit a pull request
|
|
301
|
+
|
|
302
|
+
## Integration Points
|
|
303
|
+
|
|
304
|
+
- **SDK Decorators**: Capture any Python function with zero code changes
|
|
305
|
+
- **REST API**: Language-agnostic ingestion and replay
|
|
306
|
+
- **Storage Layer**: Extensible to PostgreSQL, MongoDB, or cloud storage
|
|
307
|
+
- **Policy Framework**: Embed replay logic in existing applications
|
|
308
|
+
- **Enterprise Hooks**: RBAC, compliance, and hosted replay capabilities
|
|
309
|
+
|
|
310
|
+
## License
|
|
311
|
+
|
|
312
|
+
**Open Source Core**: MIT Licensed - see [LICENSE](LICENSE)
|
|
313
|
+
|
|
314
|
+
**Enterprise Extensions**: Commercial license required - see [LICENSE-OVERVIEW.md](LICENSE-OVERVIEW.md) and [GOVERNANCE.md](GOVERNANCE.md) for details.
|
|
315
|
+
|
|
316
|
+
## Support
|
|
317
|
+
|
|
318
|
+
- **Documentation**: Comprehensive examples and tutorials included
|
|
319
|
+
- **Community**: Open source community support via GitHub issues
|
|
320
|
+
- **Enterprise**: Commercial support available for enterprise features
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
**Get Started**: [Quick Start Guide](#quick-start) | **Learn Patterns**: [Agentic Design Patterns](#agentic-design-patterns) | **API Docs**: http://localhost:8000/docs
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""Public ``briefcase`` namespace that aliases the internal ``oss`` package."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import importlib
|
|
6
|
+
import importlib.abc
|
|
7
|
+
import importlib.util
|
|
8
|
+
import pkgutil
|
|
9
|
+
import sys
|
|
10
|
+
from typing import Optional, Sequence
|
|
11
|
+
|
|
12
|
+
_TARGET_PACKAGE = "oss"
|
|
13
|
+
_target_pkg = importlib.import_module(_TARGET_PACKAGE)
|
|
14
|
+
|
|
15
|
+
__all__ = getattr(_target_pkg, "__all__", [])
|
|
16
|
+
__version__ = getattr(_target_pkg, "__version__", None)
|
|
17
|
+
__path__ = list(getattr(_target_pkg, "__path__", []))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class _AliasLoader(importlib.abc.Loader):
|
|
21
|
+
"""Loader that reuses the real module and registers it under the briefcase alias."""
|
|
22
|
+
|
|
23
|
+
def __init__(self, alias: str, target: str) -> None:
|
|
24
|
+
self.alias = alias
|
|
25
|
+
self.target = target
|
|
26
|
+
|
|
27
|
+
def create_module(self, spec): # type: ignore[override]
|
|
28
|
+
return None # Use default module creation semantics
|
|
29
|
+
|
|
30
|
+
def exec_module(self, module) -> None: # type: ignore[override]
|
|
31
|
+
target_module = importlib.import_module(self.target)
|
|
32
|
+
sys.modules[self.alias] = target_module
|
|
33
|
+
|
|
34
|
+
parent_name, _, child_name = self.alias.rpartition(".")
|
|
35
|
+
if parent_name:
|
|
36
|
+
parent_module = sys.modules.get(parent_name)
|
|
37
|
+
if parent_module is not None:
|
|
38
|
+
setattr(parent_module, child_name, target_module)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class _AliasFinder(importlib.abc.MetaPathFinder):
|
|
42
|
+
"""Finder that maps ``briefcase.*`` imports to ``oss.*`` modules."""
|
|
43
|
+
|
|
44
|
+
prefix = __name__ + "."
|
|
45
|
+
target_prefix = _TARGET_PACKAGE + "."
|
|
46
|
+
|
|
47
|
+
def find_spec(
|
|
48
|
+
self,
|
|
49
|
+
fullname: str,
|
|
50
|
+
path: Optional[Sequence[str]],
|
|
51
|
+
target=None,
|
|
52
|
+
): # type: ignore[override]
|
|
53
|
+
if not fullname.startswith(self.prefix):
|
|
54
|
+
return None
|
|
55
|
+
|
|
56
|
+
target_name = self.target_prefix + fullname[len(self.prefix):]
|
|
57
|
+
target_spec = importlib.util.find_spec(target_name)
|
|
58
|
+
if target_spec is None:
|
|
59
|
+
return None
|
|
60
|
+
|
|
61
|
+
spec = importlib.util.spec_from_loader(
|
|
62
|
+
fullname,
|
|
63
|
+
_AliasLoader(fullname, target_name),
|
|
64
|
+
origin=target_spec.origin,
|
|
65
|
+
)
|
|
66
|
+
if spec is None:
|
|
67
|
+
return None
|
|
68
|
+
|
|
69
|
+
if target_spec.submodule_search_locations is not None:
|
|
70
|
+
spec.submodule_search_locations = target_spec.submodule_search_locations
|
|
71
|
+
spec.has_location = target_spec.has_location
|
|
72
|
+
spec.cached = target_spec.cached
|
|
73
|
+
return spec
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _install_alias_finder() -> None:
|
|
77
|
+
for existing in sys.meta_path:
|
|
78
|
+
if isinstance(existing, _AliasFinder):
|
|
79
|
+
return
|
|
80
|
+
sys.meta_path.insert(0, _AliasFinder())
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
_install_alias_finder()
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def __getattr__(name: str):
|
|
87
|
+
if hasattr(_target_pkg, name):
|
|
88
|
+
return getattr(_target_pkg, name)
|
|
89
|
+
|
|
90
|
+
alias_name = f"{__name__}.{name}"
|
|
91
|
+
module = sys.modules.get(alias_name)
|
|
92
|
+
if module is not None:
|
|
93
|
+
return module
|
|
94
|
+
|
|
95
|
+
target_name = f"{_TARGET_PACKAGE}.{name}"
|
|
96
|
+
module = importlib.import_module(target_name)
|
|
97
|
+
sys.modules[alias_name] = module
|
|
98
|
+
return module
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def __dir__():
|
|
102
|
+
names = set(dir(_target_pkg))
|
|
103
|
+
names.update(spec.name for spec in pkgutil.iter_modules(__path__))
|
|
104
|
+
return sorted(names)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: briefcase-ai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Deterministic observability & replay for AI systems
|
|
5
|
+
Author: briefcase-ai Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: LICENSE-OVERVIEW.md
|
|
10
|
+
Requires-Dist: pydantic>=2.0.0
|
|
11
|
+
Requires-Dist: fastapi>=0.100.0
|
|
12
|
+
Requires-Dist: uvicorn>=0.23.0
|
|
13
|
+
Requires-Dist: sqlalchemy>=2.0.0
|
|
14
|
+
Requires-Dist: alembic>=1.11.0
|
|
15
|
+
Requires-Dist: httpx>=0.24.0
|
|
16
|
+
Requires-Dist: click>=8.1.0
|
|
17
|
+
Requires-Dist: python-multipart>=0.0.6
|
|
18
|
+
Requires-Dist: websockets>=11.0.0
|
|
19
|
+
Requires-Dist: aiofiles>=23.0.0
|
|
20
|
+
Requires-Dist: python-jose[cryptography]>=3.3.0
|
|
21
|
+
Requires-Dist: passlib[bcrypt]>=1.7.4
|
|
22
|
+
Requires-Dist: email-validator>=2.0.0
|
|
23
|
+
Requires-Dist: lz4>=4.0.0
|
|
24
|
+
Requires-Dist: cryptography>=41.0.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff>=0.0.270; extra == "dev"
|
|
32
|
+
Provides-Extra: enterprise
|
|
33
|
+
Requires-Dist: python-saml>=1.15.0; extra == "enterprise"
|
|
34
|
+
Requires-Dist: ldap3>=2.9.0; extra == "enterprise"
|
|
35
|
+
Dynamic: author
|
|
36
|
+
Dynamic: license
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
Dynamic: provides-extra
|
|
39
|
+
Dynamic: requires-dist
|
|
40
|
+
Dynamic: requires-python
|
|
41
|
+
Dynamic: summary
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
LICENSE-OVERVIEW.md
|
|
3
|
+
README.md
|
|
4
|
+
setup.py
|
|
5
|
+
briefcase/__init__.py
|
|
6
|
+
briefcase_ai.egg-info/PKG-INFO
|
|
7
|
+
briefcase_ai.egg-info/SOURCES.txt
|
|
8
|
+
briefcase_ai.egg-info/dependency_links.txt
|
|
9
|
+
briefcase_ai.egg-info/entry_points.txt
|
|
10
|
+
briefcase_ai.egg-info/requires.txt
|
|
11
|
+
briefcase_ai.egg-info/top_level.txt
|
|
12
|
+
enterprise/__init__.py
|
|
13
|
+
enterprise/config_example.py
|
|
14
|
+
enterprise/extensions.py
|
|
15
|
+
enterprise/analytics/__init__.py
|
|
16
|
+
enterprise/analytics/dashboards.py
|
|
17
|
+
enterprise/analytics/insights.py
|
|
18
|
+
enterprise/analytics/metrics.py
|
|
19
|
+
enterprise/auth/__init__.py
|
|
20
|
+
enterprise/auth/rbac.py
|
|
21
|
+
enterprise/auth/sso.py
|
|
22
|
+
enterprise/compliance/__init__.py
|
|
23
|
+
enterprise/compliance/audit.py
|
|
24
|
+
enterprise/compliance/reporting.py
|
|
25
|
+
enterprise/compliance/retention.py
|
|
26
|
+
enterprise/hosted/__init__.py
|
|
27
|
+
enterprise/hosted/replay_service.py
|
|
28
|
+
enterprise/hosted/scaling.py
|
|
29
|
+
enterprise/hosted/tenant.py
|
|
30
|
+
oss/__init__.py
|
|
31
|
+
oss/cli.py
|
|
32
|
+
oss/api/__init__.py
|
|
33
|
+
oss/api/app.py
|
|
34
|
+
oss/api/auth.py
|
|
35
|
+
oss/api/websocket.py
|
|
36
|
+
oss/api/routers/__init__.py
|
|
37
|
+
oss/api/routers/policies.py
|
|
38
|
+
oss/api/routers/replay.py
|
|
39
|
+
oss/api/routers/snapshots.py
|
|
40
|
+
oss/cli/__init__.py
|
|
41
|
+
oss/replay/__init__.py
|
|
42
|
+
oss/replay/diff.py
|
|
43
|
+
oss/replay/engine.py
|
|
44
|
+
oss/replay/orchestrator.py
|
|
45
|
+
oss/replay/policies.py
|
|
46
|
+
oss/sdk/__init__.py
|
|
47
|
+
oss/sdk/capture.py
|
|
48
|
+
oss/sdk/client.py
|
|
49
|
+
oss/sdk/fixtures.py
|
|
50
|
+
oss/sdk/models.py
|
|
51
|
+
oss/sdk/schema.py
|
|
52
|
+
oss/sdk/serialization.py
|
|
53
|
+
oss/storage/__init__.py
|
|
54
|
+
oss/storage/artifacts.py
|
|
55
|
+
oss/storage/cli.py
|
|
56
|
+
oss/storage/compression.py
|
|
57
|
+
oss/storage/config.py
|
|
58
|
+
oss/storage/database.py
|
|
59
|
+
oss/storage/encryption.py
|
|
60
|
+
oss/storage/management.py
|
|
61
|
+
oss/storage/models.py
|
|
62
|
+
oss/storage/repository.py
|
|
63
|
+
oss/storage/snapshot_repository.py
|
|
64
|
+
oss/storage/test_storage.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
pydantic>=2.0.0
|
|
2
|
+
fastapi>=0.100.0
|
|
3
|
+
uvicorn>=0.23.0
|
|
4
|
+
sqlalchemy>=2.0.0
|
|
5
|
+
alembic>=1.11.0
|
|
6
|
+
httpx>=0.24.0
|
|
7
|
+
click>=8.1.0
|
|
8
|
+
python-multipart>=0.0.6
|
|
9
|
+
websockets>=11.0.0
|
|
10
|
+
aiofiles>=23.0.0
|
|
11
|
+
python-jose[cryptography]>=3.3.0
|
|
12
|
+
passlib[bcrypt]>=1.7.4
|
|
13
|
+
email-validator>=2.0.0
|
|
14
|
+
lz4>=4.0.0
|
|
15
|
+
cryptography>=41.0.0
|
|
16
|
+
|
|
17
|
+
[dev]
|
|
18
|
+
pytest>=7.0.0
|
|
19
|
+
pytest-asyncio>=0.21.0
|
|
20
|
+
pytest-cov>=4.0.0
|
|
21
|
+
black>=23.0.0
|
|
22
|
+
mypy>=1.0.0
|
|
23
|
+
ruff>=0.0.270
|
|
24
|
+
|
|
25
|
+
[enterprise]
|
|
26
|
+
python-saml>=1.15.0
|
|
27
|
+
ldap3>=2.9.0
|