autobots-devtools-shared-lib 0.1.6__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. autobots_devtools_shared_lib-0.2.0/PKG-INFO +237 -0
  2. autobots_devtools_shared_lib-0.2.0/README.md +206 -0
  3. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/pyproject.toml +2 -2
  4. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/observability/__init__.py +4 -4
  5. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/observability/logging_utils.py +15 -19
  6. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/observability/otel_fastapi.py +5 -5
  7. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/observability/trace_propagation.py +4 -4
  8. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/servers/fileserver/app.py +6 -6
  9. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/servers/fileserver/models.py +9 -9
  10. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/services/__init__.py +6 -0
  11. autobots_devtools_shared_lib-0.2.0/src/autobots_devtools_shared_lib/common/services/context/README.md +175 -0
  12. autobots_devtools_shared_lib-0.2.0/src/autobots_devtools_shared_lib/common/services/context/__init__.py +39 -0
  13. autobots_devtools_shared_lib-0.2.0/src/autobots_devtools_shared_lib/common/services/context/cache_backed.py +45 -0
  14. autobots_devtools_shared_lib-0.2.0/src/autobots_devtools_shared_lib/common/services/context/db_repository.py +20 -0
  15. autobots_devtools_shared_lib-0.2.0/src/autobots_devtools_shared_lib/common/services/context/factory.py +143 -0
  16. autobots_devtools_shared_lib-0.2.0/src/autobots_devtools_shared_lib/common/services/context/in_memory.py +29 -0
  17. autobots_devtools_shared_lib-0.2.0/src/autobots_devtools_shared_lib/common/services/context/redis_store.py +62 -0
  18. autobots_devtools_shared_lib-0.2.0/src/autobots_devtools_shared_lib/common/services/context/store.py +26 -0
  19. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/tools/format_tools.py +6 -6
  20. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/utils/format_utils.py +25 -1
  21. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/utils/fserver_client_utils.py +5 -5
  22. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/agents/batch.py +56 -19
  23. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/agents/invocation_utils.py +31 -26
  24. autobots_devtools_shared_lib-0.1.6/PKG-INFO +0 -249
  25. autobots_devtools_shared_lib-0.1.6/README.md +0 -219
  26. autobots_devtools_shared_lib-0.1.6/src/autobots_devtools_shared_lib/common/services/context.py +0 -227
  27. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/__init__.py +0 -0
  28. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/__init__.py +0 -0
  29. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/observability/trace_metadata.py +0 -0
  30. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/observability/tracing.py +0 -0
  31. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/servers/__init__.py +0 -0
  32. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/servers/fileserver/README.md +0 -0
  33. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/servers/fileserver/__init__.py +0 -0
  34. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/servers/fileserver/config.py +0 -0
  35. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/tools/__init__.py +0 -0
  36. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/tools/context_tools.py +0 -0
  37. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/tools/fserver_client_tools.py +0 -0
  38. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/utils/__init__.py +0 -0
  39. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/common/utils/context_utils.py +0 -0
  40. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/__init__.py +0 -0
  41. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/agents/__init__.py +0 -0
  42. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/agents/agent_config_utils.py +0 -0
  43. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/agents/agent_meta.py +0 -0
  44. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/agents/base_agent.py +0 -0
  45. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/agents/middleware.py +0 -0
  46. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/config/__init__.py +0 -0
  47. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/config/dynagent_settings.py +0 -0
  48. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/llm/__init__.py +0 -0
  49. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/llm/llm.py +0 -0
  50. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/models/__init__.py +0 -0
  51. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/models/state.py +0 -0
  52. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/services/__init__.py +0 -0
  53. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/services/structured_converter.py +0 -0
  54. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/tools/__init__.py +0 -0
  55. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/tools/state_tools.py +0 -0
  56. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/tools/tool_registry.py +0 -0
  57. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/ui/__init__.py +0 -0
  58. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/ui/default_ui.py +0 -0
  59. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/ui/ui_utils.py +0 -0
  60. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/dynagent/utils/__init__.py +0 -0
  61. {autobots_devtools_shared_lib-0.1.6 → autobots_devtools_shared_lib-0.2.0}/src/autobots_devtools_shared_lib/py.typed +0 -0
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.4
2
+ Name: autobots-devtools-shared-lib
3
+ Version: 0.2.0
4
+ Summary: Shared library functions to be used for all autobots projects
5
+ License: MIT
6
+ Author: Pralhad
7
+ Author-email: pralhad.kamath@pratishthanventures.com
8
+ Requires-Python: >=3.12,<4.0.0
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Requires-Dist: chainlit (>=2.9.6)
15
+ Requires-Dist: fastapi (>=0.115.0)
16
+ Requires-Dist: jsonschema (>=4.26.0)
17
+ Requires-Dist: langchain (>=1.0.0)
18
+ Requires-Dist: langchain-anthropic (>=0.3.0)
19
+ Requires-Dist: langchain-google-genai (>=4.2.0)
20
+ Requires-Dist: langfuse (>=3.12.1)
21
+ Requires-Dist: opentelemetry-api (>=1.30.0,<2.0.0)
22
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.30.0,<2.0.0)
23
+ Requires-Dist: opentelemetry-instrumentation-fastapi (>=0.49b0)
24
+ Requires-Dist: opentelemetry-sdk (>=1.30.0,<2.0.0)
25
+ Requires-Dist: pydantic-settings (>=2.10.1)
26
+ Requires-Dist: python-dotenv (>=1.1.1)
27
+ Requires-Dist: pyyaml (>=6.0.3)
28
+ Requires-Dist: uvicorn[standard] (>=0.32.0)
29
+ Description-Content-Type: text/markdown
30
+
31
+ # Autobots DevTools Shared Library
32
+
33
+ **Dyn**amic **Agent** (**Dynagent**) is the core of this library. It turns your prompts and business processes into production-ready, multi-agent applications—chatbots and unsupervised workflows—in hours. You focus on prompts, output schemas, and domain logic; Dynagent handles multi-LLM wiring, UI integration, observability, and batch processing out of the box.
34
+
35
+ ### Essential features
36
+
37
+ | Feature | Description |
38
+ | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
39
+ | **Dynagent framework** | Build dynamic AI agents with YAML configs, prompts, and tools. Agent handoff and default/coordinator agents for mesh-style flows. |
40
+ | **Multi-LLM support** | Swap LLMs like swapping batteries. Use Gemini, Claude, or others via a single integration layer. |
41
+ | **Chainlit UI** | Pre-built streaming, tool steps, and structured output for Chainlit. OAuth-ready. |
42
+ | **State & context** | Session state and context management with caching and durable storage. Tools receive `ToolRuntime` with shared state across handoffs. |
43
+ | **Batch processing** | Run prompts in parallel for batch-enabled agents. Sync API with `batch_invoker` and `BatchResult`. |
44
+ | **Observability** | Langfuse integration for tracing and monitoring. `TraceMetadata` for session, app, and tags. |
45
+ | **Pythonic** | Native Python and LangChain tools. Type hints, async/sync, pytest—no DSLs. |
46
+ | **Extensible** | File server, workspace management, Jenkins integration, and helpers that plug into the framework. |
47
+ | **Containerization** | Docker images with bundled dependencies for consistent deployment. |
48
+ | **Prompt versioning** | Prompts as source — version-controlled markdown files alongside code. |
49
+ | **Prompt evaluation** | Tooling to tweak and evaluate prompt quality across versions. |
50
+
51
+ ### Batteries included
52
+
53
+ | Helper | Description |
54
+ | ------ | ----------- |
55
+ | **File server** | Serve and manage files within agent sessions. |
56
+ | **Workspace management** | Manage working directories and session artifacts. |
57
+ | **Context management** | Caching and durable storage for session context. |
58
+ | **Jenkins integration** | Trigger and monitor Jenkins pipelines from agents. |
59
+
60
+ ## Quickstart
61
+
62
+ | Guide | Description |
63
+ | ------ | ----------- |
64
+ | **[Try Jarvis](https://github.com/Pratishthan/autobots-agents-jarvis)** | See Dynagent in action with a multi-domain multi-agent demo (Concierge, Customer Support, Sales). |
65
+ | **[Install](#workspace-setup)** | Set up the shared workspace, virtual environment, and install this library. |
66
+ | **[Development](#development)** | Run tests, format, lint, type-check, and use the Makefile from this repo or the workspace root. |
67
+
68
+ ## How-to guides
69
+
70
+ | Guide | Description |
71
+ | ------ | ----------- |
72
+ | **[Workspace setup](#workspace-setup)** | Clone the workspace, create the shared `.venv`, clone this repo, and install dependencies. |
73
+ | **[Development](#development)** | Available `make` targets: test, format, lint, type-check, install, build, clean. |
74
+ | **[Project structure](#project-structure)** | Layout of `autobots_devtools_shared_lib` (dynagent, chainlit_ui, llm_tools, observability, batch). |
75
+ | **[Testing](#testing)** | Unit, integration, and e2e tests. Run with `make test`, `make test-fast`, or `make test-one`. |
76
+ | **[Contributing](#contributing)** | See CONTRIBUTING.md for guidelines and workflow. |
77
+ | **[Publishing](#publishing)** | See PUBLISHING.md for PyPI publishing. |
78
+
79
+ ## Advanced
80
+
81
+ | Topic | Description |
82
+ | ------ | ----------- |
83
+ | **[Code quality](#code-quality-standards)** | Type safety (Pyright), pytest, Ruff format/lint, pre-commit hooks. |
84
+ | **[Type checking](#type-checking)** | Pyright in basic mode; type annotations required. |
85
+ | **[Workspace commands](#workspace-level-commands)** | From workspace root: `make test`, `make lint`, `make format`, `make type-check`, `make all-checks` across all repos. |
86
+
87
+ ---
88
+
89
+ ## Workspace setup
90
+
91
+ This library is part of a multi-repository workspace. Use a shared virtual environment at the workspace root.
92
+
93
+ **Prerequisites:** Python 3.12+, Poetry (e.g. `brew install poetry` on macOS).
94
+
95
+ ### 1. Clone the workspace
96
+
97
+ ```bash
98
+ cd /path/to/your/work
99
+ git clone <workspace-url> ws-jarvis
100
+ cd ws-jarvis
101
+ ```
102
+
103
+ ### 2. Create shared virtual environment
104
+
105
+ ```bash
106
+ make setup
107
+ ```
108
+
109
+ This creates a shared `.venv` at the workspace root.
110
+
111
+ ### 3. Clone this repository
112
+
113
+ ```bash
114
+ git clone https://github.com/Pratishthan/autobots-devtools-shared-lib.git
115
+ cd autobots-devtools-shared-lib
116
+ ```
117
+
118
+ ### 4. Install dependencies
119
+
120
+ ```bash
121
+ make install-dev # with dev dependencies (recommended)
122
+ # or
123
+ make install # runtime only
124
+ ```
125
+
126
+ ### 5. Pre-commit hooks
127
+
128
+ ```bash
129
+ make install-hooks
130
+ ```
131
+
132
+ ## Development
133
+
134
+ Run from `autobots-devtools-shared-lib/`:
135
+
136
+ ```bash
137
+ # Testing
138
+ make test # with coverage
139
+ make test-fast # no coverage
140
+ make test-one TEST=tests/unit/test_example.py::test_function
141
+
142
+ # Code quality
143
+ make format # Ruff format
144
+ make lint # Ruff lint (auto-fix)
145
+ make check-format # check only
146
+ make type-check # Pyright
147
+ make all-checks # format, type, test
148
+
149
+ # Dependencies & build
150
+ make install / make install-dev / make update-deps
151
+ make build
152
+ make clean
153
+ make help
154
+ ```
155
+
156
+ ### Workspace-level commands
157
+
158
+ From the workspace root:
159
+
160
+ ```bash
161
+ make test
162
+ make lint
163
+ make format
164
+ make type-check
165
+ make all-checks
166
+ ```
167
+
168
+ ## Project structure
169
+
170
+ ```
171
+ autobots-devtools-shared-lib/
172
+ ├── src/autobots_devtools_shared_lib/
173
+ │ ├── dynagent/ # Multi-agent framework
174
+ │ ├── chainlit_ui/ # Chainlit UI components
175
+ │ ├── llm_tools/ # LLM integrations
176
+ │ ├── observability/ # Observability helpers
177
+ │ └── batch_processing/ # Batch utilities
178
+ ├── tests/
179
+ │ ├── unit/
180
+ │ ├── integration/
181
+ │ └── e2e/
182
+ ├── .github/workflows/
183
+ ├── pyproject.toml
184
+ ├── poetry.toml # Poetry settings (uses workspace .venv)
185
+ ├── Makefile
186
+ ├── CONTRIBUTING.md
187
+ └── PUBLISHING.md
188
+ ```
189
+
190
+ ## Code quality standards
191
+
192
+ - **Type safety:** Type annotations; Pyright (basic mode).
193
+ - **Testing:** pytest; unit, integration, e2e.
194
+ - **Formatting:** Ruff, line length 100.
195
+ - **Linting:** Ruff, strict rules.
196
+ - **Pre-commit:** Format, lint, type-check, tests on commit.
197
+
198
+ ## Testing
199
+
200
+ ```bash
201
+ make test
202
+ make test-one TEST=tests/unit/test_example.py
203
+ make test-cov # HTML coverage report
204
+ ```
205
+
206
+ - **Unit** (`tests/unit/`): Functions and classes.
207
+ - **Integration** (`tests/integration/`): Component interactions.
208
+ - **E2E** (`tests/e2e/`): Full workflows.
209
+
210
+ ## Type checking
211
+
212
+ ```bash
213
+ make type-check
214
+ ```
215
+
216
+ All code must have type annotations. Pyright runs in basic mode.
217
+
218
+ ## Contributing
219
+
220
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development workflow and guidelines.
221
+
222
+ ## Publishing
223
+
224
+ See [PUBLISHING.md](PUBLISHING.md) for PyPI publishing.
225
+
226
+ ## License
227
+
228
+ MIT
229
+
230
+ ## Authors
231
+
232
+ - **Pra1had** — [GitHub](https://github.com/pra1had) · pralhad.kamath@pratishthanventures.com
233
+
234
+ ## Questions?
235
+
236
+ Open an issue on the project repository.
237
+
@@ -0,0 +1,206 @@
1
+ # Autobots DevTools Shared Library
2
+
3
+ **Dyn**amic **Agent** (**Dynagent**) is the core of this library. It turns your prompts and business processes into production-ready, multi-agent applications—chatbots and unsupervised workflows—in hours. You focus on prompts, output schemas, and domain logic; Dynagent handles multi-LLM wiring, UI integration, observability, and batch processing out of the box.
4
+
5
+ ### Essential features
6
+
7
+ | Feature | Description |
8
+ | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
9
+ | **Dynagent framework** | Build dynamic AI agents with YAML configs, prompts, and tools. Agent handoff and default/coordinator agents for mesh-style flows. |
10
+ | **Multi-LLM support** | Swap LLMs like swapping batteries. Use Gemini, Claude, or others via a single integration layer. |
11
+ | **Chainlit UI** | Pre-built streaming, tool steps, and structured output for Chainlit. OAuth-ready. |
12
+ | **State & context** | Session state and context management with caching and durable storage. Tools receive `ToolRuntime` with shared state across handoffs. |
13
+ | **Batch processing** | Run prompts in parallel for batch-enabled agents. Sync API with `batch_invoker` and `BatchResult`. |
14
+ | **Observability** | Langfuse integration for tracing and monitoring. `TraceMetadata` for session, app, and tags. |
15
+ | **Pythonic** | Native Python and LangChain tools. Type hints, async/sync, pytest—no DSLs. |
16
+ | **Extensible** | File server, workspace management, Jenkins integration, and helpers that plug into the framework. |
17
+ | **Containerization** | Docker images with bundled dependencies for consistent deployment. |
18
+ | **Prompt versioning** | Prompts as source — version-controlled markdown files alongside code. |
19
+ | **Prompt evaluation** | Tooling to tweak and evaluate prompt quality across versions. |
20
+
21
+ ### Batteries included
22
+
23
+ | Helper | Description |
24
+ | ------ | ----------- |
25
+ | **File server** | Serve and manage files within agent sessions. |
26
+ | **Workspace management** | Manage working directories and session artifacts. |
27
+ | **Context management** | Caching and durable storage for session context. |
28
+ | **Jenkins integration** | Trigger and monitor Jenkins pipelines from agents. |
29
+
30
+ ## Quickstart
31
+
32
+ | Guide | Description |
33
+ | ------ | ----------- |
34
+ | **[Try Jarvis](https://github.com/Pratishthan/autobots-agents-jarvis)** | See Dynagent in action with a multi-domain multi-agent demo (Concierge, Customer Support, Sales). |
35
+ | **[Install](#workspace-setup)** | Set up the shared workspace, virtual environment, and install this library. |
36
+ | **[Development](#development)** | Run tests, format, lint, type-check, and use the Makefile from this repo or the workspace root. |
37
+
38
+ ## How-to guides
39
+
40
+ | Guide | Description |
41
+ | ------ | ----------- |
42
+ | **[Workspace setup](#workspace-setup)** | Clone the workspace, create the shared `.venv`, clone this repo, and install dependencies. |
43
+ | **[Development](#development)** | Available `make` targets: test, format, lint, type-check, install, build, clean. |
44
+ | **[Project structure](#project-structure)** | Layout of `autobots_devtools_shared_lib` (dynagent, chainlit_ui, llm_tools, observability, batch). |
45
+ | **[Testing](#testing)** | Unit, integration, and e2e tests. Run with `make test`, `make test-fast`, or `make test-one`. |
46
+ | **[Contributing](#contributing)** | See CONTRIBUTING.md for guidelines and workflow. |
47
+ | **[Publishing](#publishing)** | See PUBLISHING.md for PyPI publishing. |
48
+
49
+ ## Advanced
50
+
51
+ | Topic | Description |
52
+ | ------ | ----------- |
53
+ | **[Code quality](#code-quality-standards)** | Type safety (Pyright), pytest, Ruff format/lint, pre-commit hooks. |
54
+ | **[Type checking](#type-checking)** | Pyright in basic mode; type annotations required. |
55
+ | **[Workspace commands](#workspace-level-commands)** | From workspace root: `make test`, `make lint`, `make format`, `make type-check`, `make all-checks` across all repos. |
56
+
57
+ ---
58
+
59
+ ## Workspace setup
60
+
61
+ This library is part of a multi-repository workspace. Use a shared virtual environment at the workspace root.
62
+
63
+ **Prerequisites:** Python 3.12+, Poetry (e.g. `brew install poetry` on macOS).
64
+
65
+ ### 1. Clone the workspace
66
+
67
+ ```bash
68
+ cd /path/to/your/work
69
+ git clone <workspace-url> ws-jarvis
70
+ cd ws-jarvis
71
+ ```
72
+
73
+ ### 2. Create shared virtual environment
74
+
75
+ ```bash
76
+ make setup
77
+ ```
78
+
79
+ This creates a shared `.venv` at the workspace root.
80
+
81
+ ### 3. Clone this repository
82
+
83
+ ```bash
84
+ git clone https://github.com/Pratishthan/autobots-devtools-shared-lib.git
85
+ cd autobots-devtools-shared-lib
86
+ ```
87
+
88
+ ### 4. Install dependencies
89
+
90
+ ```bash
91
+ make install-dev # with dev dependencies (recommended)
92
+ # or
93
+ make install # runtime only
94
+ ```
95
+
96
+ ### 5. Pre-commit hooks
97
+
98
+ ```bash
99
+ make install-hooks
100
+ ```
101
+
102
+ ## Development
103
+
104
+ Run from `autobots-devtools-shared-lib/`:
105
+
106
+ ```bash
107
+ # Testing
108
+ make test # with coverage
109
+ make test-fast # no coverage
110
+ make test-one TEST=tests/unit/test_example.py::test_function
111
+
112
+ # Code quality
113
+ make format # Ruff format
114
+ make lint # Ruff lint (auto-fix)
115
+ make check-format # check only
116
+ make type-check # Pyright
117
+ make all-checks # format, type, test
118
+
119
+ # Dependencies & build
120
+ make install / make install-dev / make update-deps
121
+ make build
122
+ make clean
123
+ make help
124
+ ```
125
+
126
+ ### Workspace-level commands
127
+
128
+ From the workspace root:
129
+
130
+ ```bash
131
+ make test
132
+ make lint
133
+ make format
134
+ make type-check
135
+ make all-checks
136
+ ```
137
+
138
+ ## Project structure
139
+
140
+ ```
141
+ autobots-devtools-shared-lib/
142
+ ├── src/autobots_devtools_shared_lib/
143
+ │ ├── dynagent/ # Multi-agent framework
144
+ │ ├── chainlit_ui/ # Chainlit UI components
145
+ │ ├── llm_tools/ # LLM integrations
146
+ │ ├── observability/ # Observability helpers
147
+ │ └── batch_processing/ # Batch utilities
148
+ ├── tests/
149
+ │ ├── unit/
150
+ │ ├── integration/
151
+ │ └── e2e/
152
+ ├── .github/workflows/
153
+ ├── pyproject.toml
154
+ ├── poetry.toml # Poetry settings (uses workspace .venv)
155
+ ├── Makefile
156
+ ├── CONTRIBUTING.md
157
+ └── PUBLISHING.md
158
+ ```
159
+
160
+ ## Code quality standards
161
+
162
+ - **Type safety:** Type annotations; Pyright (basic mode).
163
+ - **Testing:** pytest; unit, integration, e2e.
164
+ - **Formatting:** Ruff, line length 100.
165
+ - **Linting:** Ruff, strict rules.
166
+ - **Pre-commit:** Format, lint, type-check, tests on commit.
167
+
168
+ ## Testing
169
+
170
+ ```bash
171
+ make test
172
+ make test-one TEST=tests/unit/test_example.py
173
+ make test-cov # HTML coverage report
174
+ ```
175
+
176
+ - **Unit** (`tests/unit/`): Functions and classes.
177
+ - **Integration** (`tests/integration/`): Component interactions.
178
+ - **E2E** (`tests/e2e/`): Full workflows.
179
+
180
+ ## Type checking
181
+
182
+ ```bash
183
+ make type-check
184
+ ```
185
+
186
+ All code must have type annotations. Pyright runs in basic mode.
187
+
188
+ ## Contributing
189
+
190
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development workflow and guidelines.
191
+
192
+ ## Publishing
193
+
194
+ See [PUBLISHING.md](PUBLISHING.md) for PyPI publishing.
195
+
196
+ ## License
197
+
198
+ MIT
199
+
200
+ ## Authors
201
+
202
+ - **Pra1had** — [GitHub](https://github.com/pra1had) · pralhad.kamath@pratishthanventures.com
203
+
204
+ ## Questions?
205
+
206
+ Open an issue on the project repository.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "autobots-devtools-shared-lib"
3
- version = "0.1.6"
3
+ version = "0.2.0"
4
4
  description = "Shared library functions to be used for all autobots projects"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -10,6 +10,7 @@ license = {text = "MIT"}
10
10
  requires-python = ">=3.12,<4.0.0"
11
11
  dependencies = [
12
12
  "chainlit>=2.9.6",
13
+ "jsonschema>=4.26.0",
13
14
  "langchain>=1.0.0",
14
15
  "langchain-anthropic>=0.3.0",
15
16
  "langchain-google-genai>=4.2.0",
@@ -31,7 +32,6 @@ dev = [
31
32
  "pytest-asyncio>=1.3.0",
32
33
  "pytest-cov>=7.0.0",
33
34
  "ruff>=0.14.14",
34
- "poetry>=2.3.2",
35
35
  ]
36
36
 
37
37
  [tool.poetry]
@@ -2,11 +2,11 @@
2
2
  # ABOUTME: Provides Langfuse integration for LLM tracing and monitoring.
3
3
 
4
4
  from autobots_devtools_shared_lib.common.observability.logging_utils import (
5
- ConversationFilter,
5
+ SessionFilter,
6
6
  get_agent_logger,
7
7
  get_logger,
8
- set_conversation_id,
9
8
  set_log_level,
9
+ set_session_id,
10
10
  setup_logging,
11
11
  )
12
12
  from autobots_devtools_shared_lib.common.observability.trace_metadata import TraceMetadata
@@ -17,14 +17,14 @@ from autobots_devtools_shared_lib.common.observability.tracing import (
17
17
  )
18
18
 
19
19
  __all__ = [
20
- "ConversationFilter",
20
+ "SessionFilter",
21
21
  "TraceMetadata",
22
22
  "flush_tracing",
23
23
  "get_agent_logger",
24
24
  "get_langfuse_handler",
25
25
  "get_logger",
26
26
  "init_tracing",
27
- "set_conversation_id",
28
27
  "set_log_level",
28
+ "set_session_id",
29
29
  "setup_logging",
30
30
  ]
@@ -8,33 +8,31 @@ LogLevelLike = int | str
8
8
  _logging_configured: bool = False
9
9
 
10
10
 
11
- class ConversationFilter(logging.Filter):
11
+ class SessionFilter(logging.Filter):
12
12
  """
13
- Inject a conversation/thread identifier into every log record.
13
+ Inject a session identifier into every log record.
14
14
 
15
- This enables log format strings to include `%(conversation_id)s`
16
- for tracing multi-message conversations across threads/tasks.
15
+ This enables log format strings to include `%(session_id)s`
16
+ for tracing multi-message sessions across threads/tasks.
17
17
  """
18
18
 
19
19
  def filter(self, record: logging.LogRecord) -> bool: # type: ignore[override]
20
- record.conversation_id = _conversation_id_var.get()
20
+ record.session_id = _session_id_var.get()
21
21
  return True
22
22
 
23
23
 
24
- # Thread-safe context for the current conversation/thread id.
25
- _conversation_id_var: ContextVar[str] = ContextVar(
26
- "conversation_id", default="default-conversation-id"
27
- )
24
+ # Thread-safe context for the current session/thread id.
25
+ _session_id_var: ContextVar[str] = ContextVar("session_id", default="default-session-id")
28
26
 
29
27
 
30
- def set_conversation_id(thread_id: str) -> None:
28
+ def set_session_id(session_id: str) -> None:
31
29
  """
32
- Set the conversation/thread identifier for the current context.
30
+ Set the session/thread identifier for the current context.
33
31
 
34
32
  Args:
35
- thread_id: Identifier for the current conversation/thread.
33
+ session_id: Identifier for the current session/thread.
36
34
  """
37
- _conversation_id_var.set(thread_id)
35
+ _session_id_var.set(session_id)
38
36
 
39
37
 
40
38
  def _parse_log_level(level: LogLevelLike | None) -> int:
@@ -84,7 +82,7 @@ def setup_logging(
84
82
 
85
83
  Args:
86
84
  level: Explicit log level (int or name like "DEBUG").
87
- fmt: Log format string. If omitted, a default including conversation_id is used.
85
+ fmt: Log format string. If omitted, a default including session_id is used.
88
86
  force: If True, reconfigure logging even if it was already configured.
89
87
  """
90
88
  global _logging_configured
@@ -96,10 +94,8 @@ def setup_logging(
96
94
  env_level = os.getenv("LOG_LEVEL")
97
95
  effective_level = _parse_log_level(level if level is not None else env_level)
98
96
 
99
- # Default format includes conversation/thread context
100
- log_format = fmt or (
101
- "%(asctime)s - %(name)s - [%(conversation_id)s] - %(levelname)s - %(message)s"
102
- )
97
+ # Default format includes session/thread context
98
+ log_format = fmt or ("%(asctime)s - %(name)s - [%(session_id)s] - %(levelname)s - %(message)s")
103
99
 
104
100
  root_logger = logging.getLogger()
105
101
 
@@ -113,7 +109,7 @@ def setup_logging(
113
109
  handler = logging.StreamHandler(sys.stdout)
114
110
  handler.setLevel(effective_level)
115
111
  handler.setFormatter(logging.Formatter(log_format))
116
- handler.addFilter(ConversationFilter())
112
+ handler.addFilter(SessionFilter())
117
113
 
118
114
  root_logger.addHandler(handler)
119
115
 
@@ -40,7 +40,7 @@ def _configure_langfuse_otlp() -> bool:
40
40
  sk = os.getenv("LANGFUSE_SECRET_KEY", "").strip()
41
41
  if not pk or not sk:
42
42
  return False
43
- host = os.getenv("LANGFUSE_BASE_URL")
43
+ host = os.getenv("LANGFUSE_HOST")
44
44
  endpoint = f"{host}/api/public/otel"
45
45
  auth = base64.b64encode(f"{pk}:{sk}".encode()).decode()
46
46
  os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = endpoint
@@ -257,11 +257,11 @@ def instrument_fastapi(app: FastAPI) -> bool:
257
257
 
258
258
  try:
259
259
  from opentelemetry import trace
260
- from opentelemetry.exporter.otlp.proto.http.trace_exporter import ( # pyright: ignore[reportMissingImports]
261
- OTLPSpanExporter,
260
+ from opentelemetry.exporter.otlp.proto.http.trace_exporter import (
261
+ OTLPSpanExporter, # pyright: ignore[reportMissingImports]
262
262
  )
263
- from opentelemetry.instrumentation.fastapi import ( # pyright: ignore[reportMissingImports]
264
- FastAPIInstrumentor,
263
+ from opentelemetry.instrumentation.fastapi import (
264
+ FastAPIInstrumentor, # pyright: ignore[reportMissingImports]
265
265
  )
266
266
  from opentelemetry.propagate import set_global_textmap
267
267
  from opentelemetry.sdk.resources import Resource
@@ -2,7 +2,7 @@
2
2
  OpenTelemetry trace propagation helpers for HTTP client calls.
3
3
 
4
4
  Provides W3C traceparent header injection and session linking for fileserver HTTP calls.
5
- Reuses Langfuse configuration (LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_BASE_URL).
5
+ Reuses Langfuse configuration (LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_HOST).
6
6
  """
7
7
 
8
8
  from __future__ import annotations
@@ -43,8 +43,8 @@ def _ensure_tracer_provider() -> bool:
43
43
  try:
44
44
  # Check if OTEL packages available
45
45
  from opentelemetry import trace
46
- from opentelemetry.exporter.otlp.proto.http.trace_exporter import ( # pyright: ignore[reportMissingImports]
47
- OTLPSpanExporter,
46
+ from opentelemetry.exporter.otlp.proto.http.trace_exporter import (
47
+ OTLPSpanExporter, # pyright: ignore[reportMissingImports]
48
48
  )
49
49
  from opentelemetry.sdk.resources import Resource
50
50
  from opentelemetry.sdk.trace import TracerProvider
@@ -80,7 +80,7 @@ def _ensure_tracer_provider() -> bool:
80
80
 
81
81
  try:
82
82
  # Configure OTLP endpoint (same pattern as otel_fastapi.py)
83
- host = os.getenv("LANGFUSE_BASE_URL", "https://cloud.langfuse.com")
83
+ host = os.getenv("LANGFUSE_HOST", "https://cloud.langfuse.com")
84
84
  endpoint = f"{host}/api/public/otel"
85
85
  auth = base64.b64encode(f"{pk}:{sk}".encode()).decode()
86
86
  os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = endpoint
@@ -24,7 +24,7 @@ from fastapi.responses import Response
24
24
 
25
25
  from autobots_devtools_shared_lib.common.observability.logging_utils import (
26
26
  get_logger,
27
- set_conversation_id,
27
+ set_session_id,
28
28
  )
29
29
  from autobots_devtools_shared_lib.common.servers.fileserver.config import FileServerConfig
30
30
  from autobots_devtools_shared_lib.common.servers.fileserver.models import (
@@ -134,7 +134,7 @@ def health() -> dict[str, Any]:
134
134
  @app.post("/listFiles")
135
135
  def list_files(body: ListFilesBody) -> dict[str, Any]:
136
136
  """List files under path. When workspace_context is set, path is under that workspace."""
137
- set_conversation_id(body.conversation_id or "default_conversation_id")
137
+ set_session_id(body.session_id or "default_session_id")
138
138
  logger.info("listFiles called path=%s", body.path)
139
139
  base = _path_under_root(body.workspace_context, body.path)
140
140
  if not base.exists():
@@ -159,7 +159,7 @@ def list_files(body: ListFilesBody) -> dict[str, Any]:
159
159
  @app.post("/readFile")
160
160
  def read_file(body: ReadFileBody) -> Response:
161
161
  """Return file content as raw bytes. Path resolved under workspace when workspace_context set."""
162
- set_conversation_id(body.conversation_id or "default_conversation_id")
162
+ set_session_id(body.session_id or "default_session_id")
163
163
  logger.info("readFile called fileName=%s", body.fileName)
164
164
  path = _path_under_root(body.workspace_context, body.fileName)
165
165
  if not path.exists():
@@ -176,7 +176,7 @@ def read_file(body: ReadFileBody) -> Response:
176
176
  @app.post("/writeFile")
177
177
  def write_file(body: WriteFileBody) -> dict[str, Any]:
178
178
  """Write base64-encoded content to file. Path resolved under workspace when workspace_context set."""
179
- set_conversation_id(body.conversation_id or "default_conversation_id")
179
+ set_session_id(body.session_id or "default_session_id")
180
180
  logger.info("writeFile called file_name=%s", body.file_name)
181
181
  try:
182
182
  raw = base64.b64decode(body.file_content.encode("utf-8"))
@@ -206,7 +206,7 @@ def write_file(body: WriteFileBody) -> dict[str, Any]:
206
206
  @app.post("/moveFile")
207
207
  def move_file(body: MoveFileBody) -> dict[str, Any]:
208
208
  """Move file from source_path to destination_path. Paths resolved under workspace when workspace_context set."""
209
- set_conversation_id(body.conversation_id or "default_conversation_id")
209
+ set_session_id(body.session_id or "default_session_id")
210
210
  logger.info(
211
211
  "moveFile called source_path=%s destination_path=%s",
212
212
  body.source_path,
@@ -238,7 +238,7 @@ def move_file(body: MoveFileBody) -> dict[str, Any]:
238
238
  @app.post("/createDownloadLink")
239
239
  def create_download_link(body: ReadFileBody) -> Response:
240
240
  """Return a simple download link (file path) as text for local testing. Path resolved under workspace when workspace_context set."""
241
- set_conversation_id(body.conversation_id or "default_conversation_id")
241
+ set_session_id(body.session_id or "default_session_id")
242
242
  logger.info("createDownloadLink called fileName=%s", body.fileName)
243
243
  path = _path_under_root(body.workspace_context, body.fileName)
244
244
  if not path.exists():