lode-observe-ai 0.1.0.dev0__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 (50) hide show
  1. lode_observe_ai-0.1.0.dev0/.github/workflows/ci.yml +57 -0
  2. lode_observe_ai-0.1.0.dev0/.github/workflows/publish.yml +75 -0
  3. lode_observe_ai-0.1.0.dev0/.gitignore +63 -0
  4. lode_observe_ai-0.1.0.dev0/.python-version +1 -0
  5. lode_observe_ai-0.1.0.dev0/CHANGELOG.md +141 -0
  6. lode_observe_ai-0.1.0.dev0/CODE_OF_CONDUCT.md +128 -0
  7. lode_observe_ai-0.1.0.dev0/CONTRIBUTING.md +357 -0
  8. lode_observe_ai-0.1.0.dev0/Dockerfile +65 -0
  9. lode_observe_ai-0.1.0.dev0/LICENSE +21 -0
  10. lode_observe_ai-0.1.0.dev0/PKG-INFO +623 -0
  11. lode_observe_ai-0.1.0.dev0/README.md +584 -0
  12. lode_observe_ai-0.1.0.dev0/SECURITY.md +127 -0
  13. lode_observe_ai-0.1.0.dev0/WORKFLOW.md +437 -0
  14. lode_observe_ai-0.1.0.dev0/docs/DEPLOYMENT.md +446 -0
  15. lode_observe_ai-0.1.0.dev0/docs/PERFORMANCE.md +324 -0
  16. lode_observe_ai-0.1.0.dev0/docs/TROUBLESHOOTING.md +420 -0
  17. lode_observe_ai-0.1.0.dev0/docs/adr/001-architecture.md +256 -0
  18. lode_observe_ai-0.1.0.dev0/examples/llm_tracing.py +238 -0
  19. lode_observe_ai-0.1.0.dev0/k8s/configmap.yaml +11 -0
  20. lode_observe_ai-0.1.0.dev0/k8s/deployment.yaml +89 -0
  21. lode_observe_ai-0.1.0.dev0/k8s/ingress.yaml +21 -0
  22. lode_observe_ai-0.1.0.dev0/k8s/service.yaml +18 -0
  23. lode_observe_ai-0.1.0.dev0/pyproject.toml +110 -0
  24. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/__init__.py +59 -0
  25. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/cli.py +227 -0
  26. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/core/__init__.py +311 -0
  27. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/core/export.py +138 -0
  28. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/domain/__init__.py +179 -0
  29. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/infrastructure/__init__.py +7 -0
  30. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/infrastructure/buffer.py +130 -0
  31. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/infrastructure/hooks/__init__.py +31 -0
  32. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/infrastructure/hooks/litellm_hook.py +288 -0
  33. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/infrastructure/hooks/openai_hook.py +167 -0
  34. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/infrastructure/otel_exporter.py +153 -0
  35. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/infrastructure/server.py +401 -0
  36. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/infrastructure/storage/__init__.py +5 -0
  37. lode_observe_ai-0.1.0.dev0/src/lode_observe_ai/infrastructure/storage/sqlite_store.py +349 -0
  38. lode_observe_ai-0.1.0.dev0/tests/__init__.py +0 -0
  39. lode_observe_ai-0.1.0.dev0/tests/test_anomaly_detection.py +177 -0
  40. lode_observe_ai-0.1.0.dev0/tests/test_async_buffer.py +146 -0
  41. lode_observe_ai-0.1.0.dev0/tests/test_cli.py +22 -0
  42. lode_observe_ai-0.1.0.dev0/tests/test_cli_comprehensive.py +99 -0
  43. lode_observe_ai-0.1.0.dev0/tests/test_decorators_context.py +105 -0
  44. lode_observe_ai-0.1.0.dev0/tests/test_export_assay.py +73 -0
  45. lode_observe_ai-0.1.0.dev0/tests/test_functional_core.py +329 -0
  46. lode_observe_ai-0.1.0.dev0/tests/test_hooks_litellm.py +60 -0
  47. lode_observe_ai-0.1.0.dev0/tests/test_hooks_openai.py +59 -0
  48. lode_observe_ai-0.1.0.dev0/tests/test_sqlite_storage.py +245 -0
  49. lode_observe_ai-0.1.0.dev0/tests/test_storage_comprehensive.py +121 -0
  50. lode_observe_ai-0.1.0.dev0/uv.lock +1246 -0
