-
Notifications
You must be signed in to change notification settings - Fork 555
Closed
Description
How do you use Sentry?
Sentry Saas (sentry.io)
Version
2.35.0
Steps to Reproduce
Run
import asyncio
import sentry_sdk
from agents import Agent, Runner
from sentry_sdk.integrations.openai_agents import OpenAIAgentsIntegration
sentry_sdk.init(
dsn="...",
send_default_pii=True,
traces_sample_rate=1.0,
integrations=[
OpenAIAgentsIntegration(),
],
)
main_agent = Agent(
name="main_agent",
model="gpt-5",
)
async def run_agent() -> None:
runner = await Runner.run(
starting_agent=main_agent,
input="How are you?",
)
print(runner.final_output)
async def main() -> None:
await asyncio.gather(*[run_agent() for _ in range(2)])
if __name__ == "__main__":
asyncio.run(main())
Then, the agent that finishes 2nd will fail with:
{
"error": "'Span' object has no attribute '_context_manager_state'",
"tool_name": "<agentname>_agent"
}
Expected Result
- This error not to happen
- That most (if not all) parts of the Sentry SDK are wrapped in
try catch
blocks, so that if for some reason like now aSpan
cannot be closed, it doesn't interfere with the normal flow
Actual Result
The agent crashes, and instead of the result that was generated by the nested agent being available to the main agent, the main agent only sees the error message and cannot continue.
micahjsmith
Metadata
Metadata
Assignees
Projects
Status
Waiting for: Product Owner