Skip to content

[Bug]: No trances in agno streamingΒ #1188

@Anandesh-Sharma

Description

@Anandesh-Sharma

Contact Details

[email protected]

πŸ“¦ Package Version

0.4.19

🎞️ Framework Version

agno 1.77

πŸ”Ž Describe the Bug

import os
from textwrap import dedent

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.newspaper4k import Newspaper4kTools

research_agent = Agent(
            model=OpenAIChat(id="o3-mini", api_key=os.getenv("OPENAI_API_KEY")),
            tools=[DuckDuckGoTools(), Newspaper4kTools()],
            description=dedent("""\
            You are an elite investigative journalist with decades of experience at the New York Times.
            Your expertise encompasses: πŸ“°

            - Deep investigative research and analysis
            - Meticulous fact-checking and source verification
            - Compelling narrative construction
            - Data-driven reporting and visualization
            - Expert interview synthesis
            - Trend analysis and future predictions
            - Complex topic simplification
            - Ethical journalism practices
            - Balanced perspective presentation
            - Global context integration\
        """),
            instructions=dedent("""\
            1. Research Phase πŸ”
            - Search for 10+ authoritative sources on the topic
            - Prioritize recent publications and expert opinions
            - Identify key stakeholders and perspectives

            2. Analysis Phase πŸ“Š
            - Extract and verify critical information
            - Cross-reference facts across multiple sources
            - Identify emerging patterns and trends
            - Evaluate conflicting viewpoints

            3. Writing Phase ✍️
            - Craft an attention-grabbing headline
            - Structure content in NYT style
            - Include relevant quotes and statistics
            - Maintain objectivity and balance
            - Explain complex concepts clearly

            4. Quality Control βœ“
            - Verify all facts and attributions
            - Ensure narrative flow and readability
            - Add context where necessary
            - Include future implications
        """),
            expected_output=dedent("""\
            # {Compelling Headline} πŸ“°

            ## Executive Summary
            {Concise overview of key findings and significance}

            ## Background & Context
            {Historical context and importance}
            {Current landscape overview}

            ## Key Findings
            {Main discoveries and analysis}
            {Expert insights and quotes}
            {Statistical evidence}

            ## Impact Analysis
            {Current implications}
            {Stakeholder perspectives}
            {Industry/societal effects}

            ## Future Outlook
            {Emerging trends}
            {Expert predictions}
            {Potential challenges and opportunities}

            ## Expert Insights
            {Notable quotes and analysis from industry leaders}
            {Contrasting viewpoints}

            ## Sources & Methodology
            {List of primary sources with key contributions}
            {Research methodology overview}

            ---
            Research conducted by AI Investigative Journalist
            New York Times Style Report
            Published: {current_date}
            Last Updated: {current_time}\
        """),
            markdown=True,
            show_tool_calls=True,
            stream=True,
            add_datetime_to_instructions=True,
        )
 agentops.init(trace_name=f"{self.name}_{self.version}")
        async def generate_model_response():
            if research_agent is None:
                # Fallback for build validation
                yield f"data: {json.dumps({'message': 'Build validation mode - agent not fully loaded'})}\n\n"
                return
                
            agent_response = await research_agent.arun(agent_input.message)
            async for chunk in agent_response:
                yield f"data: {json.dumps(chunk.content)}\n\n"

        return StreamingResponse(
          generate_model_response(),
          media_type="text/event-stream",
        )

while streaming I didn't get any traces, is there any solution to it?

🀝 Contribution

  • Yes, I'd be happy to submit a pull request with these changes.
  • I need some guidance on how to contribute.
  • I'd prefer the AgentOps team to handle this update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions