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

Implement instrumentation for Agentic frameworks #283

Open
narengogi opened this issue Jan 21, 2025 · 0 comments
Open

Implement instrumentation for Agentic frameworks #283

narengogi opened this issue Jan 21, 2025 · 0 comments

Comments

@narengogi
Copy link
Contributor

Feature

People use portkey SDK for making calls to various inference endpoints and also portkey endpoints.

There are cases in which users want to use the portkey sdk for logging and not merely log inference calls.
While this is verily possible even today with manual log insertions, some of the common workflows that users have can be auto-instrumented

This is a feature request to enable auto-instrumentation of the following libraries (not exhaustive):

  • anthropic
  • autogen
  • aws_bedrock
  • cerebras
  • chroma
  • cohere
  • crewai
  • dspy
  • embedchain
  • gemini
  • google_genai
  • groq
  • langchain
  • langchain_community
  • langchain_core
  • langgraph
  • litellm
  • llamaindex
  • milvus
  • mistral
  • ollama
  • openai
  • pinecone
  • pymongo
  • qdrant
  • vertexai
  • weaviate

Approach:

Here are the approaches I considered:

Monkey Patching With OpenTelemetry Callback Handlers Just Monkey Patching
✅ Helps in building hierarchy with
span ids
➖ have to build hierarchy
manually depending on the callback handler implementation
❌ have to build hierarchy manually
✅ Code is much simpler than monkey patching
✅ No need to install any external libraries ❌ Need to install the library as a dependecy to inherit from the CallbackHandler class
✅ More ownership and customizability

Here's a comparision of existing Open source OpenTelemetry for AI solutions that I considered

Langtrace Uses OpenTelemetry along with monkey patching, this is the most comprehensive implementation, they're capturing useful information for debugging
OpenLit Similar to Langtrace, fewer integrations
OpenLLMetry This is a pretty good implementation, they have config objects and parse them for instrumentation, I like it
AgentOps They don't use opentelemetry, but use monkey patching and also partnerships with internal implementations
Langfuse Trash implementation, criss-crosses between different levels of abstraction, for example, the OpenAI tracing module is a wrapper and users are expected to import languse.openai.OpenAI,
but when someone uses bedrock, they have to use a decorator
They also have partnership implementations like Haystack where the code is inside the library emits the instrumentation traces

Things to keep in mind for implementation:

  • logging should be asynchronous
  • If a user is using the library both for instrumentation and as client, there should be no duplicate logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant