This repository contains the code, scripts, and analysis pipeline for studying the network-level behavior of LLM-based AI agents. The project accompanies the paper:
MAGIC 2026 Β· Management of Agentic Interaction and Communication CNSM 2026 Workshop β AlcalΓ‘ de Henares (Madrid), Spain Β· 26β30 October, 2026
The goal of this work is to understand how different Large Language Model (LLM)-based agents behave on the network when they execute realistic tasks. We analyze traffic generated by both single-agent and multi-agent workflows across different LLM backends, tasks, and reasoning styles.
The study focuses on encrypted traffic metadata only. No application payload inspection is required.
- Overview
- Code Structure and Execution
- Research Questions
- Methodology
- Supported LLM Backends
- Task Configurations
- Network Traffic Capture
- Traffic Analysis Pipeline
- Machine Learning Classification
LLM-based AI agents increasingly perform multi-step reasoning, invoke external tools, and interact with remote APIs. These interactions generate network traffic that may reveal information about the agent backend, task type, and execution mode.
This repository provides a reproducible framework for:
- Running LLM-based AI agents with different model backends.
- Capturing packet-level network traffic during agent execution.
- Storing traffic traces as PCAP files.
- Extracting packet-, flow-, and burst-level features.
- Comparing traffic behavior across tasks, models, and agent architectures.
- Training machine learning classifiers to identify the backend model and execution type from encrypted traffic metadata.
The repository is organized into four main directories, reflecting the pipeline from agent execution to traffic analysis to ML classification:
agents/ Agent implementations (single-agent ReAct, multi-agent planner/executor), Dockerfile
analysis/ PCAP parsing, feature extraction, and traffic visualization
experiements/ Scripts that orchestrate repeated/systematic agent runs
ml/ Feature-matrix conversion, Random Forest model, training/testing
react_agent.pyβ single-agent ReAct (Thought β Action β Observation β Answer) implementation. Supports OpenAI, Gemini, DeepSeek, and Ollama (Llama/Qwen/Mistral) backends, aweather_nowtool (Open-Meteo), optional Google/SerpAPI search, and a "no-tools" mode. Captures all traffic generated during execution withscapyand writes it to a.pcapfile, alongsideevents.jsonl/summary.jsonllogs.planner_executor_agent.pyβ multi-agent implementation decomposed into Planner, Executor, and Synthesizer roles (built onlangchain.agents.create_agent), used to study coordination overhead versus the single-agent case. Also captures traffic withscapy.Dockerfile/requirements.txtβ package an agent into a container so that only its own traffic is captured, isolated from unrelated host traffic.
pcap_tools.pyβ shared helpers (built onscapyandpyshark) for parsing.pcapfiles into packet/flow tuples, separating inbound vs. outbound traffic by client IP, and computing burst statistics.pcap_analysis.pyβ CLI script that reads a.pcapfile and produces packet-count burst plots and transfer-volume plots, given a--client-ip.pcap_clean.ipynb,traffic_analysis.ipynb,band_plot.ipynbβ exploratory/descriptive analysis notebooks over captured traces.pcap2mtam.ipynbβ converts cleaned.pcaptraces into the traffic-matrix (TAM).npzarrays consumed by the ML pipeline inml/datasets.
- Scripts named
run{ID_or_name}.py(e.g.run1.py,run_random_prompt_120.py,run_research_agent_100.py,run_weather_agent_100.py,run_no-tools_agent_100.py,run_random_planner.py) each launch thereact-agent(or planner/executor) Docker container repeatedly across backends/prompts to build up a labeled traffic dataset. prompts.jsonβ prompt sets driving the runs above.error_detector.ipynbβ checks run outputs/logs for failures.- Produces
pcap/run{ID_or_name}/andoutput/run{ID_or_name}/subdirectories (created automatically) holding the raw traces and container outputs for each batch.
Adapted from Robust Fingerprinting and adjusted to this project's six-class problem (single-/multi-agent Γ OpenAI/Gemini/DeepSeek).
const_rf.pyβ shared constants (paths, class counts, TAM matrix length).train.py/test.pyβ train and evaluate the Random Forest classifier (PyTorch) on the.npzdatasets.pre_recall.pyβ precision/recall/weighted-accuracy reporting.models/RF.pyβ the RF model architecture;models/RandomForest_classifier*.ipynbβ notebook variants (binary and multi-class).datasets/β pre-generated.npztrain/test splits (no-tools_random_*,random_prompt_*,research_agent_*,research_random_*).
- Build the agent image (from
agents/):docker build -t react-agent . - Run an agent while capturing traffic:
For systematic/batch data collection instead of a single run, use or adapt a script in
docker run --rm -e GEMINI_API_KEY=<key> -v "$(pwd)/pcap:/app/pcap" react-agent \ --prompt="What is the weather forecast in London, UK?" --backend=gemini
experiements/(see that directory's README). - Inspect a single trace (from
analysis/):python pcap_analysis.py ./pcap/react/openai-gpt-4o-mini-20251125-123406.pcap --client-ip=10.47.9.55
- Build ML datasets: run
analysis/pcap2mtam.ipynbto convert collected.pcaptraces into the.npzTAM arrays underml/datasets/. - Train / evaluate the classifier (from
ml/):python train.py python test.py
This project investigates the following questions:
- Do LLM-based AI agents produce measurable and reproducible network traffic signatures?
- How do task type, tool usage, and reasoning style affect traffic volume, latency, burstiness, and flow behavior?
- How does multi-agent coordination change the network footprint compared with single-agent execution?
- Can encrypted traffic metadata be used to identify the underlying LLM backend and execution type?
The methodology consists of five main stages:
- Agent execution
- Network traffic capture
- PCAP trace storage
- Feature extraction and traffic analysis
- Machine learning-based model identification
The experiments evaluate two execution paradigms.
In the single-agent setting, one LLM-based agent is responsible for:
- Understanding the user prompt
- Reasoning about the task
- Invoking tools when needed
- Producing the final response
This architecture represents a standard tool-using AI agent workflow.
In the multi-agent setting, the workflow is decomposed into multiple coordinated roles:
- Planner: decomposes the task into structured subtasks.
- Executor: performs each subtask and invokes external tools when needed.
- Synthesizer: aggregates intermediate results and generates the final answer.
This architecture allows us to study how coordination between multiple LLM-based components affects network behavior.
The experimental framework supports multiple LLM providers, including:
- OpenAI
- Google Gemini
- DeepSeek
The main paper evaluates representative models from OpenAI, Gemini, and DeepSeek under comparable task settings.
The experiments use three representative task categories.
A tool-dependent task that retrieves real-time weather information and generates recommendations based on the result.
Example prompt:
Get the current weather for London and recommend activities based on the conditions.
A reasoning-only task where the model is restricted from using external tools. This configuration isolates the traffic generated mainly by LLM inference calls.
A tool-intensive task involving structured research search and abstract retrieval. This configuration uses external APIs such as the SCOPUS / Elsevier API and produces richer multi-step interaction patterns.
Example prompt:
What is the most cited machine learning paper in 2020?
Traffic is captured passively during each agent execution.
The capture process records all packets generated by the agent container, including:
- Agent-to-LLM API traffic
- Agent-to-tool API traffic
- Responses from remote services
- Traffic generated during multi-agent coordination
Packet capture is performed using Python-based tooling such as scapy and stored in standard .pcap format.
To improve isolation, the agents can be executed inside a Docker container. This reduces interference from unrelated host traffic and makes the generated traces easier to analyze.
After execution, the generated PCAP traces are processed offline.
The analysis pipeline extracts traffic features such as:
- Total packet count
- Total bytes sent
- Total bytes received
- Inbound and outbound traffic ratios
- Execution duration / latency
- TCP stream count
- Packet rate statistics
- Burst size
- Burst duration
- Temporal traffic structure
A traffic burst is defined as a period of network activity separated by at least 0.5 seconds of inactivity.
These features are used for both descriptive traffic analysis and supervised machine learning experiments.
The project evaluates whether encrypted network metadata can be used to identify:
The LLM backend The execution type: single-agent or multi-agent
This is formulated as a six-class classification problem:
Single-agent OpenAI Single-agent Gemini Single-agent DeepSeek Multi-agent OpenAI Multi-agent Gemini Multi-agent DeepSeek
A Random Forest classifier is used because it is robust for tabular network traffic features and can capture nonlinear relationships between packet-level, flow-level, and burst-level metrics.
The paper reports high classification accuracy across tasks, showing that LLM-based agents produce identifiable network signatures even when payloads are encrypted.
The study shows that:
LLM-based agents generate structured and measurable network traffic patterns. Task type strongly affects traffic volume and temporal behavior. Tool-augmented and research-assistant tasks produce more complex traffic than no-tools tasks. Multi-agent workflows introduce longer burst durations, higher variability, and more interleaved flows. Backend-specific traffic signatures remain visible across both single-agent and multi-agent executions. Encrypted traffic metadata can be used to identify both backend model and execution mode with high accuracy.
These findings have implications for:
Network monitoring AI traffic characterization Infrastructure provisioning Traffic engineering Privacy-preserving AI agent design Traffic fingerprinting defenses