visualagents 0.1.0__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 (55) hide show
  1. visualagents-0.1.0/.gitignore +17 -0
  2. visualagents-0.1.0/LICENSE +21 -0
  3. visualagents-0.1.0/PKG-INFO +438 -0
  4. visualagents-0.1.0/README.md +399 -0
  5. visualagents-0.1.0/examples/crewai_project/src/research_crew/__init__.py +0 -0
  6. visualagents-0.1.0/examples/crewai_project/src/research_crew/config/agents.yaml +18 -0
  7. visualagents-0.1.0/examples/crewai_project/src/research_crew/config/tasks.yaml +15 -0
  8. visualagents-0.1.0/examples/crewai_project/src/research_crew/crew.py +37 -0
  9. visualagents-0.1.0/examples/crewai_project/src/research_crew/main.py +9 -0
  10. visualagents-0.1.0/examples/langgraph_supervisor/app.py +122 -0
  11. visualagents-0.1.0/examples/manual_sdk/.visualagents/blueprint.json +24 -0
  12. visualagents-0.1.0/examples/manual_sdk/app.py +50 -0
  13. visualagents-0.1.0/pyproject.toml +55 -0
  14. visualagents-0.1.0/tests/conftest.py +8 -0
  15. visualagents-0.1.0/tests/test_launcher.py +76 -0
  16. visualagents-0.1.0/tests/test_llm_and_cli.py +204 -0
  17. visualagents-0.1.0/tests/test_openai_hook.py +135 -0
  18. visualagents-0.1.0/tests/test_server_runner.py +149 -0
  19. visualagents-0.1.0/tests/test_static_scan.py +113 -0
  20. visualagents-0.1.0/tests/test_tracker.py +193 -0
  21. visualagents-0.1.0/tests/test_wizard.py +100 -0
  22. visualagents-0.1.0/tests/test_zero_friction.py +129 -0
  23. visualagents-0.1.0/visualagents/__init__.py +20 -0
  24. visualagents-0.1.0/visualagents/__main__.py +3 -0
  25. visualagents-0.1.0/visualagents/_autoinstrument/__init__.py +0 -0
  26. visualagents-0.1.0/visualagents/_autoinstrument/sitecustomize.py +40 -0
  27. visualagents-0.1.0/visualagents/_autoinstrument/visualagents_runtime.py +864 -0
  28. visualagents-0.1.0/visualagents/_hook/visualagents_boot.py +42 -0
  29. visualagents-0.1.0/visualagents/blueprint.py +276 -0
  30. visualagents-0.1.0/visualagents/cli.py +726 -0
  31. visualagents-0.1.0/visualagents/collector.py +146 -0
  32. visualagents-0.1.0/visualagents/demo/__init__.py +0 -0
  33. visualagents-0.1.0/visualagents/demo/blueprint.json +68 -0
  34. visualagents-0.1.0/visualagents/demo/research_crew.py +146 -0
  35. visualagents-0.1.0/visualagents/detect.py +337 -0
  36. visualagents-0.1.0/visualagents/home.py +139 -0
  37. visualagents-0.1.0/visualagents/hooks.py +63 -0
  38. visualagents-0.1.0/visualagents/hub.py +143 -0
  39. visualagents-0.1.0/visualagents/launcher.py +87 -0
  40. visualagents-0.1.0/visualagents/llm.py +314 -0
  41. visualagents-0.1.0/visualagents/narrator.py +58 -0
  42. visualagents-0.1.0/visualagents/patterns.py +81 -0
  43. visualagents-0.1.0/visualagents/projects.py +140 -0
  44. visualagents-0.1.0/visualagents/runner.py +355 -0
  45. visualagents-0.1.0/visualagents/scanner.py +91 -0
  46. visualagents-0.1.0/visualagents/sdk.py +18 -0
  47. visualagents-0.1.0/visualagents/server.py +209 -0
  48. visualagents-0.1.0/visualagents/static_scan.py +677 -0
  49. visualagents-0.1.0/visualagents/termui.py +94 -0
  50. visualagents-0.1.0/visualagents/tracker.py +501 -0
  51. visualagents-0.1.0/visualagents/tui.py +240 -0
  52. visualagents-0.1.0/visualagents/web/app.js +1753 -0
  53. visualagents-0.1.0/visualagents/web/index.html +117 -0
  54. visualagents-0.1.0/visualagents/web/styles.css +551 -0
  55. visualagents-0.1.0/visualagents/wizard.py +331 -0
