Skip to content
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

Integrate Observability #199

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

bonk1t
Copy link
Collaborator

@bonk1t bonk1t commented Dec 9, 2024

Observability

Agency Swarm now supports tracking your agents using Langchain callbacks. This allows you to monitor and analyze the behavior and performance of your agents.

To use tracking with Langchain callbacks, you need to install the langchain package:

pip install langchain

Langfuse

Langfuse is an observability platform that allows you to track and analyze the execution of your agents in detail. It provides features like tracing, metrics, and debugging tools.

Screenshot 2024-12-20 at 01 36 29

To use Langfuse with Agency Swarm, follow these steps:

  1. Install the langfuse package:
pip install langfuse
  1. Set the LANGFUSE_SECRET_KEY and LANGFUSE_PUBLIC_KEY environment variables:
export LANGFUSE_SECRET_KEY=<your-secret-key>
export LANGFUSE_PUBLIC_KEY=<your-public-key>

You can get your keys from the Langfuse dashboard.

  1. Initialize the tracking in your code:
from agency_swarm import init_tracking

init_tracking("langfuse")

You can pass additional configuration options to the Langfuse callback handler:

init_tracking(
    "langfuse",
    debug=True,
    host="custom-host",
    user_id="user-123",
)

For additional parameters and more information on the Langfuse callback handler, see the Langfuse documentation.

Local

The local tracker provides a lightweight solution for logging agent activities to a SQLite database.

To use the local tracker, simply initialize it in your code:

from agency_swarm import init_tracking

init_tracking("local")

This will create a SQLite database in the current working directory.

For custom database location:

from agency_swarm import init_tracking

init_tracking("local", db_path="path/to/your/database.db")

@bonk1t bonk1t changed the title Add SQLite and Langfuse trackers; Refactor test system Integrate Observability Dec 9, 2024
@bonk1t bonk1t marked this pull request as ready for review December 20, 2024 02:33
@bonk1t bonk1t requested a review from VRSEN December 20, 2024 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant