Question about the unified InvocationContext/ReadonlyContext/CallbackContext
- Dominant language
- Go
- Stars
- 8.8k
- Forks
- 1k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 88
Description
Currently, the InvocationContext/CallbackContext has two implementations in the packages `agent` and `internal/context`. This will be confusing and error-prone when modifying the `InvocationContext/CallbackContext`.
For example, I would like to add a method to `InvocationContext` that allows creating an InvocationContext with the new `Context` field for tracing. It requires modifying InvocationContext/CallbackContext in both places.
And I saw the comment lines [1][2] also prefer to have a unified context. But I'm not sure if it's good to move the implementation of context from `internal/context` to `agent/context`? Then we can remove the duplicate context implementation in the `agent` package.
I would be happy to submit a PR to resolve this issue if sounds good to you.
[1] https://github.com/google/adk-go/blob/main/internal/context/callback_context.go#L70
[2] https://github.com/google/adk-go/blob/main/agent/agent.go#L303
Contributor guide
Research direction
Start by comparing the InvocationContext and CallbackContext implementations in agent and internal/context, especially internal/context/callback_context.go and the reference in agent/agent.go. Determine which package should own the unified implementation and how the Context field and future methods should be exposed. Done means the duplicate implementation is removed and both callers use one consistent context type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100