Skip to content

Commit fabf7b6

Browse files
committed
profile: added example of profiling in simple agent
1 parent 4c5cfcf commit fabf7b6

File tree

5 files changed

+1893
-1046
lines changed

5 files changed

+1893
-1046
lines changed

agents-core/vision_agents/core/agents/agents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def __init__(
155155
options: Optional[AgentOptions] = None,
156156
tracer: Tracer = trace.get_tracer("agents"),
157157
# Configure the default logging for the sdk here. Pass None to leave the config intact.
158-
log_level: Optional[int] = logging.INFO,
158+
log_level: Optional[int] = logging.DEBUG,
159159
profiler: Optional[Profiler] = None,
160160
):
161161
if log_level is not None:

agents-core/vision_agents/core/profiling/base.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pyinstrument
2-
32
import logging
43

54
from vision_agents.core.events import EventManager
@@ -14,12 +13,8 @@ def __init__(self, output_path='./profile.html'):
1413
self.events = EventManager()
1514
self.events.register_events_from_module(events)
1615
self.profiler = pyinstrument.Profiler()
17-
self.events.subscribe(self.on_start)
18-
self.events.subscribe(self.on_finish)
19-
20-
async def on_start(self, event: events.AgentInitEvent):
21-
logger.info("Profiler started.")
2216
self.profiler.start()
17+
self.events.subscribe(self.on_finish)
2318

2419
async def on_finish(self, event: events.AgentFinishEvent):
2520
self.profiler.stop()

examples/01_simple_agent_example/pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dependencies = [
1414
"vision-agents-plugins-smart-turn",
1515
"vision-agents-plugins-cartesia",
1616
"vision-agents-plugins-gemini",
17+
"vision-agents-plugins-vogent",
1718
"vision-agents",
1819
"openai>=1.101.0",
1920
"anthropic>=0.66.0",
@@ -31,4 +32,5 @@ dependencies = [
3132
"vision-agents-plugins-smart-turn" = {path = "../../plugins/smart_turn", editable=true}
3233
"vision-agents-plugins-cartesia" = {path = "../../plugins/cartesia", editable=true}
3334
"vision-agents-plugins-gemini" = {path = "../../plugins/gemini", editable=true}
35+
"vision-agents-plugins-vogent" = {path = "../../plugins/vogent", editable=true}
3436
"vision-agents" = {path = "../../agents-core", editable=true}

examples/01_simple_agent_example/simple_agent_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from dotenv import load_dotenv
44

55
from vision_agents.core import User, Agent
6-
from vision_agents.plugins import cartesia, deepgram, getstream, gemini, vogent
6+
from vision_agents.plugins import deepgram, getstream, gemini, vogent, elevenlabs
77
from vision_agents.core.profiling import Profiler
88

99
load_dotenv()
@@ -21,7 +21,7 @@ async def start_agent() -> None:
2121
processors=[], # processors can fetch extra data, check images/audio data or transform video
2222
# llm with tts & stt. if you use a realtime (sts capable) llm the tts, stt and vad aren't needed
2323
llm=llm,
24-
tts=cartesia.TTS(),
24+
tts=elevenlabs.TTS(),
2525
stt=deepgram.STT(),
2626
turn_detection=vogent.TurnDetection(),
2727
profiler=Profiler(),

0 commit comments

Comments
 (0)