@@ -0,0 +1,57 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install UV
20
+ run: |
21
+ curl -LsSf https://astral.sh/uv/install.sh | sh
22
+
23
+ - name: Set up Python ${{ matrix.python-version }}
24
+ uses: actions/setup-python@v4
25
+ with:
26
+ python-version: ${{ matrix.python-version }}
27
+
28
+ - name: Install dependencies
29
+ run: |
30
+ uv pip install --system -e ".[dev]"
31
+
32
+ - name: Ruff linting
33
+ run: |
34
+ python -m pip install ruff
35
+ ruff check src tests
36
+
37
+ - name: Pyright type checking
38
+ run: |
39
+ python -m pip install pyright
40
+ pyright src
41
+
42
+ - name: Run tests with coverage
43
+ timeout-minutes: 15
44
+ run: |
45
+ python -m pip install pytest pytest-cov pytest-timeout
46
+ pytest tests --cov=src/lode --cov-report=term-missing --timeout=30
47
+
48
+ - name: Build package
49
+ run: |
50
+ python -m pip install build
51
+ python -m build
52
+
53
+ - name: Upload coverage to Codecov
54
+ uses: codecov/codecov-action@v3
55
+ with:
56
+ files: ./coverage.xml
57
+ fail_ci_if_error: false
@@ -0,0 +1,75 @@
1
+ name: Publish to PyPI and GHCR
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+
8
+ jobs:
9
+ build-and-publish:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+ packages: write
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v4
20
+ with:
21
+ python-version: '3.11'
22
+
23
+ - name: Install build dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install build twine
27
+
28
+ - name: Build distribution
29
+ run: python -m build
30
+
31
+ - name: Verify with twine
32
+ run: twine check dist/*
33
+
34
+ - name: Publish to PyPI
35
+ uses: pypa/gh-action-pypi-publish@release/v1
36
+ with:
37
+ password: ${{ secrets.PYPI_API_TOKEN }}
38
+ skip-existing: true
39
+
40
+ - name: Set up Docker Buildx
41
+ uses: docker/setup-buildx-action@v2
42
+
43
+ - name: Log in to GitHub Container Registry
44
+ uses: docker/login-action@v2
45
+ with:
46
+ registry: ghcr.io
47
+ username: ${{ github.actor }}
48
+ password: ${{ secrets.GITHUB_TOKEN }}
49
+
50
+ - name: Extract metadata
51
+ id: meta
52
+ uses: docker/metadata-action@v4
53
+ with:
54
+ images: ghcr.io/${{ github.repository }}
55
+ tags: |
56
+ type=semver,pattern={{version}}
57
+ type=semver,pattern={{major}}.{{minor}}
58
+ type=ref,event=branch
59
+ type=sha
60
+
61
+ - name: Build and push Docker image
62
+ uses: docker/build-push-action@v4
63
+ with:
64
+ context: .
65
+ push: true
66
+ tags: ${{ steps.meta.outputs.tags }}
67
+ labels: ${{ steps.meta.outputs.labels }}
68
+
69
+ - name: Create Release
70
+ uses: softprops/action-gh-release@v1
71
+ with:
72
+ files: dist/*
73
+ generate_release_notes: true
74
+ env:
75
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,63 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ pip-wheel-metadata/
20
+ share/python-wheels/
21
+ *.egg-info/
22
+ .installed.cfg
23
+ *.egg
24
+ MANIFEST
25
+
26
+ # Testing
27
+ .pytest_cache/
28
+ .coverage
29
+ htmlcov/
30
+ .tox/
31
+ .hypothesis/
32
+
33
+ # IDEs
34
+ .vscode/
35
+ .idea/
36
+ *.swp
37
+ *.swo
38
+ *~
39
+ .DS_Store
40
+
41
+ # Environment
42
+ .env
43
+ .venv
44
+ venv/
45
+ ENV/
46
+ env/
47
+
48
+ # Build & distribution
49
+ build/
50
+ dist/
51
+ *.egg-info/
52
+
53
+ # Trace & storage artifacts
54
+ *.db
55
+ *.db-wal
56
+ *.db-shm
57
+ traces/
58
+ exports/
59
+
60
+ # Web UI
61
+ web_ui/node_modules/
62
+ web_ui/dist/
63
+ web_ui/.env.local
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,141 @@
1
+ # Changelog
2
+
3
+ All notable changes to Lode are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Execution DAG tracing for multi-agent workflows
13
+ - Hierarchical span tracking with parent-child relationships
14
+ - Token cost aggregation per model, provider, and agent step
15
+ - Cycle detection for infinite loops in agent execution
16
+ - Context window saturation tracking
17
+ - Latency profiling with anomaly detection (>5s threshold)
18
+ - Local embedded web UI for DAG visualization and waterfall breakdown
19
+ - SQLite-based trace persistence with queryable span metadata
20
+ - JSON/YAML export for offline analysis
21
+ - Assay test suite export for reproducible debugging
22
+ - Python decorators: `@trace_agent`, `@trace_tool`, context managers
23
+ - Typer-based CLI: `lode export`, `lode inspect` (UI via OTEL/Jaeger)
24
+ - FastAPI server for interactive trace visualization
25
+ - Non-blocking async ring buffer for span buffering
26
+ - OpenTelemetry compatibility (API/SDK)
27
+ - Configuration via environment variables
28
+ - Support for custom instrumentation hooks
29
+ - Comprehensive documentation and examples
30
+
31
+ ## [0.1.0-dev] - 2026-09-12
32
+
33
+ ### Initial Release (Alpha MVP)
34
+
35
+ **Status**: Early-stage alpha release for community feedback
36
+
37
+ ### Features
38
+
39
+ **Instrumentation:**
40
+ - ✅ Zero-overhead Python decorators for agent and tool tracing
41
+ - ✅ Auto-instrumentation hooks framework (OpenAI, LiteLLM planned)
42
+ - ✅ Hierarchical span tracking with full context capture
43
+ - ✅ Context manager API for manual instrumentation
44
+
45
+ **Analysis:**
46
+ - ✅ DAG assembly from flat span streams
47
+ - ✅ Token cost aggregation with precise USD calculations
48
+ - ✅ Cycle and loop detection (>5 repeats)
49
+ - ✅ Context window saturation tracking
50
+ - ✅ Latency profiling and bottleneck identification
51
+
52
+ **Visualization & Export:**
53
+ - ✅ Local embedded web UI (interactive DAG, waterfall, inspection)
54
+ - ✅ SQLite storage backend
55
+ - ✅ JSON/YAML export
56
+ - ✅ Assay test suite export
57
+
58
+ **Developer Experience:**
59
+ - ✅ Typer-based CLI with intuitive commands
60
+ - ✅ FastAPI server for web UI
61
+ - ✅ Configuration via Python API and environment variables
62
+ - ✅ <0.5ms instrumentation overhead
63
+
64
+ ### Known Limitations
65
+
66
+ - Web UI is basic MVP (no real-time updates yet)
67
+ - Auto-instrumentation hooks are stubs (implementation in Phase 2)
68
+ - SQLite storage backend is single-node only
69
+ - No cloud sync (Phase 2 feature)
70
+ - No distributed tracing across service boundaries (Phase 2)
71
+
72
+ ### Architecture
73
+
74
+ - **Functional Core / Imperative Shell** separation
75
+ - **Immutable domain types** using Pydantic
76
+ - **Pure functions** for all analysis logic
77
+ - **Non-blocking async** for I/O operations
78
+
79
+ ### Dependencies
80
+
81
+ - `typer` — CLI framework
82
+ - `pydantic` — Data validation & serialization
83
+ - `opentelemetry-api/sdk` — Telemetry standard
84
+ - `fastapi` + `uvicorn` — Web server
85
+ - `pyyaml` — Configuration
86
+
87
+ ### Documentation
88
+
89
+ - README with problem statement, quick start, features
90
+ - Architecture decision records (ADRs)
91
+ - Development workflow guide
92
+ - Type hints throughout codebase
93
+
94
+ ### Testing
95
+
96
+ - 335 lines of functional core tests
97
+ - Coverage: ~30-40% (expanded in Phase 2)
98
+ - Test matrix: Python 3.11, 3.12
99
+
100
+ ### CI/CD
101
+
102
+ - GitHub Actions for testing (ruff, pyright, pytest)
103
+ - Publication workflows (PyPI, GHCR Docker registry)
104
+ - Codecov integration for coverage tracking
105
+
106
+ ### Project Status
107
+
108
+ - **Code Quality**: ✅ Solid architecture, clean separation of concerns
109
+ - **Production Ready**: ⚠️ MVP stage, missing governance files & PyPI/Docker publication
110
+ - **Community**: 🟡 Early-stage, accepting feedback & contributions
111
+ - **Roadmap**: Phase 2 (cloud sync, OTLP), Phase 3 (enterprise features)
112
+
113
+ ---
114
+
115
+ ## Roadmap
116
+
117
+ ### Phase 2: Cloud Enablement (TBD)
118
+ - Asynchronous cloud sync
119
+ - Shareable trace URLs
120
+ - Automated cycle interceptor
121
+ - OpenTelemetry OTLP exporter
122
+
123
+ ### Phase 3: Enterprise (TBD)
124
+ - ClickHouse backend for high-throughput
125
+ - Automated PII scrubber
126
+ - Private VPC Kubernetes deployments
127
+ - SSO/RBAC support
128
+
129
+ ---
130
+
131
+ ## Contributing
132
+
133
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and contribution workflow.
134
+
135
+ ## License
136
+
137
+ [MIT License](LICENSE) — See LICENSE file for details.
138
+
139
+ ---
140
+
141
+ **Questions?** Check the [GitHub Discussions](https://github.com/CraftedWithIntent/lode/discussions) or open an issue.
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [hello@craftedwithintent.ai](mailto:hello@craftedwithintent.ai).
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.