arbis 0.4.5__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 (101) hide show
  1. arbis-0.4.5/LICENSE +21 -0
  2. arbis-0.4.5/MANIFEST.in +4 -0
  3. arbis-0.4.5/PKG-INFO +318 -0
  4. arbis-0.4.5/README.md +242 -0
  5. arbis-0.4.5/pyproject.toml +111 -0
  6. arbis-0.4.5/setup.cfg +4 -0
  7. arbis-0.4.5/src/arbis/__init__.py +80 -0
  8. arbis-0.4.5/src/arbis/_agent_identity.py +59 -0
  9. arbis-0.4.5/src/arbis/_api.py +631 -0
  10. arbis-0.4.5/src/arbis/_capture_precedence.py +160 -0
  11. arbis-0.4.5/src/arbis/_collector.py +501 -0
  12. arbis-0.4.5/src/arbis/_config.py +25 -0
  13. arbis-0.4.5/src/arbis/_context.py +228 -0
  14. arbis-0.4.5/src/arbis/_data.py +297 -0
  15. arbis-0.4.5/src/arbis/_diff.py +69 -0
  16. arbis-0.4.5/src/arbis/_hooks.py +124 -0
  17. arbis-0.4.5/src/arbis/_http_config.py +59 -0
  18. arbis-0.4.5/src/arbis/_memory_profile.py +77 -0
  19. arbis-0.4.5/src/arbis/_policy.py +351 -0
  20. arbis-0.4.5/src/arbis/_provider_families.py +99 -0
  21. arbis-0.4.5/src/arbis/_span.py +119 -0
  22. arbis-0.4.5/src/arbis/_streaming_errors.py +32 -0
  23. arbis-0.4.5/src/arbis/_tracker.py +1339 -0
  24. arbis-0.4.5/src/arbis/_turn_messages.py +86 -0
  25. arbis-0.4.5/src/arbis/docs/README.md +242 -0
  26. arbis-0.4.5/src/arbis/docs/SKILL.md +1513 -0
  27. arbis-0.4.5/src/arbis/docs/architecture.md +323 -0
  28. arbis-0.4.5/src/arbis/docs/guide.md +811 -0
  29. arbis-0.4.5/src/arbis/docs/minted-identities.md +277 -0
  30. arbis-0.4.5/src/arbis/docs/overview.md +336 -0
  31. arbis-0.4.5/src/arbis/docs/streaming-runs.md +148 -0
  32. arbis-0.4.5/src/arbis/docs/viewer-guide.md +341 -0
  33. arbis-0.4.5/src/arbis/inference/__init__.py +22 -0
  34. arbis-0.4.5/src/arbis/inference/_agent_loops.py +128 -0
  35. arbis-0.4.5/src/arbis/inference/_builder.py +1825 -0
  36. arbis-0.4.5/src/arbis/inference/_data_lineage.py +254 -0
  37. arbis-0.4.5/src/arbis/inference/_fingerprint.py +112 -0
  38. arbis-0.4.5/src/arbis/inference/_graph.py +151 -0
  39. arbis-0.4.5/src/arbis/inference/_lineage.py +623 -0
  40. arbis-0.4.5/src/arbis/inference/_merge_lineage.py +284 -0
  41. arbis-0.4.5/src/arbis/inference/_patterns.py +1079 -0
  42. arbis-0.4.5/src/arbis/inference/_rename_detection.py +120 -0
  43. arbis-0.4.5/src/arbis/inference/_workflow_boundary.py +149 -0
  44. arbis-0.4.5/src/arbis/instrumentors/__init__.py +32 -0
  45. arbis-0.4.5/src/arbis/instrumentors/_anthropic.py +413 -0
  46. arbis-0.4.5/src/arbis/instrumentors/_autogen.py +280 -0
  47. arbis-0.4.5/src/arbis/instrumentors/_bedrock.py +544 -0
  48. arbis-0.4.5/src/arbis/instrumentors/_capture_precedence.py +3 -0
  49. arbis-0.4.5/src/arbis/instrumentors/_crewai.py +366 -0
  50. arbis-0.4.5/src/arbis/instrumentors/_delegation.py +47 -0
  51. arbis-0.4.5/src/arbis/instrumentors/_gemini.py +511 -0
  52. arbis-0.4.5/src/arbis/instrumentors/_httpx.py +312 -0
  53. arbis-0.4.5/src/arbis/instrumentors/_langchain.py +640 -0
  54. arbis-0.4.5/src/arbis/instrumentors/_litellm.py +222 -0
  55. arbis-0.4.5/src/arbis/instrumentors/_llamaindex.py +384 -0
  56. arbis-0.4.5/src/arbis/instrumentors/_llm_adapter.py +1032 -0
  57. arbis-0.4.5/src/arbis/instrumentors/_llm_contract.py +95 -0
  58. arbis-0.4.5/src/arbis/instrumentors/_llm_runtime.py +364 -0
  59. arbis-0.4.5/src/arbis/instrumentors/_openai.py +326 -0
  60. arbis-0.4.5/src/arbis/instrumentors/_openai_agents.py +212 -0
  61. arbis-0.4.5/src/arbis/instrumentors/_openrouter.py +352 -0
  62. arbis-0.4.5/src/arbis/instrumentors/_provider_families.py +3 -0
  63. arbis-0.4.5/src/arbis/instrumentors/_provider_oracle.py +359 -0
  64. arbis-0.4.5/src/arbis/instrumentors/_redaction.py +184 -0
  65. arbis-0.4.5/src/arbis/instrumentors/_requests.py +211 -0
  66. arbis-0.4.5/src/arbis/instrumentors/_transport_runtime.py +228 -0
  67. arbis-0.4.5/src/arbis/otel/__init__.py +9 -0
  68. arbis-0.4.5/src/arbis/otel/_attrs.py +64 -0
  69. arbis-0.4.5/src/arbis/otel/_bridge.py +223 -0
  70. arbis-0.4.5/src/arbis/otel/_metrics.py +73 -0
  71. arbis-0.4.5/src/arbis/otel/_span_builder.py +175 -0
  72. arbis-0.4.5/src/arbis/store/__init__.py +63 -0
  73. arbis-0.4.5/src/arbis/store/_backend.py +27 -0
  74. arbis-0.4.5/src/arbis/store/_http.py +218 -0
  75. arbis-0.4.5/src/arbis/store/_ingest_errors.py +194 -0
  76. arbis-0.4.5/src/arbis/store/_json_dir.py +70 -0
  77. arbis-0.4.5/src/arbis/store/_merkle.py +154 -0
  78. arbis-0.4.5/src/arbis/store/_postgres.py +1154 -0
  79. arbis-0.4.5/src/arbis/store/_postgres_schema.py +287 -0
  80. arbis-0.4.5/src/arbis/store/_segment.py +379 -0
  81. arbis-0.4.5/src/arbis/store/_serialize.py +119 -0
  82. arbis-0.4.5/src/arbis/store/_sqlite.py +90 -0
  83. arbis-0.4.5/src/arbis/store/_stream_client.py +332 -0
  84. arbis-0.4.5/src/arbis/store/_stream_emitter.py +337 -0
  85. arbis-0.4.5/src/arbis/store/_stream_identity.py +218 -0
  86. arbis-0.4.5/src/arbis/store/_workflow_artifact.py +23 -0
  87. arbis-0.4.5/src/arbis/viewer/__init__.py +0 -0
  88. arbis-0.4.5/src/arbis/viewer/__main__.py +4 -0
  89. arbis-0.4.5/src/arbis/viewer/_compliance_display.py +173 -0
  90. arbis-0.4.5/src/arbis/viewer/_compliance_pillars.py +44 -0
  91. arbis-0.4.5/src/arbis/viewer/_demo_data.py +1473 -0
  92. arbis-0.4.5/src/arbis/viewer/_diff_view.py +600 -0
  93. arbis-0.4.5/src/arbis/viewer/_event_detail.py +509 -0
  94. arbis-0.4.5/src/arbis/viewer/_markdown.py +89 -0
  95. arbis-0.4.5/src/arbis/viewer/_postgres_source.py +390 -0
  96. arbis-0.4.5/src/arbis/viewer/app.py +1341 -0
  97. arbis-0.4.5/src/arbis.egg-info/PKG-INFO +318 -0
  98. arbis-0.4.5/src/arbis.egg-info/SOURCES.txt +99 -0
  99. arbis-0.4.5/src/arbis.egg-info/dependency_links.txt +1 -0
  100. arbis-0.4.5/src/arbis.egg-info/requires.txt +91 -0
  101. arbis-0.4.5/src/arbis.egg-info/top_level.txt +1 -0
