Skip to content

docs(agents): add Go language guide#302

Open
apascal07 wants to merge 19 commits into
pj/agents-docsfrom
ap/go-agents-docs
Open

docs(agents): add Go language guide#302
apascal07 wants to merge 19 commits into
pj/agents-docsfrom
ap/go-agents-docs

Conversation

@apascal07

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds comprehensive documentation for the experimental Agents API in Genkit Go, including code examples for defining agents, tools, HTTP serving, and advanced orchestration. The review feedback correctly identifies compilation errors in the Go code snippets where mux.HandleFunc is used instead of mux.Handle to register an http.Handler on a standard http.ServeMux.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

// mount each route onto a standard net/http mux.
mux := http.NewServeMux()
for _, route := range genkitx.AgentRoutes(weatherAgent) {
mux.HandleFunc(route.Pattern(), route.Handler())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

In Go's net/http package, mux.HandleFunc registers a handler function for the given pattern, expecting a function with the signature func(http.ResponseWriter, *http.Request). Since route.Handler() returns an http.Handler interface, you should use mux.Handle instead of mux.HandleFunc to avoid a compilation error.

		mux.Handle(route.Pattern(), route.Handler())


// One agent's routes...
for _, route := range genkitx.AgentRoutes(weatherAgent) {
mux.HandleFunc(route.Pattern(), route.Handler())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

In Go's net/http package, mux.HandleFunc registers a handler function for the given pattern, expecting a function with the signature func(http.ResponseWriter, *http.Request). Since route.Handler() returns an http.Handler interface, you should use mux.Handle instead of mux.HandleFunc to avoid a compilation error.

	mux.Handle(route.Pattern(), route.Handler())


// ...or every registered agent at once.
for _, route := range genkitx.AllAgentRoutes(g) {
mux.HandleFunc(route.Pattern(), route.Handler())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

In Go's net/http package, mux.HandleFunc registers a handler function for the given pattern, expecting a function with the signature func(http.ResponseWriter, *http.Request). Since route.Handler() returns an http.Handler interface, you should use mux.Handle instead of mux.HandleFunc to avoid a compilation error.

	mux.Handle(route.Pattern(), route.Handler())

@apascal07 apascal07 changed the base branch from pj/agents-docs to main June 18, 2026 17:00
@apascal07 apascal07 changed the base branch from main to pj/agents-docs June 18, 2026 18:17
…/NamedPrompt

Match the reworked ai/exp API: FromInline becomes InlinePrompt, and
FromPrompt splits into SameNamedPrompt (the prompt named like the agent)
and NamedPrompt(name, input) for referencing any registered prompt by
name. Adds the shared-prompt-across-agents example.
Mirror the Go API rework: DefineAgent takes an InlinePrompt slice literal and
DefinePromptAgent backs an agent with a registry prompt (default same-named, or
WithNamedPrompt), aligning the Go guide with the existing JS
defineAgent/definePromptAgent split.
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.

8 participants