@@ -0,0 +1,17 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .venv/
5
+ venv/
6
+ dist/
7
+ build/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .mypy_cache/
11
+ .DS_Store
12
+ .env
13
+ # per-project VisualAgents state (example blueprints are kept on purpose)
14
+ .visualagents/runs/
15
+ visualagents/demo/.visualagents/
16
+ examples/langgraph_supervisor/.visualagents/
17
+ examples/crewai_project/.visualagents/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 VisualAgents 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,438 @@
1
+ Metadata-Version: 2.5
2
+ Name: visualagents
3
+ Version: 0.1.0
4
+ Summary: A live map of which agent in a multi-agent AI system is doing what - from its chain of thought.
5
+ Project-URL: Homepage, https://github.com/kaih06-hub/VisualAgents
6
+ Project-URL: Documentation, https://github.com/kaih06-hub/VisualAgents#readme
7
+ Project-URL: Issues, https://github.com/kaih06-hub/VisualAgents/issues
8
+ Project-URL: Changelog, https://github.com/kaih06-hub/VisualAgents/blob/main/CHANGELOG.md
9
+ Author: VisualAgents contributors
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: agents,autogen,claude,crewai,gemini,langgraph,llm,multi-agent,observability,visualization
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Environment :: Web Environment
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Classifier: Topic :: Software Development :: Debuggers
26
+ Classifier: Topic :: System :: Monitoring
27
+ Requires-Python: >=3.10
28
+ Requires-Dist: anthropic>=1.15
29
+ Provides-Extra: all
30
+ Requires-Dist: google-genai>=2.0; extra == 'all'
31
+ Requires-Dist: openai>=1.40; extra == 'all'
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=8; extra == 'dev'
34
+ Provides-Extra: google
35
+ Requires-Dist: google-genai>=2.0; extra == 'google'
36
+ Provides-Extra: openai
37
+ Requires-Dist: openai>=1.40; extra == 'openai'
38
+ Description-Content-Type: text/markdown
39
+
40
+ <p align="center">
41
+ <img src="https://raw.githubusercontent.com/kaih06-hub/VisualAgents/main/docs/logo.svg" width="112" alt="VisualAgents logo">
42
+ </p>
43
+
44
+ <h1 align="center">VisualAgents</h1>
45
+
46
+ <p align="center">
47
+ <b>A live map of which agent in your multi-agent AI system is doing what — built from its chain of thought.</b>
48
+ </p>
49
+
50
+ <p align="center">
51
+ <a href="https://github.com/kaih06-hub/VisualAgents/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/kaih06-hub/VisualAgents/actions/workflows/ci.yml/badge.svg"></a>
52
+ <img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-3776AB?logo=python&logoColor=white">
53
+ <img alt="MIT license" src="https://img.shields.io/badge/license-MIT-2ea44f">
54
+ <img alt="Runs locally" src="https://img.shields.io/badge/runs-100%25%20locally-555">
55
+ <img alt="LangGraph, CrewAI, AutoGen, OpenAI Agents and more" src="https://img.shields.io/badge/works%20with-LangGraph%20·%20CrewAI%20·%20AutoGen%20·%20OpenAI%20Agents-3987e5">
56
+ </p>
57
+
58
+ <p align="center">
59
+ <img src="https://raw.githubusercontent.com/kaih06-hub/VisualAgents/main/docs/images/demo.gif" width="920" alt="VisualAgents following a four-agent research crew: the planner, researcher, writer and critic light up in turn while their chain of thought streams on the right">
60
+ </p>
61
+
62
+ Multi-agent apps usually show you one long stream of thoughts and tool calls. You can't tell which specialist is
63
+ working, where the request is in the workflow, or why it just looped back. **VisualAgents** reads your agent
64
+ project, draws its agents and handoffs as a map, and lights that map up live while the agent works — from the
65
+ terminal, on your own machine, with no changes to your code.
66
+
67
+ ---
68
+
69
+ **Contents** ·
70
+ [Highlights](#highlights) ·
71
+ [Quick start](#quick-start) ·
72
+ [Watching an agent live](#watching-an-agent-live) ·
73
+ [The dashboard](#the-dashboard) ·
74
+ [How it works](#how-it-works) ·
75
+ [Supported frameworks](#supported-frameworks) ·
76
+ [Choosing the LLM](#choosing-the-llm-that-draws-the-map) ·
77
+ [Instrument anything](#instrument-anything-yourself) ·
78
+ [Examples](#examples) ·
79
+ [CLI reference](#cli-reference) ·
80
+ [Privacy](#privacy-and-security) ·
81
+ [Troubleshooting](#troubleshooting)
82
+
83
+ ---
84
+
85
+ ## Highlights
86
+
87
+ - **Maps any agent repo.** Static analysis understands LangGraph, CrewAI, AutoGen, the OpenAI Agents SDK, Swarm,
88
+ Google ADK, smolagents, LlamaIndex and raw OpenAI-SDK apps; an optional LLM pass (Claude, GPT, Gemini or a local
89
+ model) adds roles, tools, handoffs and the step-by-step workflow.
90
+ - **Live map.** The working agent glows with a thought bubble, handoffs animate along the arrows (with ×N counts
91
+ for loops), workflow steps tick off, and the chain of thought streams beside it — colour-coded per agent.
92
+ - **Rewind and replay.** A time ruler shows every agent's turn. Drag back to any second and the whole dashboard
93
+ rewinds; press play to replay at up to 16×. Every run is recorded and can be replayed later.
94
+ - **No setup per project.** Run `visualagents` and answer three questions. It finds how the project starts, uses
95
+ the project's own virtualenv, and remembers your choices. Or `hook` a folder once and keep running your agent
96
+ however you like.
97
+ - **Precise where it can be, smart where it can't.** Auto-instrumentation gives exact agent boundaries for
98
+ LangChain/LangGraph, the OpenAI Agents SDK and direct OpenAI-SDK calls; everything else is attributed from the
99
+ console output, with optional LLM narration.
100
+ - **Interactive.** Drag blocks around (arrows follow), hover a line of thought to make its agent bounce, click an
101
+ agent for its own history, switch light/dark, share a link to an exact moment.
102
+ - **Private by default.** Everything runs on `127.0.0.1`. Your code only goes to an LLM if you pick one, with
103
+ secrets redacted first.
104
+
105
+ ## Quick start
106
+
107
+ ### 1. Install
108
+
109
+ Requires Python 3.10+.
110
+
111
+ ```bash
112
+ uv tool install "visualagents[all] @ git+https://github.com/kaih06-hub/VisualAgents.git"
113
+ ```
114
+
115
+ or with pipx: `pipx install "visualagents[all] @ git+https://github.com/kaih06-hub/VisualAgents.git"`.
116
+ Claude support is built in; `[all]` adds Gemini and OpenAI / OpenAI-compatible servers (Ollama, LM Studio, vLLM).
117
+ From a local clone: `uv tool install --editable ./VisualAgents --with google-genai --with openai`.
118
+
119
+ ### 2. See it work (no API key)
120
+
121
+ ```bash
122
+ visualagents demo
123
+ ```
124
+
125
+ A simulated four-agent research crew — planner → researcher → writer ⇄ critic — runs in your terminal while the
126
+ dashboard maps it.
127
+
128
+ ### 3. Point it at your own agent
129
+
130
+ ```bash
131
+ visualagents
132
+ ```
133
+
134
+ Three questions, then your agents' map pops up:
135
+
136
+ ```text
137
+ VisualAgents · a live map of your agents
138
+ Three questions, then your agents' map pops up. Ctrl+C to quit.
139
+
140
+ 1/3 Which project should VisualAgents map?
141
+ ✔ ~/VisualAgents/examples/langgraph_supervisor
142
+
143
+ 2/3 Which LLM should read the code and draw the map?
144
+ ✔ Google Gemini
145
+ Model
146
+ ✔ gemini-2.5-flash
147
+
148
+ 3/3 Google Gemini API key
149
+ Paste it below - it stays hidden · get one at https://aistudio.google.com/apikey · empty = skip
150
+ API key:
151
+ ✔ Key works · 34 models available
152
+ ✔ Saved to ~/.visualagents/keys.json
153
+
154
+ ✔ Found 4 agent(s): Supervisor, Researcher, Coder, Reviewer (langgraph)
155
+ ✔ Map is open at http://127.0.0.1:7420
156
+
157
+ ▶ Watch it live?
158
+ ❯ Start it now python app.py
159
+ Start it with a different command…
160
+ Hook it - I'll start it myself IDE, scripts, notebooks: it shows up whenever it runs
161
+ Just show the map
162
+ ```
163
+
164
+ 1. **Project** — a recent one, the current folder, any path (Tab completes), or a GitHub URL, which it clones.
165
+ 2. **LLM** — Gemini, Claude, OpenAI, a local / OpenAI-compatible server, or offline; then a model (best / cheaper /
166
+ cheapest, or any id).
167
+ 3. **API key** — pasted hidden, checked with a free model-list call, and (if you agree) saved to
168
+ `~/.visualagents/keys.json`, readable only by you. Next time you just press Enter through the defaults.
169
+
170
+ Menus work with the arrow keys (or j/k and numbers).
171
+
172
+ ## Watching an agent live
173
+
174
+ The map moves only while the agent is **actually working**. VisualAgents watches; it doesn't do the work. So:
175
+
176
+ 1. **Start the agent** — choose *Start it now* in the terminal, or press **▶ Start** on the map. VisualAgents runs
177
+ the project's start command in your terminal.
178
+ 2. **Give it a task**, the way that agent takes input:
179
+ - agents that ask questions in the terminal (e.g. TradingAgents asks for a ticker) → answer them there;
180
+ - web-app agents (e.g. LAMBDA) → open the agent's own page and type your request;
181
+ - agents that take the task as an argument → put `{task}` in the start command
182
+ (`visualagents run . -- python main.py "{task}"`) and a *What should it do?* box appears on the dashboard.
183
+ 3. **Watch** the map light up. When the run ends, **▶ Run again** starts the next one.
184
+
185
+ There are three ways to connect VisualAgents to an agent — pick whichever fits how you work:
186
+
187
+ | | Command | Best for |
188
+ |---|---|---|
189
+ | **Guided** | `visualagents` | Getting started: project → LLM → key → map → start. |
190
+ | **Run through it** | `visualagents run <folder>` | Repeating runs. Finds how the project starts (README commands, `start.sh`, FastAPI / Gradio / Streamlit / Chainlit apps, `__main__` scripts, `pyproject`, `package.json`, Makefile), asks once, remembers it in `.visualagents/config.json`, and uses the project's virtualenv (or `uv run` / `poetry run`). |
191
+ | **Hook once** | `visualagents hook <folder>` | Running the agent your usual way — IDE, scripts, notebooks, cron. Installs a one-line startup file into the project's virtualenv; every Python process from it appears on a background dashboard (http://127.0.0.1:7400) as soon as it calls an LLM. `pip`, `pytest` and editor tools stay invisible. |
192
+
193
+ ```bash
194
+ visualagents run ~/projects/my-agent --pick # choose the start command again
195
+ visualagents run ~/projects/my-agent -- python main.py "q" # or give an exact command
196
+ visualagents hook ~/projects/my-agent # then: ./start.sh, your IDE, …
197
+ visualagents status | open <folder> | unhook <folder> | up | down
198
+ ```
199
+
200
+ Start scripts that push the app into the background or send its output to a log file still work: events reach
201
+ the dashboard over HTTP, and `*.log` files the app writes are followed. You can also feed it output you already
202
+ have: `python main.py 2>&1 | visualagents pipe .`, or `visualagents watch . --log run.log`.
203
+
204
+ ## The dashboard
205
+
206
+ ### Live map
207
+
208
+ <img src="https://raw.githubusercontent.com/kaih06-hub/VisualAgents/main/docs/images/live-map.png" alt="The live map: Planner and Researcher done, the Writer revising after the Critic's review, its thought in a bubble; the time ruler shows each agent's turn">
209
+
210
+ - **Graph** — agents laid out in workflow order (left→right, or top→bottom on narrow screens). The working agent
211
+ glows with a bubble showing what it's thinking; finished agents get a ✓; arrows show who hands work to whom,
212
+ with traversal counts. Two-way handoffs are drawn as parallel arrows; handoffs that weren't in the blueprint
213
+ appear dotted, and agents it missed appear dashed.
214
+ - **Steps** — the blueprint's phases across the top, checked off as the run moves through them.
215
+ - **Working now** — the active agent, its current activity, time in this turn, tool calls and handoffs.
216
+ - **Live chain of thought** — every thought, tool call, result and answer, colour-coded per agent; filter by agent
217
+ or hide plain logs. Hover any line and its agent lights up and bounces on the map.
218
+ - **Drag any block** to rearrange the map — arrows follow, positions are remembered per project, and the layout
219
+ button restores the automatic layout. Click a block for that agent's details and its own chain of thought.
220
+
221
+ ### Blueprint
222
+
223
+ <img src="https://raw.githubusercontent.com/kaih06-hub/VisualAgents/main/docs/images/blueprint.png" alt="The blueprint popup: summary, entry and exit agents, a numbered step timeline, then each agent with its role, tools and source file">
224
+
225
+ The first time you open a project the blueprint pops up (press **B** any time): a summary, where requests enter and
226
+ which agent answers, the step-by-step flow, every agent with its role, tools and source location, and every
227
+ handoff. It scrolls in one column, top to bottom.
228
+
229
+ ### Time ruler — rewind and replay
230
+
231
+ <img src="https://raw.githubusercontent.com/kaih06-hub/VisualAgents/main/docs/images/rewind.png" alt="Rewound to 00:17: the Researcher is working, later steps are not reached yet, and the chain of thought after that moment is dimmed">
232
+
233
+ Each agent's turn is a segment on the ruler, with the workflow steps above it. Drag the playhead back and the
234
+ whole dashboard rewinds — who was working, which step, what it was thinking, and the chain of thought up to that
235
+ second (later lines dim). **▶ / Space** replays at 1–16×; **Live / L** jumps back to now.
236
+
237
+ ### Dark mode and small screens
238
+
239
+ <table>
240
+ <tr>
241
+ <td width="72%"><img src="https://raw.githubusercontent.com/kaih06-hub/VisualAgents/main/docs/images/dark.png" alt="The dashboard in dark mode while the Critic reviews the draft"></td>
242
+ <td><img src="https://raw.githubusercontent.com/kaih06-hub/VisualAgents/main/docs/images/phone.png" alt="The dashboard on a phone-sized screen, laid out top to bottom"></td>
243
+ </tr>
244
+ </table>
245
+
246
+ Light, dark or follow the system (button in the top right). On narrow screens the map flows top-to-bottom.
247
+
248
+ ### Shortcuts and links
249
+
250
+ | Key | Action | | Link option | Effect |
251
+ |---|---|---|---|---|
252
+ | `B` | blueprint popup | | `?t=42` | open rewound to 0:42 of the run |
253
+ | `F` | fit the map | | `?theme=dark` / `light` | force a theme |
254
+ | `Space` | play / pause the replay | | `?popup=0` / `1` | hide / show the blueprint popup |
255
+ | `L` | back to live | | `?live=0` | a still snapshot (no streaming) |
256
+ | `←` `→` | step 1 s on the ruler (Shift: 10 s) | | `?project=<id>` | pick a project on the background dashboard |
257
+ | `Esc` | close popups | | | |
258
+
259
+ ## How it works
260
+
261
+ ```mermaid
262
+ flowchart LR
263
+ repo["Your agent project"] -->|static analysis + optional LLM| bp["Blueprint<br/>.visualagents/blueprint.json"]
264
+ repo -->|run · hook · pipe · watch| proc["Agent process"]
265
+ proc -->|framework hooks, OpenAI SDK hook,<br/>console output, log files| engine["Attribution engine"]
266
+ bp --> engine
267
+ engine -->|Server-Sent Events| ui["Dashboard on 127.0.0.1"]
268
+ engine -->|every input| rec[".visualagents/runs/*.jsonl<br/>(replayable)"]
269
+ ```
270
+
271
+ 1. **Blueprint.** `visualagents scan` (run for you on first use) reads the most agent-relevant files. Static
272
+ analysis finds agents, tools and handoffs for the frameworks below; the optional LLM pass returns each agent's
273
+ role, description, tools, source location, log aliases and keywords, the handoff graph, entry/exit agents and
274
+ the general workflow, as schema-checked JSON. You can commit or hand-edit the result.
275
+ 2. **Attribution.** While the agent runs, three sources say which agent is doing what, from most to least precise:
276
+
277
+ | Source | When | What you get |
278
+ |---|---|---|
279
+ | **Auto-instrumentation** | Python apps using LangChain / LangGraph, the OpenAI Agents SDK, or the **OpenAI SDK directly** (any OpenAI-compatible endpoint; sync, async, streaming) | Exact agent boundaries, LLM replies as thoughts, every tool call and result — no code changes. Direct SDK calls are credited to the class or function that made them (e.g. `Programmer`, `Inspector`). Turn off with `--no-instrument`. |
280
+ | **Console patterns** | Always | CrewAI (`# Agent: …`, rich panels), AutoGen (`coder (to critic):`), LangGraph stream output, ReAct (`Thought:` / `Action:` / `Observation:` / `Final Answer:`), handoff phrases (`Handing off to Writer`, `transfer_to_billing`), `[Agent] …` prefixes, and tools owned by one agent. |
281
+ | **LLM narration** (`run --smart`) | Optional | Every few seconds an LLM reads the latest output and names the working agent with a one-line summary. |
282
+
283
+ 3. **Dashboard.** A small local web server streams the state to the browser; the map, steps, feed and ruler are
284
+ rebuilt from the event log, which is what makes rewinding possible.
285
+
286
+ ## Supported frameworks
287
+
288
+ | Framework | Mapped from the code | Followed live |
289
+ |---|---|---|
290
+ | **LangGraph** | `add_node`, `add_edge`, `add_conditional_edges`, `Command(goto=…)`, `create_react_agent`, supervisors | callbacks: exact node turns, LLM replies, tool calls |
291
+ | **LangChain** | agents and their tools | callbacks: thoughts, actions, results |
292
+ | **CrewAI** | `Agent` / `Task` / `Crew`, `config/agents.yaml` + `tasks.yaml`, hierarchical crews | console format |
293
+ | **AutoGen** 0.2 / 0.4 | agents, `GroupChat`, `RoundRobinGroupChat`, `SelectorGroupChat`, `Swarm`, `initiate_chat` | console format |
294
+ | **OpenAI Agents SDK** | `Agent(handoffs=…)`, `as_tool` | tracing: agent spans, handoffs, tools |
295
+ | **OpenAI SDK, used directly** | classes that create or call an LLM client | each call credited to its class/function, with tool calls and results |
296
+ | **Swarm**, **Google ADK**, **smolagents**, **LlamaIndex** | `transfer_to_*`, `sub_agents`, `managed_agents`, `AgentWorkflow` | console patterns, `--smart` |
297
+ | **LangGraph.js**, JS/TS agents | `addNode` / `addEdge`, `new Agent({ name })` | console patterns |
298
+ | **Anything else** | the LLM pass | console patterns, `--smart`, or the SDK below |
299
+
300
+ ## Choosing the LLM that draws the map
301
+
302
+ | Provider | Key | Default map model | Default `--smart` model |
303
+ |---|---|---|---|
304
+ | `anthropic` | `ANTHROPIC_API_KEY` or `ant auth login` | `claude-opus-5-5` | `claude-opus-5-5` |
305
+ | `openai` | `OPENAI_API_KEY` (+ `OPENAI_BASE_URL` for Ollama, LM Studio, vLLM…) | `gpt-5` | `gpt-5` |
306
+ | `google` | `GEMINI_API_KEY` / `GOOGLE_API_KEY` (or Vertex AI) | `gemini-pro-latest` | `gemini-flash-lite-latest` |
307
+
308
+ ```bash
309
+ visualagents models # which providers have keys, and their defaults
310
+ visualagents models --provider google # every model your account can use
311
+ visualagents scan . --provider google --model gemini-2.5-flash
312
+ visualagents scan . --static # offline only
313
+ ```
314
+
315
+ Keys and choices are read from, in order: your shell environment, the project's `.env`, then what the guided
316
+ start saved. You can also set `VISUALAGENTS_PROVIDER`, `VISUALAGENTS_MODEL` and `VISUALAGENTS_NARRATE_MODEL`.
317
+ Gemini requests retry automatically when the model is busy.
318
+
319
+ ## Instrument anything yourself
320
+
321
+ From any language, print a line:
322
+
323
+ ```text
324
+ @@visualagents {"type": "agent_start", "agent": "researcher", "text": "find sources"}
325
+ ```
326
+
327
+ From Python:
328
+
329
+ ```python
330
+ from visualagents import agent, emit, handoff, track
331
+
332
+ with agent("researcher", task="find sources"):
333
+ emit("thought", "researcher", "Start with peer-reviewed numbers")
334
+ emit("tool_start", "researcher", "solid-state battery Wh/kg", tool="web_search")
335
+ handoff("researcher", "writer", "findings ready")
336
+
337
+ @track("critic") # the whole function is the critic's turn
338
+ def review(draft): ...
339
+ ```
340
+
341
+ Event types: `agent_start`, `agent_end`, `thought`, `tool_start`, `tool_end`, `handoff`, `output`, `log`, `error`.
342
+ Under `visualagents run` the dependency-free runtime is importable even if VisualAgents isn't installed in your
343
+ app's environment (`from visualagents_runtime import agent, emit`), and marker lines are hidden from your terminal.
344
+ Without `run`: LangChain → `callbacks=[visualagents.langchain_handler()]`; OpenAI Agents SDK →
345
+ `agents.add_trace_processor(visualagents.openai_agents_processor())`.
346
+
347
+ ## Examples
348
+
349
+ | Example | Try it |
350
+ |---|---|
351
+ | Simulated research crew (built in) | `visualagents demo` |
352
+ | [LangGraph supervisor team](https://github.com/kaih06-hub/VisualAgents/tree/main/examples/langgraph_supervisor) — runs offline | `pip install langgraph` then `visualagents run examples/langgraph_supervisor` |
353
+ | [CrewAI template](https://github.com/kaih06-hub/VisualAgents/tree/main/examples/crewai_project) — YAML agents and tasks | `visualagents scan examples/crewai_project` |
354
+ | [Hand-rolled agents with `emit`](https://github.com/kaih06-hub/VisualAgents/tree/main/examples/manual_sdk) | `visualagents run examples/manual_sdk` |
355
+
356
+ **LAMBDA (a data-science agent).** [LAMBDA](https://github.com/AMA-CMFAI/LAMBDA) is a FastAPI backend plus a React
357
+ UI that calls the OpenAI SDK directly, and its `start.sh` runs both in the background:
358
+
359
+ ```bash
360
+ git clone https://github.com/AMA-CMFAI/LAMBDA.git ~/LAMBDA
361
+ cp ~/LAMBDA/backend/.env.example ~/LAMBDA/backend/.env # add its model key
362
+ visualagents run ~/LAMBDA # pick ./start.sh the first time
363
+ ```
364
+
365
+ Ask LAMBDA something at http://localhost:3000 and watch it at http://127.0.0.1:7420. The paper's
366
+ Programmer ⇄ Inspector design is on its `legacy-open-source` branch, where the map shows the two agents handing
367
+ work back and forth.
368
+
369
+ ## CLI reference
370
+
371
+ ```text
372
+ visualagents guided start (same as `visualagents setup`)
373
+ visualagents demo [--speed N]
374
+ visualagents run [FOLDER] [--pick] [--smart] [--cwd DIR] [--no-instrument] [--no-follow-logs] [-- COMMAND…]
375
+ visualagents hook [FOLDER] [--python PY]…
376
+ visualagents unhook | open [FOLDER]
377
+ visualagents up [--port 7400] [--foreground]
378
+ visualagents down | status
379
+ visualagents scan [FOLDER] [--static | --llm] [--provider auto|anthropic|openai|google] [--model M] [--json] [-o FILE]
380
+ visualagents models [FOLDER] [--provider anthropic|openai|google]
381
+ visualagents show | blueprint [FOLDER]
382
+ visualagents pipe [FOLDER] [--quiet]
383
+ visualagents watch [FOLDER] --log FILE [--from-start] [--echo]
384
+ visualagents replay RECORDING [--project DIR] [--speed N] [--instant]
385
+
386
+ dashboard options: --port 7420 --host 127.0.0.1 --no-browser --blueprint FILE --exit --rescan
387
+ ```
388
+
389
+ `vagents` is a short alias. `visualagents <command> --help` explains every option.
390
+
391
+ ### Files it creates
392
+
393
+ | Where | What |
394
+ |---|---|
395
+ | `<project>/.visualagents/blueprint.json` | the map — commit it or hand-edit it |
396
+ | `<project>/.visualagents/config.json` | the remembered start command |
397
+ | `<project>/.visualagents/runs/*.jsonl` | recorded runs for `replay` (git-ignored) |
398
+ | `~/.visualagents/settings.json`, `keys.json` | guided-start choices and saved keys (`keys.json` is readable only by you) |
399
+ | `~/.visualagents/registry.json`, `daemon.json` | hooked projects and the background dashboard |
400
+ | `<venv>/site-packages/visualagents_hook.pth` | the hook (`visualagents unhook` removes it) |
401
+
402
+ ## Privacy and security
403
+
404
+ - The dashboard binds to `127.0.0.1` only; events from your agent need a per-session token.
405
+ - Nothing leaves your machine unless you choose an LLM provider. Before code is sent, `.env`, key and credential
406
+ files are skipped and strings that look like API keys are redacted.
407
+ - Saved keys live in `~/.visualagents/keys.json` with owner-only permissions. No telemetry.
408
+ - Instrumentation never changes your agent's behaviour or output, and stays silent in processes that never call
409
+ an LLM.
410
+
411
+ ## Troubleshooting
412
+
413
+ | Problem | Fix |
414
+ |---|---|
415
+ | `visualagents: command not found` | Install it (see [Quick start](#1-install)); make sure `~/.local/bin` is on your `PATH`. |
416
+ | The map doesn't move | The agent isn't working on anything yet — press **▶ Start** and give it a task ([details](#watching-an-agent-live)). |
417
+ | "No virtualenv found" | Create one in the project (`python3 -m venv .venv && .venv/bin/pip install -r requirements.txt`), or `hook --python /path/to/python`. |
418
+ | The agent fails with import errors | Its own dependencies aren't installed in the environment it runs with — install them, then **▶ Run again**. |
419
+ | The LLM scan failed | VisualAgents falls back to the offline map. Retry, or pick another model (`visualagents models --provider …`). |
420
+ | An agent is missing or misnamed | `visualagents scan <folder> --llm` for a richer map, or edit `.visualagents/blueprint.json`. Agents seen only at runtime still appear (dashed). |
421
+ | Wrong start command | `visualagents run <folder> --pick`. |
422
+
423
+ ## Development
424
+
425
+ ```bash
426
+ git clone https://github.com/kaih06-hub/VisualAgents.git && cd VisualAgents
427
+ python -m venv .venv && . .venv/bin/activate
428
+ pip install -e ".[dev,all]"
429
+ pytest
430
+ ```
431
+
432
+ The dashboard is plain HTML/CSS/JS in `visualagents/web/` (no build step). New console formats go in
433
+ `visualagents/patterns.py`, new static detectors in `visualagents/static_scan.py`, start-command detection in
434
+ `visualagents/detect.py`, and runtime hooks in `visualagents/_autoinstrument/visualagents_runtime.py`.
435
+
436
+ ## License
437
+
438
+ MIT