Skip to content

Conversation

@codeusb
Copy link

@codeusb codeusb commented Jan 10, 2026

Description

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

[Fixes #<issue_number_goes_here> 🦕
](fix: samples js change port make it work & change model better results)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @codeusb, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the JavaScript samples for the Coder Agent by updating the underlying AI model to gemini-2.5-flash-lite for potentially better results and adjusting the default server port to 41241 to ensure proper operation. Additionally, it includes minor code formatting improvements for consistency and readability.

Highlights

  • Model Update: The Genkit AI model used by the Coder Agent has been switched from "gemini-2.5-pro-exp-03-25" to "gemini-2.5-flash-lite" for potentially better results.
  • Port Change: The default listening port for the Coder Agent server has been updated from 41242 to 41241.
  • Code Formatting: Minor code style adjustments were made in index.ts, including consistent use of double quotes for string literals, improved indentation, and added semicolons.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 updates the AI model and server port for the coder agent sample, and includes several code formatting improvements for consistency. My review identifies a bug where the agent's URL is hardcoded, which could cause issues when a custom port is used. I've suggested a refactoring to fix this by dynamically constructing the URL. I've also included a couple of minor suggestions to improve code cleanliness.

Comment on lines 329 to 395
const coderAgentCard: AgentCard = {
name: 'Coder Agent',
description:
'An agent that generates code based on natural language instructions and streams file outputs.',
url: 'http://localhost:41242/', // Adjusted port and base URL
provider: {
organization: 'A2A Samples',
url: 'https://example.com/a2a-samples',
},
version: '0.0.2', // Incremented version
capabilities: {
streaming: true, // Agent streams artifact updates
pushNotifications: false,
stateTransitionHistory: true,
},
securitySchemes: undefined,
security: undefined,
defaultInputModes: ['text'],
defaultOutputModes: ['text', 'file'], // 'file' implies artifacts
skills: [
{
id: 'code_generation',
name: 'Code Generation',
description:
'Generates code snippets or complete files based on user requests, streaming the results.',
tags: ['code', 'development', 'programming'],
examples: [
'Write a python function to calculate fibonacci numbers.',
'Create an HTML file with a basic button that alerts "Hello!" when clicked.',
],
inputModes: ['text'],
outputModes: ['text', 'file'],
name: "Coder Agent",
description:
"An agent that generates code based on natural language instructions and streams file outputs.",
url: "http://localhost:41241/", // Adjusted port and base URL
provider: {
organization: "A2A Samples",
url: "https://example.com/a2a-samples",
},
],
supportsAuthenticatedExtendedCard: false,
version: "0.0.2", // Incremented version
capabilities: {
streaming: true, // Agent streams artifact updates
pushNotifications: false,
stateTransitionHistory: true,
},
securitySchemes: undefined,
security: undefined,
defaultInputModes: ["text"],
defaultOutputModes: ["text", "file"], // 'file' implies artifacts
skills: [
{
id: "code_generation",
name: "Code Generation",
description:
"Generates code snippets or complete files based on user requests, streaming the results.",
tags: ["code", "development", "programming"],
examples: [
"Write a python function to calculate fibonacci numbers.",
'Create an HTML file with a basic button that alerts "Hello!" when clicked.',
],
inputModes: ["text"],
outputModes: ["text", "file"],
},
],
supportsAuthenticatedExtendedCard: false,
};

async function main() {
// 1. Create TaskStore
const taskStore: TaskStore = new InMemoryTaskStore();

// 2. Create AgentExecutor
const agentExecutor: AgentExecutor = new CoderAgentExecutor();

// 3. Create DefaultRequestHandler
const requestHandler = new DefaultRequestHandler(
coderAgentCard,
taskStore,
agentExecutor
);

// 4. Create and setup A2AExpressApp
const appBuilder = new A2AExpressApp(requestHandler);
const expressApp = appBuilder.setupRoutes(express(), '');

// 5. Start the server
const PORT = process.env.CODER_AGENT_PORT || 41242; // Different port for coder agent
expressApp.listen(PORT, () => {
console.log(`[CoderAgent] Server using new framework started on http://localhost:${PORT}`);
console.log(`[CoderAgent] Agent Card: http://localhost:${PORT}/.well-known/agent-card.json`);
console.log('[CoderAgent] Press Ctrl+C to stop the server');
});
// 1. Create TaskStore
const taskStore: TaskStore = new InMemoryTaskStore();

// 2. Create AgentExecutor
const agentExecutor: AgentExecutor = new CoderAgentExecutor();

// 3. Create DefaultRequestHandler
const requestHandler = new DefaultRequestHandler(
coderAgentCard,
taskStore,
agentExecutor
);

// 4. Create and setup A2AExpressApp
const appBuilder = new A2AExpressApp(requestHandler);
const expressApp = appBuilder.setupRoutes(express(), "");

// 5. Start the server
const PORT = process.env.CODER_AGENT_PORT || 41241; // Different port for coder agent
expressApp.listen(PORT, () => {
console.log(
`[CoderAgent] Server using new framework started on http://localhost:${PORT}`
);
console.log(
`[CoderAgent] Agent Card: http://localhost:${PORT}/.well-known/agent-card.json`
);
console.log("[CoderAgent] Press Ctrl+C to stop the server");
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The coderAgentCard has a hardcoded url, but the server port can be configured via an environment variable. This can lead to the agent advertising an incorrect URL if a custom port is used. To resolve this, I recommend moving the coderAgentCard definition inside the main function to dynamically construct the URL with the correct port.

async function main() {
    const PORT = process.env.CODER_AGENT_PORT || 41241;

    const coderAgentCard: AgentCard = {
        name: "Coder Agent",
        description:
            "An agent that generates code based on natural language instructions and streams file outputs.",
        url: `http://localhost:${PORT}/`, // Use dynamic port
        provider: {
            organization: "A2A Samples",
            url: "https://example.com/a2a-samples",
        },
        version: "0.0.2", // Incremented version
        capabilities: {
            streaming: true, // Agent streams artifact updates
            pushNotifications: false,
            stateTransitionHistory: true,
        },
        securitySchemes: undefined,
        security: undefined,
        defaultInputModes: ["text"],
        defaultOutputModes: ["text", "file"], // 'file' implies artifacts
        skills: [
            {
                id: "code_generation",
                name: "Code Generation",
                description:
                    "Generates code snippets or complete files based on user requests, streaming the results.",
                tags: ["code", "development", "programming"],
                examples: [
                    "Write a python function to calculate fibonacci numbers.",
                    'Create an HTML file with a basic button that alerts "Hello!" when clicked.',
                ],
                inputModes: ["text"],
                outputModes: ["text", "file"],
            },
        ],
        supportsAuthenticatedExtendedCard: false,
    };

    // 1. Create TaskStore
    const taskStore: TaskStore = new InMemoryTaskStore();

    // 2. Create AgentExecutor
    const agentExecutor: AgentExecutor = new CoderAgentExecutor();

    // 3. Create DefaultRequestHandler
    const requestHandler = new DefaultRequestHandler(
        coderAgentCard,
        taskStore,
        agentExecutor
    );

    // 4. Create and setup A2AExpressApp
    const appBuilder = new A2AExpressApp(requestHandler);
    const expressApp = appBuilder.setupRoutes(express(), "");

    // 5. Start the server
    expressApp.listen(PORT, () => {
        console.log(
            `[CoderAgent] Server using new framework started on http://localhost:${PORT}`
        );
        console.log(
            `[CoderAgent] Agent Card: http://localhost:${PORT}/.well-known/agent-card.json`
        );
        console.log("[CoderAgent] Press Ctrl+C to stop the server");
    });
}

generatedFiles.length > 0
? `Generated files: ${generatedFiles.join(
", "
)} `
Copy link
Contributor

Choose a reason for hiding this comment

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

low

There's an unnecessary trailing space in this template literal. Removing it improves code cleanliness.

Suggested change
)} `
)}`

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