-
-
Notifications
You must be signed in to change notification settings - Fork 658
Refactor Python telemetry library #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Python telemetry library #336
Conversation
|
This is still a draft. We need to:
|
|
To test this, I'm doing the following: Build the project: pdm installFind my telemetry ID: cat libs/python/core/core/.storage/installation_idIn PostHog, I do the following: 1) Go to Activity 2) Click "Add Filter" 3) Click "Event metadata" 4) Click "Distinct ID" 5) Enter the telemetry ID for the value Then, create a file with the example code: from agent import ComputerAgent
from computer import Computer
import asyncio
computer = Computer() # Connect to a cua container
agent = ComputerAgent(
model="anthropic/claude-3-5-sonnet-20241022",
tools=[computer]
)
prompt = "open github, navigate to trycua/cua"
async def main():
async for result in agent.run(prompt):
for entry in result.get("output", []):
if entry.get("type") == "message":
print("Agent:", entry.get("content", [{}])[0].get("text", ""))
if __name__ == "__main__":
asyncio.run(main())Run the test file: uv run python test.pyThen, I check to make sure the events were created in PostHog. |
|
I've now tested the above on both this branch and #348 (the current version), and they are giving similar results. I haven't inspected every field, but glancing over the PostHog activity, it looks good. |
Overview
This PR improves the Cua Python telemetry library. It:
Closes trycua/backlog#81
Removed code
Here's what's been removed:
CUA_TELEMETRY_DISABLEDenvironment variable was removed. (See below)The remaining code was combined into a single class.
This allows us to compare the remaining code with the TypeScript implementation and the documentation.
Tests added
This adds tests to:
Environment variables
The environment variable
CUA_TELEMETRY_DISABLEDwas removed for this reason: We already have two variables for this purpose:CUA_TELEMETRY_ENABLEDbeing the one that's documented, andCUA_TELEMETRYbeing a legacy variable that I have left in for compatibility.Testing
To test the library, I run: