feat(server): add optional AgentPond tracing - #2079
feat(server): add optional AgentPond tracing#2079Marcus Schiesser (marcusschiesser) wants to merge 3 commits into
Conversation
|
PR author is not in the allowed authors list. |
|
All contributors have signed the CLA. Thank you! |
There was a problem hiding this comment.
馃挕 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1201f79627
鈩癸笍 About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 馃憤.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| ? EXIT_CODES.SIGNAL_KILL | ||
| : EXIT_CODES.SUCCESS | ||
| process.exit(code) | ||
| void shutdownAgentPondTracing().finally(() => process.exit(code)) |
There was a problem hiding this comment.
Drain active agent work before shutting down tracing
When a shutdown request or signal arrives during an active ToolLoopAgent call, this shuts down the tracer provider immediately without first stopping the HTTP server or awaiting the tracked agent/chat activity. Provider shutdown only drains spans that have already ended, so the in-flight model span can finish after its processor has been shut down and be dropped before process.exit, making the final trace incomplete precisely during normal restarts or termination under load.
Useful? React with 馃憤聽/ 馃憥.
There was a problem hiding this comment.
Fixed in 9bfa257. Shutdown now stops accepting new HTTP requests, waits for the existing ServerActivity tracker to become idle (covering chat streams, MCP tool executions, and running turns), and only then shuts down AgentPond and exits. I also added a lifecycle regression test proving tracer shutdown does not begin until the active-work drain completes.
Validation after the fix: bun run check; the complete bun run test; and 31 focused lifecycle/activity/tracing tests all pass. A fresh production-agent-path E2E wrote 1 object / 4 events to a local FS store and read back LLM trace 3ff965a5bc03398749a458c34e68de60 plus agent trace 48cb41bb54cf8059ec5a7afea1c44003 (7 prompt / 4 completion / 11 total tokens), with input_json and output_json both null.
|
I have read the CLA Document and I hereby sign the CLA |
Summary
ToolLoopAgentpathAiSdkAgent.create(...).toolLoopAgent.generate(...)path and reads the resulting trace storeWhy AgentPond
BrowserOS already centralizes provider execution in the Vercel AI SDK agent loop. AgentPond can therefore capture provider/model, operation, timing, and token metadata at that boundary without changing individual model adapters.
Configuration and privacy
Set both variables before starting the server:
Tracing is otherwise off. This integration intentionally supports only the built-in local
fsstore, records neither prompts nor responses (recordInputs: false,recordOutputs: false), and waits for pending writes before process exit.Validation
Based on upstream
maincommit5a4a9ef8f64522a9f20ccc212642ee4bba35ad49.All commands passed. The repository-wide test command includes the compiled server tests and the signed BrowserOS HTTP/CDP/MCP/chat integration (10/10).
For the AgentPond E2E, only the model provider is mocked; the production agent construction,
ToolLoopAgent.generate, OpenInference processor, exporter, local object store, flush, and shutdown paths are real. CLI read-back processed 1 object / 4 events and returned:56a3a986564a1890eb6431e8dcbd734ebrowseros-agentpond-e2e/browseros-agentpond-test-modelinput_json: null,output_json: nullLimitation
The initial integration deliberately targets only local filesystem storage so the self-contained BrowserOS server does not bundle optional cloud storage SDKs.