ruvnet / ruvnet/agentic-flow

Gemini provider returns empty responses despite successful proxy initialization

Open
#51 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
812
Forks
175
Avg merge
2m
Merged PRs (30d)
3

Description

Description

The Gemini provider successfully initializes and starts the proxy server at http://localhost:3000, but agent executions return empty output despite completing successfully.

Environment

  • Gemini API Key: βœ“ Set and valid
  • Provider: gemini
  • Model: gemini-2.0-flash-exp
  • Proxy URL: http://localhost:3000

Steps to Reproduce

  1. Set up environment with GOOGLE_GEMINI_API_KEY
  2. Run: npx agentic-flow --agent coder --task "Write a Python function to reverse a string" --provider gemini --verbose
  3. Observe output:
πŸš€ Initializing Gemini proxy...
βœ… Gemini Proxy running at http://localhost:3000
πŸ€– Agent: coder
🎯 Task: Write a Python function to reverse a string
⏳ Running...
βœ… Completed!
═══════════════════════════════════════

                                        <-- EMPTY OUTPUT HERE

═══════════════════════════════════════

Expected Behavior

The agent should return the actual LLM response (Python code in this case) between the separator lines.

Actual Behavior

The proxy initializes successfully but the result.output is empty.

Investigation Findings

βœ… Working Components
  1. Gemini API Key Detection: Correctly detected from .env
  2. Proxy Initialization: AnthropicToGeminiProxy starts successfully on port 3000
  3. Provider Selection: Correctly routes to Gemini provider
  4. Model Configuration: Uses gemini-2.0-flash-exp as expected
πŸ› Issue Location

The issue appears to be in how responses are captured and returned from the Gemini proxy:

  • File: agentic-flow/dist/index.js:103
  • Code: console.log(result.output);
  • Problem: result.output is empty despite proxy showing "Completed"
πŸ“ Relevant Files
  1. agentic-flow/dist/proxy/anthropic-to-gemini.js - Proxy implementation
  2. agentic-flow/dist/agents/claudeAgent.js - Agent runner
  3. agentic-flow/dist/index.js - Output display
  4. agentic-flow/dist/cli-proxy.js - CLI proxy startup (line 210: startGeminiProxy)
πŸ” Potential Root Causes
  1. Response Conversion: The convertGeminiToAnthropic function may not be extracting text correctly from Gemini responses
  2. Async/Await Issue: Response might not be properly awaited before being logged
  3. Error Swallowing: Errors might be caught and not propagated, resulting in empty output
  4. SDK Integration: The Claude Agent SDK may not be handling the proxy responses correctly

Test with MCP Tool

mcp__agentic-flow__agentic_flow_agent({
  agent: "coder",
  task: "Write a Python function to check if a string is a palindrome",
  provider: "gemini",
  verbose: true
})

Result: Same issue - proxy starts but output is empty.

Suggested Debugging Steps

  1. Add debug logging to convertGeminiToAnthropic to see what Gemini actually returns
  2. Check if Gemini API is being called (add request logging)
  3. Verify the proxy response format matches Anthropic's expected format
  4. Test with a minimal direct Gemini API call outside the proxy

Additional Context

  • Other providers (Anthropic, OpenRouter) work correctly
  • The proxy architecture is similar to anthropic-to-openrouter.js which does work
  • Issue affects both streaming and non-streaming modes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up β€” it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with agentic-flow/dist/proxy/anthropic-to-gemini.js and compare its response conversion with the working anthropic-to-openrouter.js implementation. Trace the result through dist/agents/claudeAgent.js to dist/index.js:103, and check dist/cli-proxy.js around startGeminiProxy. Done means the Gemini agent returns its generated text in both streaming and non-streaming modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.