fluxloop 0.1.2__tar.gz → 0.1.3__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.
- fluxloop-0.1.3/PKG-INFO +139 -0
- fluxloop-0.1.3/README.md +103 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/__init__.py +1 -1
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/config.py +1 -1
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/schemas/config.py +13 -2
- fluxloop-0.1.3/fluxloop.egg-info/PKG-INFO +139 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/pyproject.toml +4 -4
- fluxloop-0.1.2/PKG-INFO +0 -76
- fluxloop-0.1.2/README.md +0 -40
- fluxloop-0.1.2/fluxloop.egg-info/PKG-INFO +0 -76
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/buffer.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/client.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/context.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/decorators.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/models.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/recording.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/schemas/__init__.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/schemas/trace.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/serialization.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop/storage.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop.egg-info/SOURCES.txt +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop.egg-info/dependency_links.txt +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop.egg-info/requires.txt +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/fluxloop.egg-info/top_level.txt +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/setup.cfg +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/tests/test_buffer.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/tests/test_config.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/tests/test_context.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/tests/test_decorators.py +0 -0
- {fluxloop-0.1.2 → fluxloop-0.1.3}/tests/test_recording.py +0 -0
fluxloop-0.1.3/PKG-INFO
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fluxloop
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: FluxLoop SDK for agent instrumentation and tracing
|
|
5
|
+
Author-email: FluxLoop Team <team@fluxloop.dev>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/chuckgu/fluxloop
|
|
8
|
+
Project-URL: Documentation, https://docs.fluxloop.dev
|
|
9
|
+
Project-URL: Repository, https://github.com/chuckgu/fluxloop
|
|
10
|
+
Project-URL: Issues, https://github.com/chuckgu/fluxloop/issues
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: pydantic>=2.0
|
|
23
|
+
Requires-Dist: httpx>=0.24.0
|
|
24
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
30
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
31
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
32
|
+
Provides-Extra: langchain
|
|
33
|
+
Requires-Dist: langchain>=0.1.0; extra == "langchain"
|
|
34
|
+
Provides-Extra: langgraph
|
|
35
|
+
Requires-Dist: langgraph>=0.0.20; extra == "langgraph"
|
|
36
|
+
|
|
37
|
+
# FluxLoop SDK
|
|
38
|
+
|
|
39
|
+
FluxLoop SDK for agent instrumentation and tracing.
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install fluxloop
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from fluxloop import trace, FluxLoopClient
|
|
51
|
+
|
|
52
|
+
# Initialize the client
|
|
53
|
+
client = FluxLoopClient()
|
|
54
|
+
|
|
55
|
+
# Use the trace decorator
|
|
56
|
+
@trace()
|
|
57
|
+
def my_agent_function(prompt: str):
|
|
58
|
+
# Your agent logic here
|
|
59
|
+
return result
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Features
|
|
63
|
+
|
|
64
|
+
- 🔍 **Automatic Tracing**: Instrument your agent code with simple decorators
|
|
65
|
+
- 📊 **Rich Context**: Capture inputs, outputs, and metadata
|
|
66
|
+
- 🔄 **Async Support**: Works with both sync and async functions
|
|
67
|
+
- 🎯 **Framework Integration**: Built-in support for LangChain and LangGraph
|
|
68
|
+
|
|
69
|
+
## Documentation
|
|
70
|
+
|
|
71
|
+
For detailed documentation, visit [https://docs.fluxloop.dev](https://docs.fluxloop.dev)
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
Apache License 2.0 - see LICENSE file for details
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## Framework Integration: Decorator Ordering and Safe Instrumentation
|
|
79
|
+
|
|
80
|
+
When integrating FluxLoop with external agent frameworks (e.g., ChatKit, LangChain), follow these rules to avoid type conflicts and ensure observations are captured reliably.
|
|
81
|
+
|
|
82
|
+
- Outermost framework wrapper: If a framework provides its own decorator/wrapper that transforms a plain function into a framework-specific object (e.g., a Tool), that decorator MUST be the outermost (top) decorator. This preserves the type the framework expects.
|
|
83
|
+
- FluxLoop instrumentation inside: Place FluxLoop decorators inside (below) the framework decorator, or instrument from within the function body using the SDK context APIs.
|
|
84
|
+
|
|
85
|
+
Two safe patterns:
|
|
86
|
+
|
|
87
|
+
- Pattern A (safest, framework-agnostic): instrument inside the function body
|
|
88
|
+
- Use `get_current_context()` and push/pop an `ObservationData` manually around your logic. This keeps signatures and framework typing unchanged.
|
|
89
|
+
- Example (tool function):
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from fluxloop import get_current_context
|
|
93
|
+
from fluxloop.models import ObservationData, ObservationType
|
|
94
|
+
|
|
95
|
+
async def my_tool(param: str) -> dict:
|
|
96
|
+
fl_ctx = get_current_context()
|
|
97
|
+
obs = None
|
|
98
|
+
if fl_ctx and fl_ctx.is_enabled():
|
|
99
|
+
obs = ObservationData(
|
|
100
|
+
type=ObservationType.TOOL,
|
|
101
|
+
name="tool.my_tool",
|
|
102
|
+
input={"args": {"param": param}},
|
|
103
|
+
)
|
|
104
|
+
fl_ctx.push_observation(obs)
|
|
105
|
+
|
|
106
|
+
try:
|
|
107
|
+
result = {"result": do_work(param)}
|
|
108
|
+
if obs:
|
|
109
|
+
obs.output = result
|
|
110
|
+
return result
|
|
111
|
+
except Exception as e:
|
|
112
|
+
if obs:
|
|
113
|
+
obs.error = str(e)
|
|
114
|
+
raise
|
|
115
|
+
finally:
|
|
116
|
+
if fl_ctx and obs:
|
|
117
|
+
fl_ctx.pop_observation()
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- Pattern B (stacking decorators): framework outermost, FluxLoop inside
|
|
121
|
+
- Example with a framework tool decorator:
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
@framework_tool_decorator(...)
|
|
125
|
+
@fluxloop.tool(name="tool.my_tool")
|
|
126
|
+
async def my_tool(...):
|
|
127
|
+
...
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
- Important: If you reverse the order (FluxLoop outside), the framework may see a plain function instead of its expected type and raise errors like "Unknown tool type".
|
|
131
|
+
|
|
132
|
+
LLM/streaming calls:
|
|
133
|
+
|
|
134
|
+
- For LLM calls (including async generators/streams), either:
|
|
135
|
+
- Wrap the call site in a small helper decorated with `@fluxloop.prompt(...)`, or
|
|
136
|
+
- Use `with fluxloop.instrument("prompt.name"):` around the portion that produces model output, ensuring it runs inside the current FluxLoop context.
|
|
137
|
+
|
|
138
|
+
These patterns guarantee observations are captured (`tool`, `generation`) while keeping the external framework’s type system intact.
|
|
139
|
+
|
fluxloop-0.1.3/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# FluxLoop SDK
|
|
2
|
+
|
|
3
|
+
FluxLoop SDK for agent instrumentation and tracing.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install fluxloop
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from fluxloop import trace, FluxLoopClient
|
|
15
|
+
|
|
16
|
+
# Initialize the client
|
|
17
|
+
client = FluxLoopClient()
|
|
18
|
+
|
|
19
|
+
# Use the trace decorator
|
|
20
|
+
@trace()
|
|
21
|
+
def my_agent_function(prompt: str):
|
|
22
|
+
# Your agent logic here
|
|
23
|
+
return result
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- 🔍 **Automatic Tracing**: Instrument your agent code with simple decorators
|
|
29
|
+
- 📊 **Rich Context**: Capture inputs, outputs, and metadata
|
|
30
|
+
- 🔄 **Async Support**: Works with both sync and async functions
|
|
31
|
+
- 🎯 **Framework Integration**: Built-in support for LangChain and LangGraph
|
|
32
|
+
|
|
33
|
+
## Documentation
|
|
34
|
+
|
|
35
|
+
For detailed documentation, visit [https://docs.fluxloop.dev](https://docs.fluxloop.dev)
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
Apache License 2.0 - see LICENSE file for details
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Framework Integration: Decorator Ordering and Safe Instrumentation
|
|
43
|
+
|
|
44
|
+
When integrating FluxLoop with external agent frameworks (e.g., ChatKit, LangChain), follow these rules to avoid type conflicts and ensure observations are captured reliably.
|
|
45
|
+
|
|
46
|
+
- Outermost framework wrapper: If a framework provides its own decorator/wrapper that transforms a plain function into a framework-specific object (e.g., a Tool), that decorator MUST be the outermost (top) decorator. This preserves the type the framework expects.
|
|
47
|
+
- FluxLoop instrumentation inside: Place FluxLoop decorators inside (below) the framework decorator, or instrument from within the function body using the SDK context APIs.
|
|
48
|
+
|
|
49
|
+
Two safe patterns:
|
|
50
|
+
|
|
51
|
+
- Pattern A (safest, framework-agnostic): instrument inside the function body
|
|
52
|
+
- Use `get_current_context()` and push/pop an `ObservationData` manually around your logic. This keeps signatures and framework typing unchanged.
|
|
53
|
+
- Example (tool function):
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from fluxloop import get_current_context
|
|
57
|
+
from fluxloop.models import ObservationData, ObservationType
|
|
58
|
+
|
|
59
|
+
async def my_tool(param: str) -> dict:
|
|
60
|
+
fl_ctx = get_current_context()
|
|
61
|
+
obs = None
|
|
62
|
+
if fl_ctx and fl_ctx.is_enabled():
|
|
63
|
+
obs = ObservationData(
|
|
64
|
+
type=ObservationType.TOOL,
|
|
65
|
+
name="tool.my_tool",
|
|
66
|
+
input={"args": {"param": param}},
|
|
67
|
+
)
|
|
68
|
+
fl_ctx.push_observation(obs)
|
|
69
|
+
|
|
70
|
+
try:
|
|
71
|
+
result = {"result": do_work(param)}
|
|
72
|
+
if obs:
|
|
73
|
+
obs.output = result
|
|
74
|
+
return result
|
|
75
|
+
except Exception as e:
|
|
76
|
+
if obs:
|
|
77
|
+
obs.error = str(e)
|
|
78
|
+
raise
|
|
79
|
+
finally:
|
|
80
|
+
if fl_ctx and obs:
|
|
81
|
+
fl_ctx.pop_observation()
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- Pattern B (stacking decorators): framework outermost, FluxLoop inside
|
|
85
|
+
- Example with a framework tool decorator:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
@framework_tool_decorator(...)
|
|
89
|
+
@fluxloop.tool(name="tool.my_tool")
|
|
90
|
+
async def my_tool(...):
|
|
91
|
+
...
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
- Important: If you reverse the order (FluxLoop outside), the framework may see a plain function instead of its expected type and raise errors like "Unknown tool type".
|
|
95
|
+
|
|
96
|
+
LLM/streaming calls:
|
|
97
|
+
|
|
98
|
+
- For LLM calls (including async generators/streams), either:
|
|
99
|
+
- Wrap the call site in a small helper decorated with `@fluxloop.prompt(...)`, or
|
|
100
|
+
- Use `with fluxloop.instrument("prompt.name"):` around the portion that produces model output, ensuring it runs inside the current FluxLoop context.
|
|
101
|
+
|
|
102
|
+
These patterns guarantee observations are captured (`tool`, `generation`) while keeping the external framework’s type system intact.
|
|
103
|
+
|
|
@@ -21,7 +21,7 @@ from .client import FluxLoopClient
|
|
|
21
21
|
from .config import configure, get_config, reset_config, load_env
|
|
22
22
|
from .recording import disable_recording, enable_recording, record_call_args, set_recording_options
|
|
23
23
|
|
|
24
|
-
__version__ = "0.1.
|
|
24
|
+
__version__ = "0.1.3"
|
|
25
25
|
|
|
26
26
|
__all__ = [
|
|
27
27
|
# Decorators
|
|
@@ -104,7 +104,7 @@ class SDKConfig(BaseModel):
|
|
|
104
104
|
default_factory=lambda: os.getenv("FLUXLOOP_OFFLINE_ENABLED", "true").lower() == "true"
|
|
105
105
|
)
|
|
106
106
|
offline_store_dir: str = Field(
|
|
107
|
-
default_factory=lambda: os.getenv("FLUXLOOP_OFFLINE_DIR", "./
|
|
107
|
+
default_factory=lambda: os.getenv("FLUXLOOP_OFFLINE_DIR", "./experiments/artifacts")
|
|
108
108
|
)
|
|
109
109
|
|
|
110
110
|
# Argument recording (disabled by default)
|
|
@@ -4,7 +4,7 @@ Configuration schemas for experiments and simulations.
|
|
|
4
4
|
|
|
5
5
|
from enum import Enum
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
from typing import Any, Dict, List, Optional
|
|
7
|
+
from typing import Any, Dict, List, Optional, Union
|
|
8
8
|
|
|
9
9
|
from pydantic import BaseModel, Field, PrivateAttr, field_validator, model_validator
|
|
10
10
|
|
|
@@ -163,8 +163,19 @@ class RunnerConfig(BaseModel):
|
|
|
163
163
|
|
|
164
164
|
# Execution environment
|
|
165
165
|
working_directory: Optional[str] = None
|
|
166
|
-
python_path:
|
|
166
|
+
python_path: List[str] = Field(default_factory=list)
|
|
167
167
|
environment_vars: Dict[str, str] = Field(default_factory=dict)
|
|
168
|
+
|
|
169
|
+
@field_validator("python_path", mode="before")
|
|
170
|
+
@classmethod
|
|
171
|
+
def _coerce_python_path(cls, value: Union[None, str, List[str], tuple]) -> List[str]:
|
|
172
|
+
if value is None:
|
|
173
|
+
return []
|
|
174
|
+
if isinstance(value, str):
|
|
175
|
+
return [value]
|
|
176
|
+
if isinstance(value, (list, tuple)):
|
|
177
|
+
return [str(item) for item in value]
|
|
178
|
+
return [str(value)]
|
|
168
179
|
|
|
169
180
|
# Dependencies
|
|
170
181
|
requirements_file: Optional[str] = None
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fluxloop
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: FluxLoop SDK for agent instrumentation and tracing
|
|
5
|
+
Author-email: FluxLoop Team <team@fluxloop.dev>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/chuckgu/fluxloop
|
|
8
|
+
Project-URL: Documentation, https://docs.fluxloop.dev
|
|
9
|
+
Project-URL: Repository, https://github.com/chuckgu/fluxloop
|
|
10
|
+
Project-URL: Issues, https://github.com/chuckgu/fluxloop/issues
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: pydantic>=2.0
|
|
23
|
+
Requires-Dist: httpx>=0.24.0
|
|
24
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
30
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
31
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
32
|
+
Provides-Extra: langchain
|
|
33
|
+
Requires-Dist: langchain>=0.1.0; extra == "langchain"
|
|
34
|
+
Provides-Extra: langgraph
|
|
35
|
+
Requires-Dist: langgraph>=0.0.20; extra == "langgraph"
|
|
36
|
+
|
|
37
|
+
# FluxLoop SDK
|
|
38
|
+
|
|
39
|
+
FluxLoop SDK for agent instrumentation and tracing.
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install fluxloop
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from fluxloop import trace, FluxLoopClient
|
|
51
|
+
|
|
52
|
+
# Initialize the client
|
|
53
|
+
client = FluxLoopClient()
|
|
54
|
+
|
|
55
|
+
# Use the trace decorator
|
|
56
|
+
@trace()
|
|
57
|
+
def my_agent_function(prompt: str):
|
|
58
|
+
# Your agent logic here
|
|
59
|
+
return result
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Features
|
|
63
|
+
|
|
64
|
+
- 🔍 **Automatic Tracing**: Instrument your agent code with simple decorators
|
|
65
|
+
- 📊 **Rich Context**: Capture inputs, outputs, and metadata
|
|
66
|
+
- 🔄 **Async Support**: Works with both sync and async functions
|
|
67
|
+
- 🎯 **Framework Integration**: Built-in support for LangChain and LangGraph
|
|
68
|
+
|
|
69
|
+
## Documentation
|
|
70
|
+
|
|
71
|
+
For detailed documentation, visit [https://docs.fluxloop.dev](https://docs.fluxloop.dev)
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
Apache License 2.0 - see LICENSE file for details
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## Framework Integration: Decorator Ordering and Safe Instrumentation
|
|
79
|
+
|
|
80
|
+
When integrating FluxLoop with external agent frameworks (e.g., ChatKit, LangChain), follow these rules to avoid type conflicts and ensure observations are captured reliably.
|
|
81
|
+
|
|
82
|
+
- Outermost framework wrapper: If a framework provides its own decorator/wrapper that transforms a plain function into a framework-specific object (e.g., a Tool), that decorator MUST be the outermost (top) decorator. This preserves the type the framework expects.
|
|
83
|
+
- FluxLoop instrumentation inside: Place FluxLoop decorators inside (below) the framework decorator, or instrument from within the function body using the SDK context APIs.
|
|
84
|
+
|
|
85
|
+
Two safe patterns:
|
|
86
|
+
|
|
87
|
+
- Pattern A (safest, framework-agnostic): instrument inside the function body
|
|
88
|
+
- Use `get_current_context()` and push/pop an `ObservationData` manually around your logic. This keeps signatures and framework typing unchanged.
|
|
89
|
+
- Example (tool function):
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from fluxloop import get_current_context
|
|
93
|
+
from fluxloop.models import ObservationData, ObservationType
|
|
94
|
+
|
|
95
|
+
async def my_tool(param: str) -> dict:
|
|
96
|
+
fl_ctx = get_current_context()
|
|
97
|
+
obs = None
|
|
98
|
+
if fl_ctx and fl_ctx.is_enabled():
|
|
99
|
+
obs = ObservationData(
|
|
100
|
+
type=ObservationType.TOOL,
|
|
101
|
+
name="tool.my_tool",
|
|
102
|
+
input={"args": {"param": param}},
|
|
103
|
+
)
|
|
104
|
+
fl_ctx.push_observation(obs)
|
|
105
|
+
|
|
106
|
+
try:
|
|
107
|
+
result = {"result": do_work(param)}
|
|
108
|
+
if obs:
|
|
109
|
+
obs.output = result
|
|
110
|
+
return result
|
|
111
|
+
except Exception as e:
|
|
112
|
+
if obs:
|
|
113
|
+
obs.error = str(e)
|
|
114
|
+
raise
|
|
115
|
+
finally:
|
|
116
|
+
if fl_ctx and obs:
|
|
117
|
+
fl_ctx.pop_observation()
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- Pattern B (stacking decorators): framework outermost, FluxLoop inside
|
|
121
|
+
- Example with a framework tool decorator:
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
@framework_tool_decorator(...)
|
|
125
|
+
@fluxloop.tool(name="tool.my_tool")
|
|
126
|
+
async def my_tool(...):
|
|
127
|
+
...
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
- Important: If you reverse the order (FluxLoop outside), the framework may see a plain function instead of its expected type and raise errors like "Unknown tool type".
|
|
131
|
+
|
|
132
|
+
LLM/streaming calls:
|
|
133
|
+
|
|
134
|
+
- For LLM calls (including async generators/streams), either:
|
|
135
|
+
- Wrap the call site in a small helper decorated with `@fluxloop.prompt(...)`, or
|
|
136
|
+
- Use `with fluxloop.instrument("prompt.name"):` around the portion that produces model output, ensuring it runs inside the current FluxLoop context.
|
|
137
|
+
|
|
138
|
+
These patterns guarantee observations are captured (`tool`, `generation`) while keeping the external framework’s type system intact.
|
|
139
|
+
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "fluxloop"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.3"
|
|
8
8
|
description = "FluxLoop SDK for agent instrumentation and tracing"
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "FluxLoop Team", email = "team@fluxloop.dev"}
|
|
@@ -49,10 +49,10 @@ langgraph = [
|
|
|
49
49
|
]
|
|
50
50
|
|
|
51
51
|
[project.urls]
|
|
52
|
-
Homepage = "https://github.com/
|
|
52
|
+
Homepage = "https://github.com/chuckgu/fluxloop"
|
|
53
53
|
Documentation = "https://docs.fluxloop.dev"
|
|
54
|
-
Repository = "https://github.com/
|
|
55
|
-
Issues = "https://github.com/
|
|
54
|
+
Repository = "https://github.com/chuckgu/fluxloop"
|
|
55
|
+
Issues = "https://github.com/chuckgu/fluxloop/issues"
|
|
56
56
|
|
|
57
57
|
[tool.setuptools.packages.find]
|
|
58
58
|
where = ["."]
|
fluxloop-0.1.2/PKG-INFO
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: fluxloop
|
|
3
|
-
Version: 0.1.2
|
|
4
|
-
Summary: FluxLoop SDK for agent instrumentation and tracing
|
|
5
|
-
Author-email: FluxLoop Team <team@fluxloop.dev>
|
|
6
|
-
License: Apache-2.0
|
|
7
|
-
Project-URL: Homepage, https://github.com/fluxloop/fluxloop
|
|
8
|
-
Project-URL: Documentation, https://docs.fluxloop.dev
|
|
9
|
-
Project-URL: Repository, https://github.com/fluxloop/fluxloop
|
|
10
|
-
Project-URL: Issues, https://github.com/fluxloop/fluxloop/issues
|
|
11
|
-
Classifier: Development Status :: 3 - Alpha
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Requires-Python: >=3.8
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: pydantic>=2.0
|
|
23
|
-
Requires-Dist: httpx>=0.24.0
|
|
24
|
-
Requires-Dist: python-dotenv>=1.0.0
|
|
25
|
-
Provides-Extra: dev
|
|
26
|
-
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
27
|
-
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
28
|
-
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
29
|
-
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
30
|
-
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
31
|
-
Requires-Dist: black>=23.0; extra == "dev"
|
|
32
|
-
Provides-Extra: langchain
|
|
33
|
-
Requires-Dist: langchain>=0.1.0; extra == "langchain"
|
|
34
|
-
Provides-Extra: langgraph
|
|
35
|
-
Requires-Dist: langgraph>=0.0.20; extra == "langgraph"
|
|
36
|
-
|
|
37
|
-
# FluxLoop SDK
|
|
38
|
-
|
|
39
|
-
FluxLoop SDK for agent instrumentation and tracing.
|
|
40
|
-
|
|
41
|
-
## Installation
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
pip install fluxloop
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Quick Start
|
|
48
|
-
|
|
49
|
-
```python
|
|
50
|
-
from fluxloop import trace, FluxLoopClient
|
|
51
|
-
|
|
52
|
-
# Initialize the client
|
|
53
|
-
client = FluxLoopClient()
|
|
54
|
-
|
|
55
|
-
# Use the trace decorator
|
|
56
|
-
@trace()
|
|
57
|
-
def my_agent_function(prompt: str):
|
|
58
|
-
# Your agent logic here
|
|
59
|
-
return result
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Features
|
|
63
|
-
|
|
64
|
-
- 🔍 **Automatic Tracing**: Instrument your agent code with simple decorators
|
|
65
|
-
- 📊 **Rich Context**: Capture inputs, outputs, and metadata
|
|
66
|
-
- 🔄 **Async Support**: Works with both sync and async functions
|
|
67
|
-
- 🎯 **Framework Integration**: Built-in support for LangChain and LangGraph
|
|
68
|
-
|
|
69
|
-
## Documentation
|
|
70
|
-
|
|
71
|
-
For detailed documentation, visit [https://docs.fluxloop.dev](https://docs.fluxloop.dev)
|
|
72
|
-
|
|
73
|
-
## License
|
|
74
|
-
|
|
75
|
-
Apache License 2.0 - see LICENSE file for details
|
|
76
|
-
|
fluxloop-0.1.2/README.md
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# FluxLoop SDK
|
|
2
|
-
|
|
3
|
-
FluxLoop SDK for agent instrumentation and tracing.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pip install fluxloop
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Quick Start
|
|
12
|
-
|
|
13
|
-
```python
|
|
14
|
-
from fluxloop import trace, FluxLoopClient
|
|
15
|
-
|
|
16
|
-
# Initialize the client
|
|
17
|
-
client = FluxLoopClient()
|
|
18
|
-
|
|
19
|
-
# Use the trace decorator
|
|
20
|
-
@trace()
|
|
21
|
-
def my_agent_function(prompt: str):
|
|
22
|
-
# Your agent logic here
|
|
23
|
-
return result
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Features
|
|
27
|
-
|
|
28
|
-
- 🔍 **Automatic Tracing**: Instrument your agent code with simple decorators
|
|
29
|
-
- 📊 **Rich Context**: Capture inputs, outputs, and metadata
|
|
30
|
-
- 🔄 **Async Support**: Works with both sync and async functions
|
|
31
|
-
- 🎯 **Framework Integration**: Built-in support for LangChain and LangGraph
|
|
32
|
-
|
|
33
|
-
## Documentation
|
|
34
|
-
|
|
35
|
-
For detailed documentation, visit [https://docs.fluxloop.dev](https://docs.fluxloop.dev)
|
|
36
|
-
|
|
37
|
-
## License
|
|
38
|
-
|
|
39
|
-
Apache License 2.0 - see LICENSE file for details
|
|
40
|
-
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: fluxloop
|
|
3
|
-
Version: 0.1.2
|
|
4
|
-
Summary: FluxLoop SDK for agent instrumentation and tracing
|
|
5
|
-
Author-email: FluxLoop Team <team@fluxloop.dev>
|
|
6
|
-
License: Apache-2.0
|
|
7
|
-
Project-URL: Homepage, https://github.com/fluxloop/fluxloop
|
|
8
|
-
Project-URL: Documentation, https://docs.fluxloop.dev
|
|
9
|
-
Project-URL: Repository, https://github.com/fluxloop/fluxloop
|
|
10
|
-
Project-URL: Issues, https://github.com/fluxloop/fluxloop/issues
|
|
11
|
-
Classifier: Development Status :: 3 - Alpha
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Requires-Python: >=3.8
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: pydantic>=2.0
|
|
23
|
-
Requires-Dist: httpx>=0.24.0
|
|
24
|
-
Requires-Dist: python-dotenv>=1.0.0
|
|
25
|
-
Provides-Extra: dev
|
|
26
|
-
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
27
|
-
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
28
|
-
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
29
|
-
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
30
|
-
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
31
|
-
Requires-Dist: black>=23.0; extra == "dev"
|
|
32
|
-
Provides-Extra: langchain
|
|
33
|
-
Requires-Dist: langchain>=0.1.0; extra == "langchain"
|
|
34
|
-
Provides-Extra: langgraph
|
|
35
|
-
Requires-Dist: langgraph>=0.0.20; extra == "langgraph"
|
|
36
|
-
|
|
37
|
-
# FluxLoop SDK
|
|
38
|
-
|
|
39
|
-
FluxLoop SDK for agent instrumentation and tracing.
|
|
40
|
-
|
|
41
|
-
## Installation
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
pip install fluxloop
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Quick Start
|
|
48
|
-
|
|
49
|
-
```python
|
|
50
|
-
from fluxloop import trace, FluxLoopClient
|
|
51
|
-
|
|
52
|
-
# Initialize the client
|
|
53
|
-
client = FluxLoopClient()
|
|
54
|
-
|
|
55
|
-
# Use the trace decorator
|
|
56
|
-
@trace()
|
|
57
|
-
def my_agent_function(prompt: str):
|
|
58
|
-
# Your agent logic here
|
|
59
|
-
return result
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Features
|
|
63
|
-
|
|
64
|
-
- 🔍 **Automatic Tracing**: Instrument your agent code with simple decorators
|
|
65
|
-
- 📊 **Rich Context**: Capture inputs, outputs, and metadata
|
|
66
|
-
- 🔄 **Async Support**: Works with both sync and async functions
|
|
67
|
-
- 🎯 **Framework Integration**: Built-in support for LangChain and LangGraph
|
|
68
|
-
|
|
69
|
-
## Documentation
|
|
70
|
-
|
|
71
|
-
For detailed documentation, visit [https://docs.fluxloop.dev](https://docs.fluxloop.dev)
|
|
72
|
-
|
|
73
|
-
## License
|
|
74
|
-
|
|
75
|
-
Apache License 2.0 - see LICENSE file for details
|
|
76
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|