Skip to content

Duplicate traces #141

@sourabhdattawad

Description

@sourabhdattawad

Enabling traces results in duplicates. Even the LLM calls seem to happen twice with same content.

Debug information

  • Agents SDK version: v0.0.3
  • Python version: Python 3.10

Repro steps

from agents import Agent, FunctionTool, RunContextWrapper, function_tool, Runner, enable_verbose_stdout_logging enable_verbose_stdout_logging() @function_tool def multiplication_tool_crew(first_number: int, second_number: int) -> str: """Useful for when you need to multiply two numbers together.""" return first_number * second_number async def main() -> None: agent = Agent( "assistant", instructions="Your goal is to answer the question asked", tools=[multiplication_tool_crew], model="gpt-4o-mini" ) res = await Runner.run(agent, "Multiply numbers 3 and 3") return res results = await main()
Creating trace Agent workflow with id trace_c9d4682181904a829ee48ffd3c3331e4 Creating trace Agent workflow with id trace_c9d4682181904a829ee48ffd3c3331e4 Creating trace Agent workflow with id trace_c9d4682181904a829ee48ffd3c3331e4 Creating trace Agent workflow with id trace_c9d4682181904a829ee48ffd3c3331e4 Setting current trace: trace_c9d4682181904a829ee48ffd3c3331e4 Setting current trace: trace_c9d4682181904a829ee48ffd3c3331e4 Setting current trace: trace_c9d4682181904a829ee48ffd3c3331e4 Setting current trace: trace_c9d4682181904a829ee48ffd3c3331e4 Creating span <agents.tracing.span_data.AgentSpanData object at 0xffff5d1e6660> with id None Creating span <agents.tracing.span_data.AgentSpanData object at 0xffff5d1e6660> with id None Creating span <agents.tracing.span_data.AgentSpanData object at 0xffff5d1e6660> with id None Creating span <agents.tracing.span_data.AgentSpanData object at 0xffff5d1e6660> with id None Running agent assistant (turn 1) Running agent assistant (turn 1) Creating span <agents.tracing.span_data.ResponseSpanData object at 0xffff5ee7d500> with id None Creating span <agents.tracing.span_data.ResponseSpanData object at 0xffff5ee7d500> with id None Creating span <agents.tracing.span_data.ResponseSpanData object at 0xffff5ee7d500> with id None Creating span <agents.tracing.span_data.ResponseSpanData object at 0xffff5ee7d500> with id None Calling LLM gpt-4o-mini with input: [ { "content": "Multiply numbers are 3 and 3", "role": "user" } ] Tools: [ { "name": "multiplication_tool_crew", "parameters": { "properties": { "first_number": { "title": "First Number", "type": "integer" }, "second_number": { "title": "Second Number", "type": "integer" } }, "required": [ "first_number", "second_number" ], "title": "multiplication_tool_crew_args", "type": "object", "additionalProperties": false }, "strict": true, "type": "function", "description": "Useful for when you need to multiply two numbers together." } ] Stream: False Tool choice: NOT_GIVEN Response format: NOT_GIVEN Calling LLM gpt-4o-mini with input: [ { "content": "Multiply numbers are 3 and 3", "role": "user" } ] Tools: [ { "name": "multiplication_tool_crew", "parameters": { "properties": { "first_number": { "title": "First Number", "type": "integer" }, "second_number": { "title": "Second Number", "type": "integer" } }, "required": [ "first_number", "second_number" ], "title": "multiplication_tool_crew_args", "type": "object", "additionalProperties": false }, "strict": true, "type": "function", "description": "Useful for when you need to multiply two numbers together." } ] Stream: False Tool choice: NOT_GIVEN Response format: NOT_GIVEN LLM resp: [ { "id": "fc_67d1abfab1d48191b295cc2d0bdd123b02b1fe54032bc4cf", "arguments": "{\"first_number\":3,\"second_number\":3}", "call_id": "call_NGfFinOHzCoU0QqZGMxNF39l", "name": "multiplication_tool_crew", "type": "function_call", "status": "completed" } ] LLM resp: [ { "id": "fc_67d1abfab1d48191b295cc2d0bdd123b02b1fe54032bc4cf", "arguments": "{\"first_number\":3,\"second_number\":3}", "call_id": "call_NGfFinOHzCoU0QqZGMxNF39l", "name": "multiplication_tool_crew", "type": "function_call", "status": "completed" } ] Creating span <agents.tracing.span_data.FunctionSpanData object at 0xffff5d1babb0> with id None Creating span <agents.tracing.span_data.FunctionSpanData object at 0xffff5d1babb0> with id None Creating span <agents.tracing.span_data.FunctionSpanData object at 0xffff5d1babb0> with id None Creating span <agents.tracing.span_data.FunctionSpanData object at 0xffff5d1babb0> with id None Invoking tool multiplication_tool_crew with input {"first_number":3,"second_number":3} Invoking tool multiplication_tool_crew with input {"first_number":3,"second_number":3} Tool call args: [3, 3], kwargs: {} Tool call args: [3, 3], kwargs: {} Tool multiplication_tool_crew returned 9 Tool multiplication_tool_crew returned 9 Running agent assistant (turn 2) Running agent assistant (turn 2) Creating span <agents.tracing.span_data.ResponseSpanData object at 0xffff5d32e880> with id None Creating span <agents.tracing.span_data.ResponseSpanData object at 0xffff5d32e880> with id None Creating span <agents.tracing.span_data.ResponseSpanData object at 0xffff5d32e880> with id None Creating span <agents.tracing.span_data.ResponseSpanData object at 0xffff5d32e880> with id None Calling LLM gpt-4o-mini with input: [ { "content": "Multiply numbers are 3 and 3", "role": "user" }, { "id": "fc_67d1abfab1d48191b295cc2d0bdd123b02b1fe54032bc4cf", "arguments": "{\"first_number\":3,\"second_number\":3}", "call_id": "call_NGfFinOHzCoU0QqZGMxNF39l", "name": "multiplication_tool_crew", "type": "function_call", "status": "completed" }, { "call_id": "call_NGfFinOHzCoU0QqZGMxNF39l", "output": "9", "type": "function_call_output" } ] Tools: [ { "name": "multiplication_tool_crew", "parameters": { "properties": { "first_number": { "title": "First Number", "type": "integer" }, "second_number": { "title": "Second Number", "type": "integer" } }, "required": [ "first_number", "second_number" ], "title": "multiplication_tool_crew_args", "type": "object", "additionalProperties": false }, "strict": true, "type": "function", "description": "Useful for when you need to multiply two numbers together." } ] Stream: False Tool choice: NOT_GIVEN Response format: NOT_GIVEN Calling LLM gpt-4o-mini with input: [ { "content": "Multiply numbers are 3 and 3", "role": "user" }, { "id": "fc_67d1abfab1d48191b295cc2d0bdd123b02b1fe54032bc4cf", "arguments": "{\"first_number\":3,\"second_number\":3}", "call_id": "call_NGfFinOHzCoU0QqZGMxNF39l", "name": "multiplication_tool_crew", "type": "function_call", "status": "completed" }, { "call_id": "call_NGfFinOHzCoU0QqZGMxNF39l", "output": "9", "type": "function_call_output" } ] Tools: [ { "name": "multiplication_tool_crew", "parameters": { "properties": { "first_number": { "title": "First Number", "type": "integer" }, "second_number": { "title": "Second Number", "type": "integer" } }, "required": [ "first_number", "second_number" ], "title": "multiplication_tool_crew_args", "type": "object", "additionalProperties": false }, "strict": true, "type": "function", "description": "Useful for when you need to multiply two numbers together." } ] Stream: False Tool choice: NOT_GIVEN Response format: NOT_GIVEN LLM resp: [ { "id": "msg_67d1abfb60d0819197564fc1685f589502b1fe54032bc4cf", "content": [ { "annotations": [], "text": "The result of multiplying 3 and 3 is 9.", "type": "output_text" } ], "role": "assistant", "status": "completed", "type": "message" } ] LLM resp: [ { "id": "msg_67d1abfb60d0819197564fc1685f589502b1fe54032bc4cf", "content": [ { "annotations": [], "text": "The result of multiplying 3 and 3 is 9.", "type": "output_text" } ], "role": "assistant", "status": "completed", "type": "message" } ] Resetting current trace Resetting current trace Resetting current trace Resetting current trace 

Expected behavior

A clear and concise description of what you expected to happen.

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