bytedance / bytedance/trae-agent
Add Langsmith tracking
- Dominant language
- Python
- Stars
- 12.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the feature you want to propose
Based on LangSmith tracking agent execution steps
### What problem does this feature solve or what benefit does it bring?
Although there are now trajectory records that can clearly log model responses and tool invocations, LangSmith's visualization and cloud management offer a more structured framework. Even without using the LangChain framework, leveraging decorators allows for convenient tracking.
### Implementation details or suggestions (optional)
Use wrap_openai() to wrap OpenAI(), and use @traceable to trace the Agent
``` python
from openai import OpenAI
from langsmith import traceable
from langsmith.wrappers import wrap_openai
openai_client = wrap_openai(OpenAI())
def retriever(query: str):
results = ["Harrison worked at Kensho"]
return results
@traceable
def rag(question):
docs = retriever(question)
system_message = """Answer the users question using only the provided information below:
{docs}""".format(docs="\n".join(docs))
return openai_client.chat.completions.create(
messages=[
{"role": "system", "content": system_message},
{"role": "user", "content": question},
],
model="gpt-4o-mini",
)
```
Contributor guide
Research direction
Start by locating the agent execution flow and the OpenAI client initialization, then review how trajectory records currently capture model responses and tool invocations. Determine the LangSmith dependency and configuration requirements; done means agent execution steps are traceable through LangSmith without requiring LangChain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100