arbis-0.4.5/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 llmwrap 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,4 @@
1
+ include README.md LICENSE pyproject.toml
2
+ recursive-include src/arbis *.py
3
+ recursive-include src/arbis/docs *.md
4
+ recursive-exclude * __pycache__ *.py[co] .git*
arbis-0.4.5/PKG-INFO ADDED
@@ -0,0 +1,318 @@
1
+ Metadata-Version: 2.4
2
+ Name: arbis
3
+ Version: 0.4.5
4
+ Summary: Runtime workflow observation for agent systems.
5
+ License: MIT
6
+ Keywords: observability,workflow,agents,tracing,llm
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Requires-Python: >=3.8
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: requests>=2.31
21
+ Requires-Dist: httpx>=0.24
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=7.0; extra == "dev"
24
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
25
+ Requires-Dist: respx>=0.20; extra == "dev"
26
+ Requires-Dist: python-dotenv>=1.0; extra == "dev"
27
+ Requires-Dist: openai<2.31.0,>=2.30.0; extra == "dev"
28
+ Requires-Dist: jiter<0.14.0,>=0.13.0; extra == "dev"
29
+ Requires-Dist: httpx>=0.24; extra == "dev"
30
+ Provides-Extra: arbis-litellm
31
+ Requires-Dist: litellm; python_version >= "3.11" and extra == "arbis-litellm"
32
+ Provides-Extra: arbis-openrouter
33
+ Requires-Dist: openrouter>=0.8.0; python_version >= "3.9" and extra == "arbis-openrouter"
34
+ Provides-Extra: arbis-gemini
35
+ Requires-Dist: google-generativeai>=0.7.0; python_version >= "3.9" and extra == "arbis-gemini"
36
+ Provides-Extra: arbis-bedrock
37
+ Requires-Dist: boto3>=1.28; python_version >= "3.8" and extra == "arbis-bedrock"
38
+ Provides-Extra: arbis-frameworks
39
+ Requires-Dist: langchain<0.4,>=0.3; python_version >= "3.11" and extra == "arbis-frameworks"
40
+ Requires-Dist: langchain-community<0.4,>=0.3; python_version >= "3.11" and extra == "arbis-frameworks"
41
+ Requires-Dist: langchain-core<1,>=0.3.85; python_version >= "3.11" and extra == "arbis-frameworks"
42
+ Requires-Dist: langchain-openai<0.4,>=0.3; python_version >= "3.11" and extra == "arbis-frameworks"
43
+ Requires-Dist: langgraph<0.7,>=0.6; python_version >= "3.11" and extra == "arbis-frameworks"
44
+ Requires-Dist: autogen-agentchat<0.3,>=0.2.40; python_version >= "3.11" and extra == "arbis-frameworks"
45
+ Provides-Extra: arbis-crewai
46
+ Requires-Dist: crewai>=0.80; python_version >= "3.11" and extra == "arbis-crewai"
47
+ Provides-Extra: arbis-llamaindex
48
+ Requires-Dist: llama-index-core<0.15,>=0.14; python_version >= "3.11" and extra == "arbis-llamaindex"
49
+ Requires-Dist: llama-index-llms-openai<0.8,>=0.7; python_version >= "3.11" and extra == "arbis-llamaindex"
50
+ Provides-Extra: arbis-openai-agents
51
+ Requires-Dist: openai-agents>=0.3; python_version >= "3.11" and extra == "arbis-openai-agents"
52
+ Provides-Extra: arbis-live
53
+ Requires-Dist: anthropic>=0.40; python_version >= "3.9" and extra == "arbis-live"
54
+ Requires-Dist: boto3>=1.28; python_version >= "3.8" and extra == "arbis-live"
55
+ Requires-Dist: google-genai>=1.0; python_version >= "3.10" and extra == "arbis-live"
56
+ Requires-Dist: google-generativeai>=0.7.0; python_version >= "3.9" and extra == "arbis-live"
57
+ Requires-Dist: openrouter>=0.8.0; python_version >= "3.9" and extra == "arbis-live"
58
+ Requires-Dist: litellm; python_version >= "3.11" and extra == "arbis-live"
59
+ Requires-Dist: langchain<0.4,>=0.3; python_version >= "3.11" and extra == "arbis-live"
60
+ Requires-Dist: langchain-community<0.4,>=0.3; python_version >= "3.11" and extra == "arbis-live"
61
+ Requires-Dist: langchain-core<1,>=0.3.85; python_version >= "3.11" and extra == "arbis-live"
62
+ Requires-Dist: langchain-openai<0.4,>=0.3; python_version >= "3.11" and extra == "arbis-live"
63
+ Requires-Dist: langgraph<0.7,>=0.6; python_version >= "3.11" and extra == "arbis-live"
64
+ Requires-Dist: autogen-agentchat<0.3,>=0.2.40; python_version >= "3.11" and extra == "arbis-live"
65
+ Requires-Dist: crewai>=0.80; python_version >= "3.11" and extra == "arbis-live"
66
+ Requires-Dist: llama-index-core<0.15,>=0.14; python_version >= "3.11" and extra == "arbis-live"
67
+ Requires-Dist: llama-index-llms-openai<0.8,>=0.7; python_version >= "3.11" and extra == "arbis-live"
68
+ Requires-Dist: openai-agents>=0.3; python_version >= "3.11" and extra == "arbis-live"
69
+ Provides-Extra: postgres
70
+ Requires-Dist: psycopg[binary]>=3.1; extra == "postgres"
71
+ Provides-Extra: otel
72
+ Requires-Dist: opentelemetry-api>=1.20; extra == "otel"
73
+ Requires-Dist: opentelemetry-sdk>=1.20; extra == "otel"
74
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.20; extra == "otel"
75
+ Dynamic: license-file
76
+
77
+ # arbis
78
+
79
+ Runtime workflow observation for agent systems.
80
+
81
+ Arbis instruments SDK boundaries, collects execution events, and infers workflow graphs from observed behavior. It reconstructs what happened during representative executions without requiring manual instrumentation of every call.
82
+
83
+ ## Install
84
+
85
+ ```bash
86
+ pip install arbis
87
+ ```
88
+
89
+ ## Quick Start
90
+
91
+ ```python
92
+ import arbis
93
+
94
+ # Start observing — instruments OpenAI, Anthropic, Gemini, Bedrock,
95
+ # OpenRouter, LiteLLM, LangChain, CrewAI, AutoGen, LlamaIndex, and more.
96
+ tracker = arbis.discover()
97
+
98
+ # ... run your agent code as normal ...
99
+
100
+ # Stop and get the inferred workflow graph.
101
+ tracker.stop()
102
+ graph = tracker.graph()
103
+ print(f"{len(graph.nodes)} nodes, {len(graph.edges)} edges")
104
+ ```
105
+
106
+ That's it. No decorators required for basic observation — `discover()` patches supported SDK boundaries automatically.
107
+
108
+ ## What Gets Captured
109
+
110
+ | Layer | Automatic | Explicit API needed |
111
+ |-------|-----------|---------------------|
112
+ | LLM calls (input, output, tokens, tools, thinking) | Yes | — |
113
+ | Streaming (sync + async) | Yes | — |
114
+ | Tool call loops (ReAct) | Yes | — |
115
+ | Agent groups and handoffs | Yes | — |
116
+ | Multi-agent orchestration topology | Yes | — |
117
+ | Named workflows / agents | — | `@arbis.workflow`, `@arbis.agent` |
118
+ | Declared handoffs between known agents | — | `arbis.step("handoff", input_data={"from": ..., "to": ...})` |
119
+ | Custom tool spans | — | `@arbis.tool`, `tracker.tool_call(...)` |
120
+ | Routing decisions | — | `arbis.route(...)` |
121
+ | Human-in-the-loop gates | — | `arbis.human_input(...)` |
122
+
123
+ ## Supported Providers & Frameworks
124
+
125
+ **LLM Providers:**
126
+ - OpenAI (Chat Completions, Responses API, Embeddings)
127
+ - OpenAI Agents SDK
128
+ - Anthropic Messages
129
+ - Google Gemini (`google.generativeai` and `google.genai`)
130
+ - AWS Bedrock (Converse / Converse Stream)
131
+ - OpenRouter
132
+ - LiteLLM
133
+
134
+ **Orchestration Frameworks:**
135
+ - LangChain / LangGraph
136
+ - CrewAI
137
+ - AutoGen
138
+ - LlamaIndex
139
+
140
+ **Transport:**
141
+ - `httpx` and `requests` (HTTP-level LLM detection and tool execution spans)
142
+
143
+ ## Explicit Context API
144
+
145
+ For richer graphs, add structure with decorators:
146
+
147
+ ```python
148
+ import arbis
149
+
150
+ tracker = arbis.discover()
151
+
152
+ @arbis.workflow("loan_processing")
153
+ def process_loan(application):
154
+
155
+ @arbis.agent("underwriter")
156
+ def underwrite():
157
+ # LLM calls here are automatically grouped under this agent
158
+ ...
159
+
160
+ @arbis.tool("credit_check")
161
+ def check_credit(applicant_id):
162
+ # Tool execution captured as a first-class span
163
+ ...
164
+
165
+ underwrite()
166
+ check_credit(application["id"])
167
+
168
+ process_loan(app)
169
+ tracker.stop()
170
+ ```
171
+
172
+ ## Persistence
173
+
174
+ Save workflow runs for later analysis:
175
+
176
+ ```python
177
+ # SQLite (default file-based)
178
+ tracker = arbis.discover(store="workflows.sqlite")
179
+
180
+ # JSON directory
181
+ tracker = arbis.discover(store="output/", store_backend="json")
182
+
183
+ # PostgreSQL (requires: pip install 'arbis[postgres]')
184
+ tracker = arbis.discover(store="postgresql://user:pass@host/db", store_backend="postgres")
185
+
186
+ # HTTP ingest to the Arbis backend (minted workflow_id / agent_id on @workflow / @agent)
187
+ tracker = arbis.discover(store_backend="http", org_id=ORG_ID, project_id=PROJECT_ID)
188
+ ```
189
+
190
+ See [minted-identities.md](docs/minted-identities.md) for attaching dashboard UUIDs
191
+ and for identity-force-mode ingest warnings.
192
+
193
+ ## Export to OpenTelemetry
194
+
195
+ Mirror runs to OpenTelemetry as **traces** (the `workflow → agent → llm_call → tool`
196
+ span tree, for Jaeger/Tempo/Honeycomb/Datadog) and/or **metrics** (token usage,
197
+ latency, call/error/retry counts) — independently of, or alongside, Arbis's own
198
+ stores. Requires `pip install 'arbis[otel]'`.
199
+
200
+ ```python
201
+ import arbis
202
+
203
+ # Arbis-owned OTLP export to a collector/Jaeger
204
+ tracker = arbis.discover(otel=True, otel_endpoint="localhost:4317")
205
+
206
+ # Add metrics, and/or plug into your existing OpenTelemetry providers
207
+ from opentelemetry import trace, metrics
208
+ tracker = arbis.discover(
209
+ otel=True, otel_metrics=True,
210
+ otel_tracer_provider=trace.get_tracer_provider(),
211
+ otel_meter_provider=metrics.get_meter_provider(),
212
+ )
213
+ ```
214
+
215
+ Spans follow OTel GenAI semantic conventions plus an `arbis.*` namespace. See the
216
+ [OpenTelemetry section of the guide](docs/guide.md#export-to-opentelemetry)
217
+ for setup, both export modes, and the attribute/metric reference.
218
+
219
+ ## Workflow Viewer (TUI)
220
+
221
+ Browse workflow definitions, run history, and agent topology in the terminal:
222
+
223
+ ```bash
224
+ pip install textual rich
225
+ python -m arbis.viewer
226
+ ```
227
+
228
+ The viewer launches with realistic demo data by default. To connect to a live PostgreSQL store:
229
+
230
+ ```bash
231
+ # Set connection details
232
+ export ARBIS_POSTGRES_DSN="postgresql://user:pass@host/db"
233
+ export ARBIS_PROJECT_ID="your-project-uuid"
234
+
235
+ # Initialize the database (first time only)
236
+ psql -d arbis -f scripts/init_db.sql
237
+ # Or reset from scratch:
238
+ ./scripts/reset_db.sh
239
+
240
+ # Launch
241
+ python -m arbis.viewer --store "$ARBIS_POSTGRES_DSN" --project-id "$ARBIS_PROJECT_ID"
242
+ ```
243
+
244
+ **Viewer keybindings:**
245
+
246
+ | Key | Action |
247
+ |-----|--------|
248
+ | Arrow keys | Navigate |
249
+ | Enter | Select / drill in |
250
+ | Escape | Back |
251
+ | `d` | Diff workflow versions |
252
+ | `n` | Rename workflow or agent |
253
+ | `l` | View lineage link suggestions |
254
+ | `c` | Compliance breakdown |
255
+ | `r` | Refresh data |
256
+ | `q` | Quit |
257
+
258
+ **Three-pane layout:**
259
+ - **Left:** Workflow definitions (named or auto-discovered)
260
+ - **Middle:** Run history for the selected workflow
261
+ - **Right:** Run detail — agent groups, handoffs, tool calls, thinking traces, token usage, and event timeline
262
+
263
+ ## Workflow Diffing
264
+
265
+ Compare how workflows evolve over time:
266
+
267
+ ```python
268
+ import arbis
269
+
270
+ diff_result = arbis.diff(graph_a, graph_b)
271
+ # Returns structural fingerprint comparison, agent/tool changes, topology deltas
272
+ ```
273
+
274
+ In the viewer, press `d` on a workflow with multiple versions to see agent prompt changes, topology edits, and performance deltas.
275
+
276
+ ## Optional Dependencies
277
+
278
+ ```bash
279
+ pip install 'arbis[postgres]' # PostgreSQL storage backend
280
+ pip install 'arbis[otel]' # OpenTelemetry traces + metrics export
281
+ pip install 'arbis[dev]' # Development & testing
282
+ pip install 'arbis[arbis-litellm]' # LiteLLM support
283
+ pip install 'arbis[arbis-frameworks]' # LangChain + AutoGen
284
+ pip install 'arbis[arbis-crewai]' # CrewAI
285
+ pip install 'arbis[arbis-llamaindex]' # LlamaIndex
286
+ pip install 'arbis[arbis-bedrock]' # AWS Bedrock
287
+ pip install 'arbis[arbis-gemini]' # Google Gemini SDK
288
+ ```
289
+
290
+ ## Documentation
291
+
292
+ All documentation is bundled inside the installed package. After `pip install arbis`:
293
+
294
+ ```python
295
+ from importlib.resources import files
296
+
297
+ # Get the path to bundled docs
298
+ docs = files("arbis") / "docs"
299
+
300
+ # Read a specific doc
301
+ print((docs / "guide.md").read_text())
302
+ ```
303
+
304
+ **Bundled docs:**
305
+
306
+ | File | Contents |
307
+ |------|----------|
308
+ | `docs/SKILL.md` | Complete API reference — 17 integration patterns covering every public API |
309
+ | `docs/guide.md` | Mental model, automatic vs explicit matrix, SDK coverage |
310
+ | `docs/architecture.md` | Module map, instrumentor details, inference pipeline |
311
+ | `docs/overview.md` | Overview: workflows, tools, supported SDKs/frameworks, and performance |
312
+ | `docs/viewer-guide.md` | TUI viewer usage, PostgreSQL setup, layout and navigation |
313
+ | `docs/streaming-runs.md` | HTTP streaming ingest + `arbis.wait` |
314
+ | `docs/minted-identities.md` | Minted `workflow_id` / `agent_id`, identity force mode, ingest 400s |
315
+
316
+ ## License
317
+
318
+ MIT. See [LICENSE](LICENSE).
arbis-0.4.5/README.md ADDED
@@ -0,0 +1,242 @@
1
+ # arbis
2
+
3
+ Runtime workflow observation for agent systems.
4
+
5
+ Arbis instruments SDK boundaries, collects execution events, and infers workflow graphs from observed behavior. It reconstructs what happened during representative executions without requiring manual instrumentation of every call.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install arbis
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```python
16
+ import arbis
17
+
18
+ # Start observing — instruments OpenAI, Anthropic, Gemini, Bedrock,
19
+ # OpenRouter, LiteLLM, LangChain, CrewAI, AutoGen, LlamaIndex, and more.
20
+ tracker = arbis.discover()
21
+
22
+ # ... run your agent code as normal ...
23
+
24
+ # Stop and get the inferred workflow graph.
25
+ tracker.stop()
26
+ graph = tracker.graph()
27
+ print(f"{len(graph.nodes)} nodes, {len(graph.edges)} edges")
28
+ ```
29
+
30
+ That's it. No decorators required for basic observation — `discover()` patches supported SDK boundaries automatically.
31
+
32
+ ## What Gets Captured
33
+
34
+ | Layer | Automatic | Explicit API needed |
35
+ |-------|-----------|---------------------|
36
+ | LLM calls (input, output, tokens, tools, thinking) | Yes | — |
37
+ | Streaming (sync + async) | Yes | — |
38
+ | Tool call loops (ReAct) | Yes | — |
39
+ | Agent groups and handoffs | Yes | — |
40
+ | Multi-agent orchestration topology | Yes | — |
41
+ | Named workflows / agents | — | `@arbis.workflow`, `@arbis.agent` |
42
+ | Declared handoffs between known agents | — | `arbis.step("handoff", input_data={"from": ..., "to": ...})` |
43
+ | Custom tool spans | — | `@arbis.tool`, `tracker.tool_call(...)` |
44
+ | Routing decisions | — | `arbis.route(...)` |
45
+ | Human-in-the-loop gates | — | `arbis.human_input(...)` |
46
+
47
+ ## Supported Providers & Frameworks
48
+
49
+ **LLM Providers:**
50
+ - OpenAI (Chat Completions, Responses API, Embeddings)
51
+ - OpenAI Agents SDK
52
+ - Anthropic Messages
53
+ - Google Gemini (`google.generativeai` and `google.genai`)
54
+ - AWS Bedrock (Converse / Converse Stream)
55
+ - OpenRouter
56
+ - LiteLLM
57
+
58
+ **Orchestration Frameworks:**
59
+ - LangChain / LangGraph
60
+ - CrewAI
61
+ - AutoGen
62
+ - LlamaIndex
63
+
64
+ **Transport:**
65
+ - `httpx` and `requests` (HTTP-level LLM detection and tool execution spans)
66
+
67
+ ## Explicit Context API
68
+
69
+ For richer graphs, add structure with decorators:
70
+
71
+ ```python
72
+ import arbis
73
+
74
+ tracker = arbis.discover()
75
+
76
+ @arbis.workflow("loan_processing")
77
+ def process_loan(application):
78
+
79
+ @arbis.agent("underwriter")
80
+ def underwrite():
81
+ # LLM calls here are automatically grouped under this agent
82
+ ...
83
+
84
+ @arbis.tool("credit_check")
85
+ def check_credit(applicant_id):
86
+ # Tool execution captured as a first-class span
87
+ ...
88
+
89
+ underwrite()
90
+ check_credit(application["id"])
91
+
92
+ process_loan(app)
93
+ tracker.stop()
94
+ ```
95
+
96
+ ## Persistence
97
+
98
+ Save workflow runs for later analysis:
99
+
100
+ ```python
101
+ # SQLite (default file-based)
102
+ tracker = arbis.discover(store="workflows.sqlite")
103
+
104
+ # JSON directory
105
+ tracker = arbis.discover(store="output/", store_backend="json")
106
+
107
+ # PostgreSQL (requires: pip install 'arbis[postgres]')
108
+ tracker = arbis.discover(store="postgresql://user:pass@host/db", store_backend="postgres")
109
+
110
+ # HTTP ingest to the Arbis backend (minted workflow_id / agent_id on @workflow / @agent)
111
+ tracker = arbis.discover(store_backend="http", org_id=ORG_ID, project_id=PROJECT_ID)
112
+ ```
113
+
114
+ See [minted-identities.md](docs/minted-identities.md) for attaching dashboard UUIDs
115
+ and for identity-force-mode ingest warnings.
116
+
117
+ ## Export to OpenTelemetry
118
+
119
+ Mirror runs to OpenTelemetry as **traces** (the `workflow → agent → llm_call → tool`
120
+ span tree, for Jaeger/Tempo/Honeycomb/Datadog) and/or **metrics** (token usage,
121
+ latency, call/error/retry counts) — independently of, or alongside, Arbis's own
122
+ stores. Requires `pip install 'arbis[otel]'`.
123
+
124
+ ```python
125
+ import arbis
126
+
127
+ # Arbis-owned OTLP export to a collector/Jaeger
128
+ tracker = arbis.discover(otel=True, otel_endpoint="localhost:4317")
129
+
130
+ # Add metrics, and/or plug into your existing OpenTelemetry providers
131
+ from opentelemetry import trace, metrics
132
+ tracker = arbis.discover(
133
+ otel=True, otel_metrics=True,
134
+ otel_tracer_provider=trace.get_tracer_provider(),
135
+ otel_meter_provider=metrics.get_meter_provider(),
136
+ )
137
+ ```
138
+
139
+ Spans follow OTel GenAI semantic conventions plus an `arbis.*` namespace. See the
140
+ [OpenTelemetry section of the guide](docs/guide.md#export-to-opentelemetry)
141
+ for setup, both export modes, and the attribute/metric reference.
142
+
143
+ ## Workflow Viewer (TUI)
144
+
145
+ Browse workflow definitions, run history, and agent topology in the terminal:
146
+
147
+ ```bash
148
+ pip install textual rich
149
+ python -m arbis.viewer
150
+ ```
151
+
152
+ The viewer launches with realistic demo data by default. To connect to a live PostgreSQL store:
153
+
154
+ ```bash
155
+ # Set connection details
156
+ export ARBIS_POSTGRES_DSN="postgresql://user:pass@host/db"
157
+ export ARBIS_PROJECT_ID="your-project-uuid"
158
+
159
+ # Initialize the database (first time only)
160
+ psql -d arbis -f scripts/init_db.sql
161
+ # Or reset from scratch:
162
+ ./scripts/reset_db.sh
163
+
164
+ # Launch
165
+ python -m arbis.viewer --store "$ARBIS_POSTGRES_DSN" --project-id "$ARBIS_PROJECT_ID"
166
+ ```
167
+
168
+ **Viewer keybindings:**
169
+
170
+ | Key | Action |
171
+ |-----|--------|
172
+ | Arrow keys | Navigate |
173
+ | Enter | Select / drill in |
174
+ | Escape | Back |
175
+ | `d` | Diff workflow versions |
176
+ | `n` | Rename workflow or agent |
177
+ | `l` | View lineage link suggestions |
178
+ | `c` | Compliance breakdown |
179
+ | `r` | Refresh data |
180
+ | `q` | Quit |
181
+
182
+ **Three-pane layout:**
183
+ - **Left:** Workflow definitions (named or auto-discovered)
184
+ - **Middle:** Run history for the selected workflow
185
+ - **Right:** Run detail — agent groups, handoffs, tool calls, thinking traces, token usage, and event timeline
186
+
187
+ ## Workflow Diffing
188
+
189
+ Compare how workflows evolve over time:
190
+
191
+ ```python
192
+ import arbis
193
+
194
+ diff_result = arbis.diff(graph_a, graph_b)
195
+ # Returns structural fingerprint comparison, agent/tool changes, topology deltas
196
+ ```
197
+
198
+ In the viewer, press `d` on a workflow with multiple versions to see agent prompt changes, topology edits, and performance deltas.
199
+
200
+ ## Optional Dependencies
201
+
202
+ ```bash
203
+ pip install 'arbis[postgres]' # PostgreSQL storage backend
204
+ pip install 'arbis[otel]' # OpenTelemetry traces + metrics export
205
+ pip install 'arbis[dev]' # Development & testing
206
+ pip install 'arbis[arbis-litellm]' # LiteLLM support
207
+ pip install 'arbis[arbis-frameworks]' # LangChain + AutoGen
208
+ pip install 'arbis[arbis-crewai]' # CrewAI
209
+ pip install 'arbis[arbis-llamaindex]' # LlamaIndex
210
+ pip install 'arbis[arbis-bedrock]' # AWS Bedrock
211
+ pip install 'arbis[arbis-gemini]' # Google Gemini SDK
212
+ ```
213
+
214
+ ## Documentation
215
+
216
+ All documentation is bundled inside the installed package. After `pip install arbis`:
217
+
218
+ ```python
219
+ from importlib.resources import files
220
+
221
+ # Get the path to bundled docs
222
+ docs = files("arbis") / "docs"
223
+
224
+ # Read a specific doc
225
+ print((docs / "guide.md").read_text())
226
+ ```
227
+
228
+ **Bundled docs:**
229
+
230
+ | File | Contents |
231
+ |------|----------|
232
+ | `docs/SKILL.md` | Complete API reference — 17 integration patterns covering every public API |
233
+ | `docs/guide.md` | Mental model, automatic vs explicit matrix, SDK coverage |
234
+ | `docs/architecture.md` | Module map, instrumentor details, inference pipeline |
235
+ | `docs/overview.md` | Overview: workflows, tools, supported SDKs/frameworks, and performance |
236
+ | `docs/viewer-guide.md` | TUI viewer usage, PostgreSQL setup, layout and navigation |
237
+ | `docs/streaming-runs.md` | HTTP streaming ingest + `arbis.wait` |
238
+ | `docs/minted-identities.md` | Minted `workflow_id` / `agent_id`, identity force mode, ingest 400s |
239
+
240
+ ## License
241
+
242
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,111 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "arbis"
7
+ version = "0.4.5"
8
+ description = "Runtime workflow observation for agent systems."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ dependencies = [
13
+ "requests>=2.31",
14
+ "httpx>=0.24",
15
+ ]
16
+ keywords = ["observability", "workflow", "agents", "tracing", "llm"]
17
+ classifiers = [
18
+ "Development Status :: 4 - Beta",
19
+ "Intended Audience :: Developers",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.8",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ ]
29
+
30
+ [project.optional-dependencies]
31
+ dev = [
32
+ "pytest>=7.0",
33
+ "pytest-asyncio>=0.21",
34
+ "respx>=0.20",
35
+ "python-dotenv>=1.0",
36
+ "openai>=2.30.0,<2.31.0",
37
+ "jiter>=0.13.0,<0.14.0",
38
+ "httpx>=0.24",
39
+ ]
40
+ arbis-litellm = [
41
+ "litellm; python_version >= '3.11'",
42
+ ]
43
+ arbis-openrouter = [
44
+ "openrouter>=0.8.0; python_version >= '3.9'",
45
+ ]
46
+ arbis-gemini = [
47
+ "google-generativeai>=0.7.0; python_version >= '3.9'",
48
+ ]
49
+ arbis-bedrock = [
50
+ "boto3>=1.28; python_version >= '3.8'",
51
+ ]
52
+ arbis-frameworks = [
53
+ "langchain>=0.3,<0.4; python_version >= '3.11'",
54
+ "langchain-community>=0.3,<0.4; python_version >= '3.11'",
55
+ "langchain-core>=0.3.85,<1; python_version >= '3.11'",
56
+ "langchain-openai>=0.3,<0.4; python_version >= '3.11'",
57
+ "langgraph>=0.6,<0.7; python_version >= '3.11'",
58
+ "autogen-agentchat>=0.2.40,<0.3; python_version >= '3.11'",
59
+ ]
60
+ arbis-crewai = [
61
+ "crewai>=0.80; python_version >= '3.11'",
62
+ ]
63
+ arbis-llamaindex = [
64
+ "llama-index-core>=0.14,<0.15; python_version >= '3.11'",
65
+ "llama-index-llms-openai>=0.7,<0.8; python_version >= '3.11'",
66
+ ]
67
+ arbis-openai-agents = [
68
+ "openai-agents>=0.3; python_version >= '3.11'",
69
+ ]
70
+ arbis-live = [
71
+ "anthropic>=0.40; python_version >= '3.9'",
72
+ "boto3>=1.28; python_version >= '3.8'",
73
+ "google-genai>=1.0; python_version >= '3.10'",
74
+ "google-generativeai>=0.7.0; python_version >= '3.9'",
75
+ "openrouter>=0.8.0; python_version >= '3.9'",
76
+ "litellm; python_version >= '3.11'",
77
+ "langchain>=0.3,<0.4; python_version >= '3.11'",
78
+ "langchain-community>=0.3,<0.4; python_version >= '3.11'",
79
+ "langchain-core>=0.3.85,<1; python_version >= '3.11'",
80
+ "langchain-openai>=0.3,<0.4; python_version >= '3.11'",
81
+ "langgraph>=0.6,<0.7; python_version >= '3.11'",
82
+ "autogen-agentchat>=0.2.40,<0.3; python_version >= '3.11'",
83
+ "crewai>=0.80; python_version >= '3.11'",
84
+ "llama-index-core>=0.14,<0.15; python_version >= '3.11'",
85
+ "llama-index-llms-openai>=0.7,<0.8; python_version >= '3.11'",
86
+ "openai-agents>=0.3; python_version >= '3.11'",
87
+ ]
88
+ postgres = [
89
+ "psycopg[binary]>=3.1",
90
+ ]
91
+ otel = [
92
+ "opentelemetry-api>=1.20",
93
+ "opentelemetry-sdk>=1.20",
94
+ "opentelemetry-exporter-otlp-proto-grpc>=1.20",
95
+ ]
96
+
97
+ [tool.setuptools.package-data]
98
+ arbis = ["docs/*.md"]
99
+
100
+ [tool.setuptools.packages.find]
101
+ where = ["src"]
102
+
103
+ [tool.pytest.ini_options]
104
+ pythonpath = ["src"]
105
+ # LangSmith's pytest entry point is named langsmith_plugin; it imports xxhash,
106
+ # which can fail on Windows if xxhash wheels are missing or mismatched.
107
+ # This repo does not use LangSmith in tests, so block that plugin before import.
108
+ addopts = "-p no:langsmith_plugin"
109
+ markers = [
110
+ "integration: marks real SDK/integration behavior tests",
111
+ ]