Skip to content
Discussion options

You must be logged in to vote

I was going to type up an answer but then I thought - why not let Gemini CLI itself answer this question:

You've asked a great question, and your intuition is correct. The logic for handling the multi-step "think -> execute tool -> repeat" flow is indeed a core part of gemini-cli.

You were close with turn.ts, but the main re-request loop you're looking for is in packages/cli/src/nonInteractiveCli.ts.

Here is a breakdown of how it works:

  1. Entry Point (gemini.tsx): When you run the CLI with piped input or a command-line question (i.e., non-interactively), the main function in gemini.tsx calls runNonInteractive.

  2. The Core Loop (nonInteractiveCli.ts): The runNonInteractive function contains…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@dayeguilaiye
Comment options

Answer selected by dayeguilaiye
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants