Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /agno-agi_agno /cookbook /observability /langsmith_via_openinference.py
| """ | |
| LangSmith Via OpenInference | |
| =========================== | |
| Demonstrates instrumenting an Agno agent with OpenInference and sending traces to LangSmith. | |
| """ | |
| import os | |
| from agno.agent import Agent | |
| from agno.models.openai import OpenAIChat | |
| from agno.tools.websearch import WebSearchTools | |
| from openinference.instrumentation.agno import AgnoInstrumentor | |
| from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter | |
| from opentelemetry.sdk.trace import TracerProvider | |
| from opentelemetry.sdk.trace.export import SimpleSpanProcessor | |
| # --------------------------------------------------------------------------- | |
| # Setup | |
| # --------------------------------------------------------------------------- | |
| endpoint = "https://eu.api.smith.langchain.com/otel/v1/traces" | |
| headers = { | |
| "x-api-key": os.getenv("LANGSMITH_API_KEY"), | |
| "Langsmith-Project": os.getenv("LANGSMITH_PROJECT"), | |
| } | |
| tracer_provider = TracerProvider() | |
| tracer_provider.add_span_processor( | |
| SimpleSpanProcessor(OTLPSpanExporter(endpoint=endpoint, headers=headers)) | |
| ) | |
| # Start instrumenting agno | |
| AgnoInstrumentor().instrument(tracer_provider=tracer_provider) | |
| # --------------------------------------------------------------------------- | |
| # Create Agent | |
| # --------------------------------------------------------------------------- | |
| agent = Agent( | |
| name="Stock Market Agent", | |
| model=OpenAIChat(id="gpt-5.6-luna"), | |
| tools=[WebSearchTools()], | |
| markdown=True, | |
| ) | |
| # --------------------------------------------------------------------------- | |
| # Run Example | |
| # --------------------------------------------------------------------------- | |
| if __name__ == "__main__": | |
| agent.print_response("What is news on the stock market?") | |
Xet Storage Details
- Size:
- 1.71 kB
- Xet hash:
- a5ee343d32b06fe86bbf00cad2849539df1a0f9019559b9e9fc658721050d0b6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.