Gemini provider returns empty responses despite successful proxy initialization
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
- Set up environment with
GOOGLE_GEMINI_API_KEY - Run:
npx agentic-flow --agent coder --task "Write a Python function to reverse a string" --provider gemini --verbose - 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
- Gemini API Key Detection: Correctly detected from
.env - Proxy Initialization:
AnthropicToGeminiProxystarts successfully on port 3000 - Provider Selection: Correctly routes to Gemini provider
- Model Configuration: Uses
gemini-2.0-flash-expas 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.outputis empty despite proxy showing "Completed"
π Relevant Files
agentic-flow/dist/proxy/anthropic-to-gemini.js- Proxy implementationagentic-flow/dist/agents/claudeAgent.js- Agent runneragentic-flow/dist/index.js- Output displayagentic-flow/dist/cli-proxy.js- CLI proxy startup (line 210:startGeminiProxy)
π Potential Root Causes
- Response Conversion: The
convertGeminiToAnthropicfunction may not be extracting text correctly from Gemini responses - Async/Await Issue: Response might not be properly awaited before being logged
- Error Swallowing: Errors might be caught and not propagated, resulting in empty output
- 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
- Add debug logging to
convertGeminiToAnthropicto see what Gemini actually returns - Check if Gemini API is being called (add request logging)
- Verify the proxy response format matches Anthropic's expected format
- 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.jswhich does work - Issue affects both streaming and non-streaming modes
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up β it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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