You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DEVELOPMENT.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -301,6 +301,43 @@ start_http_server(port=9464)
301
301
302
302
You can now see the metrics at `http://localhost:9464/metrics` (make sure that your Python program keeps running), after this you can setup your Prometheus server to scrape this endpoint.
303
303
304
+
### Profiling
305
+
306
+
The `Profiler` class uses `pyinstrument` to profile your agent's performance and generate an HTML report showing where time is spent during execution.
307
+
308
+
#### Example usage:
309
+
310
+
```python
311
+
from uuid import uuid4
312
+
from vision_agents.core import User, Agent
313
+
from vision_agents.core.profiling import Profiler
314
+
from vision_agents.plugins import getstream, gemini, deepgram, elevenlabs, vogent
- Stops profiling when the agent finishes (on `AgentFinishEvent`)
337
+
- Saves an HTML report to the specified output path (default: `./profile.html`)
338
+
339
+
You can open the generated HTML file in a browser to view the performance profile, which shows a timeline of function calls and where time is spent during agent execution.
0 commit comments