Skip to content

Pass through organization/project headers to tracing backend, fix speech_group enum #562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/agents/mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ async def cleanup(self):
async with self._cleanup_lock:
try:
await self.exit_stack.aclose()
self.session = None
except Exception as e:
logger.error(f"Error cleaning up server: {e}")
finally:
self.session = None
Comment on lines +142 to +143
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codex found this unrelated bug



class MCPServerStdioParams(TypedDict):
Expand Down
6 changes: 6 additions & 0 deletions src/agents/tracing/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ def export(self, items: list[Trace | Span[Any]]) -> None:
"OpenAI-Beta": "traces=v1",
}

if self.organization:
headers["OpenAI-Organization"] = self.organization

if self.project:
headers["OpenAI-Project"] = self.project

# Exponential backoff loop
attempt = 0
delay = self.base_delay
Expand Down
2 changes: 1 addition & 1 deletion src/agents/tracing/span_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def __init__(

@property
def type(self) -> str:
return "speech-group"
return "speech_group"

def export(self) -> dict[str, Any]:
return {
Expand Down