You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "alnzng (via GitHub)" <gi...@apache.org> on 2025/09/06 05:29:58 UTC

[I] [Feature] Support built-in RAG agent [flink-agents]

alnzng opened a new issue, #144:
URL: https://github.com/apache/flink-agents/issues/144

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/flink-agents/issues) and found nothing similar.
   
   ### Description
   
   Support built-in RAG agent
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature] Support built-in RAG agent [flink-agents]

Posted by "ChickenBenny (via GitHub) via issues" <is...@flink.apache.org>.
ChickenBenny commented on issue #144:
URL: https://github.com/apache/flink-agents/issues/144#issuecomment-6818883657

   Hi, is this still wanted? I'd like to pick it up if nobody's on it.
   
   Right now you have to write the RAG flow yourself, like the [example](https://github.com/apache/flink-agents/tree/main/python/flink_agents/examples/rag) does:
   1. send a `ContextRetrievalRequestEvent`
   2. build the prompt from the returned docs and send a `ChatRequestEvent`
   3. turn the `ChatResponseEvent` into the output
   
   I'm thinking something like:
   ```python
   agent = RAGAgent(
       chat_model=ResourceDescriptor(...),
       vector_store="knowledge_base",
       max_results=3,
       prompt=None,         # optional, default template with {context} / {user_query}
       output_schema=None,  # optional, same as ReActAgent
   )
   ```
   
   A few things I'm not sure about:
   - **Shape**: a standalone `RAGAgent`, or a retrieval option on `ReActAgent`? I lean towards standalone and keeping ReAct as is.
   - **Languages**: Java and Python together, or Python first and Java in a follow-up PR?
   - **Empty results**: if no docs come back, should we still call the LLM, or let the user decide?
   
   Happy to write up a short design in Discussions first if that's better.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature] Support built-in RAG agent [flink-agents]

Posted by "wenjin272 (via GitHub) via issues" <is...@flink.apache.org>.
wenjin272 commented on issue #144:
URL: https://github.com/apache/flink-agents/issues/144#issuecomment-6846326921

   Thanks, this direction looks good to me!
   
   Tool calls are already covered by durable execution in ToolCallAction, in both Python and Java, so the retrieval tool does not need to add its own durable_execute wrapper.
   
   Python first with a Java follow-up is fine. Deferring filters, scores, and ResourceName / YAML alias support also sounds reasonable for the initial PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature] Support built-in RAG agent [flink-agents]

Posted by "wenjin272 (via GitHub) via issues" <is...@flink.apache.org>.
wenjin272 commented on issue #144:
URL: https://github.com/apache/flink-agents/issues/144#issuecomment-6820190139

   Thanks for offering to work on this @ChickenBenny! This issue was opened quite a while ago, and the framework has evolved since then.
   
   The proposed `RAGAgent` would essentially provide a fixed 2-step RAG flow: retrieve documents, then generate an answer using them. We already support this through the existing events and actions, as shown in the RAG example, so a dedicated agent would mainly reduce boilerplate.
   
   At this point, I think making retrieval easier to use as a tool would be more useful. A built-in vector store retrieval tool could let an existing `ReActAgent` search a knowledge base when needed, refine its query, or search again based on the results. It would also be reusable across different agents.
   
   Would you be interested in exploring that direction instead? We could start with a tool that references a registered vector store and returns document content and source metadata, while keeping the fixed 2-step flow covered by the example.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature] Support built-in RAG agent [flink-agents]

Posted by "ChickenBenny (via GitHub) via issues" <is...@flink.apache.org>.
ChickenBenny commented on issue #144:
URL: https://github.com/apache/flink-agents/issues/144#issuecomment-6825873215

   Thanks @wenjin272! Yeah, a retrieval tool makes more sense to me too. I'd like to work on it.
   
   Here's roughly what I'm thinking:
   
   ```python
   ResourceDescriptor(
       clazz=ResourceName.Tool.VECTOR_STORE_SEARCH,
       vector_store="knowledge_base",
       max_results=3,
       name="search_flink_docs",
       description="Search the Flink documentation.",
   )
   ```
   
   - The LLM only passes `query`. `max_results` is set in config so the results don't get too long.
   - It returns each doc's `content` and `metadata`, so the model can tell where the info came from.
   - If nothing is found, it returns something like "No relevant documents found." instead of an empty string.
   - If the vector store name is wrong or the query fails, it's reported as a tool error.
   - I'd leave filters and scores out for now and add them later if needed.
   - I'll keep the current RAG example and add a new one with `ReActAgent` + this tool.
   
   A couple of questions:
   
   1. There's no `ResourceName.Tool` yet. Is it OK to add one (plus the YAML alias)?
   2. Some vector stores are Java-only (OpenSearch, Milvus, pgvector, etc.). Should I start with Java or Python?
   
   If this sounds good, I'll start with a small PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org