First working implementation of the program
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
|
||||
from langsmith import traceable
|
||||
from agent_workflows.crew_setup import create_crew
|
||||
from shared_config import AgenticAIConfig, logger
|
||||
from langsmith.integrations.otel import OtelSpanProcessor
|
||||
from opentelemetry import trace
|
||||
from opentelemetry.sdk.trace import TracerProvider
|
||||
from opentelemetry.instrumentation.crewai import CrewAIInstrumentor
|
||||
from opentelemetry.instrumentation.openai import OpenAIInstrumentor
|
||||
|
||||
# Initialize the trace provider
|
||||
tracer_provider = TracerProvider()
|
||||
#trace.set_tracer_provider(tracer_provider)
|
||||
|
||||
# Add the LangSmith OTel processor
|
||||
tracer_provider.add_span_processor(OtelSpanProcessor())
|
||||
|
||||
# Instrument both CrewAI and OpenAI layers
|
||||
CrewAIInstrumentor().instrument(tracer_provider=tracer_provider)
|
||||
OpenAIInstrumentor().instrument(tracer_provider=tracer_provider)
|
||||
|
||||
@traceable(name="Capstone_GTM Strategy Simulation", run_type="chain")
|
||||
def runAgenticWorkflow(config: AgenticAIConfig):
|
||||
"""
|
||||
Main Entry Point of Agentic AI Workflow
|
||||
"""
|
||||
logger.info("Agentic Workflow Started...")
|
||||
|
||||
crew = create_crew(config)
|
||||
|
||||
result = crew.kickoff(
|
||||
inputs={
|
||||
"query": config.user_query
|
||||
}
|
||||
)
|
||||
|
||||
config.response = str(result)
|
||||
return config
|
||||
Reference in New Issue
Block a user