https://github.com/extensible-ai/extensitrace
Trace logging for Agents
https://github.com/extensible-ai/extensitrace
llm logging tracing
Last synced: 11 months ago
JSON representation
Trace logging for Agents
- Host: GitHub
- URL: https://github.com/extensible-ai/extensitrace
- Owner: Extensible-AI
- License: apache-2.0
- Created: 2024-03-15T22:45:00.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-09T22:47:01.000Z (almost 2 years ago)
- Last Synced: 2025-04-18T19:29:00.589Z (11 months ago)
- Topics: llm, logging, tracing
- Language: Python
- Homepage: https://extensible.dev
- Size: 149 KB
- Stars: 7
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ExtensiTrace
### Python Package for Agent Workflow Tracking
ExtensiTrace allows for a simple way to track all agent actions including python functions and all openai tool calls.
### Install from PyPI
`pip install extensitrace`
### Usage
```python
from extensitrace import ExtensiTrace
client = OpenAI() # Optional to pass in
connector = MongoConnector(...) # Optional connector, defaults to local
# Logger writes to a jsonl file locally by default
et: ExtensiTrace = ExtensiTrace(connector=connector) # See constructor in extensitrace/extensitrace.py for more info
# Need track=True for top level
et.log(track=True)
def top_level_func():
lower_level_func()
et.log()
def lower_level_func():
pass
```
### Notes to keep in mind
- Tracks one openai call per function
- Streaming openai calls not captured - the tracer is meant for tracking tool calls
- Support for Openai only right now
- The client objects should be the same across files if it is being passed in manually
- Singleton class, however instantiation methods across files must match, recommend creating and importing from a file (see example below)
- If this is very useful to you and want to use it in prod I'm happy to write an async interface for log dumps
### Recommended Setup
`tracer.py`
```python
from extensitrace import ExtensiTrace
et: ExtensiTrace = ExtensiTrace(connector=connector)
```
`main.py`
```python
from tracer import et
```