Why use Workflows?
Agents equipped with tool-calling are becoming more popular due to their flexibility. This flexibility comes at a cost though — they often spend a lot of time viewing files, running bash commands, and checking their work. Using a hand-crafted workflow requires more iteration on prompting & orchestration, but it can be many times faster. For prompt-to-app products, where latency can cause significant user frustration, the workflow approach is a strong option.Retrieval Step
With workflows you only have one shot at retrieval before generation, so you have to make sure you’re passing all the relevant files to the model. If the codebase is small enough, you can just pass all files into context to be safe. However, you quickly run into context limits as your users start building on top of more complex applications. Using the Relace reranker with a robust query will accurately prune down the context you send to the model.Query Composition
Include the following in your query to improve retrieval:Required
Required
- User request — the most recent direction given to the LLM.
Recommended
Recommended
- User Conversation — < 10k tokens of transcript between user and LLM.
- Error Tracebacks — context for any runtime or build errors detected.
Optional
Optional
- Fille Edit Count — number of times files were edited in the conversation.
- Current Page — code snippet of the current page the user is interfacing with.
Query Example
Choosing a Relevance Threshold
Our code reranker returns a list of objects with filename and relevance score, like this:- Codebase is too big for the context window, and you have to filter down no matter what
- Codebase fits in the context, but you want to filter to save on input tokens
token_limit parameter to make this easy. Just set it to the context length of your generation model with some buffer room for the system prompt.
For case 2, you set a relevance threshold based on the recall you want to hit.
This table is based on an average of three internal evaluation datasets.
Results may vary on other codebases and use cases. Please reach out to our
team to run evals with your data.