Skip to content

Commit 2bdf9b7

Browse files
authored
Pass through organization/project headers to tracing backend, fix speech_group enum (#562)
1 parent 942ba98 commit 2bdf9b7

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/agents/mcp/server.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ async def cleanup(self):
137137
async with self._cleanup_lock:
138138
try:
139139
await self.exit_stack.aclose()
140-
self.session = None
141140
except Exception as e:
142141
logger.error(f"Error cleaning up server: {e}")
142+
finally:
143+
self.session = None
143144

144145

145146
class MCPServerStdioParams(TypedDict):

src/agents/tracing/processors.py

+6
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ def export(self, items: list[Trace | Span[Any]]) -> None:
102102
"OpenAI-Beta": "traces=v1",
103103
}
104104

105+
if self.organization:
106+
headers["OpenAI-Organization"] = self.organization
107+
108+
if self.project:
109+
headers["OpenAI-Project"] = self.project
110+
105111
# Exponential backoff loop
106112
attempt = 0
107113
delay = self.base_delay

src/agents/tracing/span_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def __init__(
338338

339339
@property
340340
def type(self) -> str:
341-
return "speech-group"
341+
return "speech_group"
342342

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

0 commit comments

Comments
 (0)