#
What I Built
AI agents can perform many tasks automatically, but sometimes something goes wrong during execution.
An agent may call the same tool repeatedly, fail to complete a task, or experience unexpected delays. Finding the exact reason inside execution logs can be difficult.
That's why I built PHANTOMTRACE.
PHANTOMTRACE is a local-first AI agent trace investigation dashboard. It helps developers inspect AI agent execution logs, identify unusual behavior, and understand possible problems.
The idea is simple:
Find the ghost hiding inside your AI agent's execution trace! π»
#
π₯ Live Demo Video
Watch my PHANTOMTRACE demonstration:
In this demonstration, I show:
- The PHANTOMTRACE dashboard.
- a sample JSONL execution log.
- Detecting anomalies.
- Viewing issue severity.
- Selecting an anomaly for investigation.
- Generating an explanation using Gemma 3 1B through Ollama.
#
π» Project Repository
GitHub: https://github.com/tk1981215/PHANTOMTRACE
#
π οΈ Technologies Used
- Python
- Streamlit
- Pandas
- Plotly
- Ollama
- Gemma 3 1B
- JSONL
- SQLite
#
βοΈ How PHANTOMTRACE Works
PHANTOMTRACE follows a simple workflow:
Load execution logs: Users can select bundled sample logs or upload their own JSONL agent logs. 2. Parse events: The application reads the log records and converts them into structured events. 3. Detect anomalies: The detection module analyzes the events and identifies suspicious behavior. 4. Visualize traces: The dashboard displays execution events, latency, tokens, and detected issues. 5. Investigate with AI: Users select an anomaly and ask the local Gemma model to explain what happened and suggest a possible fix. 6. Save investigations: Runs can be stored locally using SQLite.
#
π€ Open-Source AI: Ollama and Gemma 3 1B
One important part of PHANTOMTRACE is its local AI integration.
I used:
Ollama to run the model locally. #
Gemma 3 1B as the local language model.
When a user selects an anomaly, PHANTOMTRACE prepares a prompt containing the issue details and nearby execution events.
The prompt is sent to Ollama's local API, and Gemma generates a short debugging explanation.
The model runs locally on my computer using CPU inference.
#
π Why Open Innovation Matters
I believe open innovation is important because developers should have more control over their tools and data.
PHANTOMTRACE uses local inference instead of sending trace information to an external AI API.
This provides several benefits:
- Better control over potentially sensitive execution logs.
- No external AI API key required for local explanations.
- Freedom to experiment with different locally installed models.
- More control over how the AI investigation works.
- An approach that can run without an internet connection once the model and dependencies are installed.
Open-source AI makes it possible for developers to experiment, learn, customize, and build useful tools without depending entirely on closed AI services.
#
π» Challenges I Faced
Building PHANTOMTRACE was a learning experience.
Some challenges I faced included:
- Understanding AI agent execution logs.
- Designing an anomaly detection workflow.
- Connecting a Python application to Ollama.
- Running a language model locally on a CPU-only computer.
- Keeping the application lightweight.
Working through these challenges helped me understand how local AI models can be integrated into practical developer tools.
#
π What I Learned
While building this project, I learned:
- How to work with JSONL execution logs.
- How to organize a Python project into modules.
- How to build dashboards using Streamlit.
- How to visualize execution data with Plotly.
- How to connect Ollama with Python.
- How to use Gemma 3 1B for local AI explanations.
#
π Future Improvements
I would like to improve PHANTOMTRACE by adding:
- More advanced anomaly detection.
- Better retry and repeated-tool-call analysis.
- Investigation reports with more context.
- Support for additional local language models.
- More interactive trace visualizations.
#
β€οΈ Final Thoughts
PHANTOMTRACE started with a simple idea: make it easier to understand what goes wrong inside AI agent workflows.
This project helped me explore Python, open-source AI, local language models, and application development.
I am excited to continue improving it and learning more about the open-source AI ecosystem.
Sometimes the biggest problems in an AI agent are hidden in its execution trace. PHANTOMTRACE helps find those ghosts! π»
Thank you for reading!
GitHub: https://github.com/tk1981215/PHANTOMTRACE
#
devchallenge #hf26challenge #opensource #ai