Conversation
Signed-off-by: Yaniv Marom Nachumi <yanivmar@amdocs.com>
Signed-off-by: Yaniv Marom Nachumi <yanivmar@amdocs.com>
Signed-off-by: Yaniv Marom Nachumi <yanivmar@amdocs.com>
Signed-off-by: Yaniv Marom Nachumi <yanivmar@amdocs.com>
|
Thanks @yanivmn as discussed here https://discord.com/channels/1346225185166065826/1468206497556332556 |
Two main differences in conversion1) Direct use of SDK typesPython (kagent-adk): Uses google.genai.types and a2a.types directly. Events have clear attributes (event.content, event.error_code), and you use isinstance(event, RunItemStreamEvent) and then work with event.item. Go: The runner yields interface{} and we get *adksession.Event from the Google ADK. To avoid coupling everywhere we use reflection to get Content, Parts, ErrorCode, etc. (see extractContent, extractContentParts, extractStringField in converters.go). That adds a lot of generic, type-unsafe conversion code. 2) More layers and dual paths in GoPython: Roughly: SDK events → A2A events (and for ADK: GenAI parts ↔ A2A parts). Few layers, each with a clear type. Go: We sit between:
We can prepare a version which Dropped internal event types; use only A2A and Google ADK. |
| } | ||
|
|
||
| // BaseLLM is the interface that all LLM implementations must satisfy | ||
| type BaseLLM interface { |
There was a problem hiding this comment.
Why aren't we re-using the upstream model interface so we can also use gemini? https://github.com/google/adk-go/blob/21332faeb1b52a089d32450540edcff4d8f2518f/model/llm.go#L26-L29
| "time" | ||
|
|
||
| "github.com/go-logr/logr" | ||
| "github.com/sashabaranov/go-openai" |
There was a problem hiding this comment.
Why not use the official openai library: https://github.com/openai/openai-go
| GetType() string | ||
| } | ||
|
|
||
| type BaseModel struct { |
There was a problem hiding this comment.
Why did we mirror this code, can't we just reuse go/internal/adk/types.go?
Coupling is fine, the point here is that we are using the adk-go library, if we have fears about that library in general then that's a whole separate issue. Also I try to avoid reflection whenever possible because the code is not readable, and the performance is terrible. Although interestingly AI seems to love using reflection
To be honest, I don't completely understand what you mean by all of this. I think we should try and model the code off of the Python as much as possible. We should endeavor to use the upstream library as much as possible, and insert our own code as plugins and extensions. If there are points where that won't work for specific reasons let's discuss those specifically and we can come up with a plan. The purpose here should be to bring adk-go support to |
|
|
Im.working on a new branch without an extra layer. Controller packages not in use to prevent any changes in go folder for now |
This feature branch introduce a new declarative agent base image.
Image is based on https://github.com/google/adk-go
Test cases:
Multiple MCP calles
Azure OpenAI Model
Streaming & None Streaming agent card
Testing:
Build image: make build-app-go
Change Agent CR:
...
deployment:
image: kagent-dev/kagent/app-go