Steps to integrate TaskWeaver with AgentOps
1
Install the AgentOps SDK
2
Install TaskWeaver and configure your project directory
Follow the instructions on the TaskWeaver Quick Start section in the documentation.
3
Import the TaskWeaver handler from AgentOps and initialize the AgentOps client
AgentOps uses the TaskWeaver handler to handle its events. Additionally, AgentOps tracks the LLM calls made by TaskWeaver via its inbuilt module. These are used together to observe everything in the TaskWeaver session.Read more about environment variables in Advanced Configuration
TaskWeaver provides different usage options. By default, it’s used as a CLI app via the
taskweaver
command but can also be used as a library.Set your API key as an
.env
variable for easy access.4
Run your Agent
Execute your program and visit app.agentops.ai/drilldown to observe your TaskWeaver Agent! 🕵️
After your run, AgentOps prints a clickable url to console linking directly to your session in the Dashboard

Clickable link to session
Full Examples
This is a basic example of how to use TaskWeaver as a library and observe it with AgentOps. Ensure you have configured your project directory in the TaskWeaverApp by following the documentation mentioned in step 2.When registering the TaskWeaverEventHandler, you should either use the
session.event_emitter.register
method or pass the handler object to the event_handler
parameter in the send_message
method. If you use both, the events will be recorded twice, resulting in a “stuttering” effect in the recorded messages.