Skip to content

Conversation

@tgillam-do
Copy link
Collaborator

@tgillam-do tgillam-do commented Jan 6, 2026

This change adds the ability to send a session_id as a header to an agent and use that session_id to add a trace to that session. This enables the ability to have conversations show up in the DigitalOcean traces properly grouped together.

The implementation utilizes the context parameter to the entrypoint as the holder of the session_id if it is passed. This context parameter will be overloaded with other fields in the future.

@tgillam-do tgillam-do requested a review from Copilot January 6, 2026 00:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for passing a session_id through request headers to agent functions via a new RequestContext object. This enables session tracking and correlation of requests across the system.

  • Introduces RequestContext dataclass to carry request metadata (currently session_id)
  • Updates the entrypoint decorator to extract Session-Id header and pass context to handlers
  • Propagates session_id through the tracing system to CreateTracesInput

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
gradient_adk/init.py Exports RequestContext from the public API
gradient_adk/decorator.py Defines RequestContext and updates request handling to extract and pass session_id
gradient_adk/runtime/digitalocean_tracker.py Updates tracker to accept and store session_id, passes it to CreateTracesInput
integration_tests/example_agents/echo_agent/main.py Updates echo agent to use RequestContext and return session_id in response
integration_tests/run/test_adk_agents_run.py Adds integration test verifying Session-Id header passthrough
tests/decorator_test.py Adds comprehensive unit tests for RequestContext and session_id handling
tests/runtime/digitalocean_tracker_test.py Adds unit tests for session_id in tracker and trace creation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return result.trace_uuids[0]
return None
except Exception as e:
except Exception:
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The exception is being caught but the variable 'e' is removed. While silently handling exceptions may be intentional here, consider logging the exception for debugging purposes even if you don't want to break user code.

Copilot uses AI. Check for mistakes.
@tgillam-do tgillam-do merged commit b5a8a89 into main Jan 8, 2026
5 checks passed
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.

3 participants