Skip to content

feat(server): add optional AgentPond tracing - #2079

Open
Marcus Schiesser (marcusschiesser) wants to merge 3 commits into
browseros-ai:mainfrom
marcusschiesser:agent/browseros-agentpond-tracing
Open

feat(server): add optional AgentPond tracing#2079
Marcus Schiesser (marcusschiesser) wants to merge 3 commits into
browseros-ai:mainfrom
marcusschiesser:agent/browseros-agentpond-tracing

Conversation

@marcusschiesser

Copy link
Copy Markdown

Summary

  • add optional AgentPond/OpenInference tracing to BrowserOS's real Vercel AI SDK ToolLoopAgent path
  • keep tracing disabled unless a local Files SDK store is explicitly configured
  • flush pending trace writes during server shutdown
  • add an end-to-end test that runs the production AiSdkAgent.create(...).toolLoopAgent.generate(...) path and reads the resulting trace store

Why 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:

FILES_SDK_PROVIDER=fs
FILES_SDK_ROOT=/path/to/local/agentpond-store

Tracing is otherwise off. This integration intentionally supports only the built-in local fs store, records neither prompts nor responses (recordInputs: false, recordOutputs: false), and waits for pending writes before process exit.

Validation

Based on upstream main commit 5a4a9ef8f64522a9f20ccc212642ee4bba35ad49.

npx --yes --min-release-age=0 agentpond@latest init
bun install --frozen-lockfile
bun run check
bun run test
AGENTPOND_E2E_ROOT=/private/tmp/browseros-agentpond-e2e-20260802-final-child \
  bun test apps/server/tests/agent/agentpond-tracing.e2e.test.ts

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:

  • LLM trace: 56a3a986564a1890eb6431e8dcbd734e
  • provider/model: browseros-agentpond-e2e / browseros-agentpond-test-model
  • tokens: 7 prompt / 4 completion / 11 total
  • input_json: null, output_json: null
  • the raw store contains neither the prompt nor response sentinel

Limitation

The initial integration deliberately targets only local filesystem storage so the self-contained BrowserOS server does not bundle optional cloud storage SDKs.

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. Thank you!
Posted by the CLA Assistant Lite bot.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

馃挕 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))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 馃憤聽/ 馃憥.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

@marcusschiesser

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant