text
stringlengths
0
59.1k
### Debugging and Monitoring: Hooks System
One of my favorite features is also the visual console for debugging. I saw this approach for the first time in the framework world. But there's also a hooks system at the code level:
```typescript
const hooks = createHooks({
onStart: async ({ agent, context }) => {
const requestId = `req-${Date.now()}`;
context.context.set("requestId", requestId);
console.log(`[${agent.name}] Started: ${requestId}`);
},
onToolStart: async ({ agent, tool, context }) => {
const reqId = context.context.get("requestId");
console.log(`[${reqId}] Tool starting: ${tool.name}`);
},
onToolEnd: async ({ agent, tool, output, context }) => {
const reqId = context.context.get("requestId");
console.log(`[${reqId}] Tool finished: ${tool.name}`, output);
},
onEnd: async ({ agent, output, context }) => {
const reqId = context.context.get("requestId");
console.log(`[${reqId}] Operation complete`);
},
});
const agent = new Agent({
name: "Observable Agent",
// ... other config
hooks, // Full traceability
});
```
This system is very valuable in production. You can trace every tool call, every agent interaction.
### Voice Capabilities
Voice integration is also one of the features we added recently. We have both OpenAI and ElevenLabs support:
```typescript
import { ElevenLabsVoiceProvider } from "@voltagent/voice";
const voiceProvider = new ElevenLabsVoiceProvider({
apiKey: process.env.ELEVENLABS_API_KEY,
voice: "Rachel",
});
const agent = new Agent({
name: "Voice Assistant",
instructions: "A helpful voice assistant",
llm: new VercelAIProvider(),
model: openai("gpt-4o"),
voice: voiceProvider,
});
// Generate text response
const response = await agent.generateText("Tell me a short story");
// Convert to voice
if (agent.voice && response.text) {
const audioStream = await agent.voice.speak(response.text);
// Save audioStream to file or play it
}
```
Speech-to-text is there too, you can convert audio inputs to text.
### VoltOps Platform Experience
```bash
npm run dev
# ══════════════════════════════════════════════════
# VOLTAGENT SERVER STARTED SUCCESSFULLY
# ══════════════════════════════════════════════════
# βœ“ HTTP Server: http://localhost:3141
# Test your agents with VoltOps Console: https://console.voltagent.dev
# ══════════════════════════════════════════════════
```
![VoltOps LLM Observability Platform Chat Example](https://cdn.voltagent.dev/2025-04-24-rag-chatbot/rag-chatbot-voltagent-console.gif)
From the console you can do real-time conversation monitoring, tool execution tracing, memory state inspection, performance metrics, error debugging. Debugging has never been this fun.
The best part is, all these features are **composable**. You can use whatever combination you want - just memory, just tools, just voice, or all of them together. The framework doesn't force you into anything but everything is ready when you need it.
## Real World Examples
Examples from the community are really inspiring. Like an e-commerce customer support bot:
```typescript
const supportAgent = new Agent({
name: "support-bot",
instructions: "E-commerce customer support, can track orders",
tools: [orderLookupTool, refundProcessTool, humanHandoffTool],
memory: new ConversationMemory(),
});
```
This system achieved 35% less human escalation, 60% faster response time, 24/7 availability.