- Call FAS as a preliminary subagent that collects context for the central agent.
- Allow the central agent to call FAS as a file exploration tool at any point in its loop.
Subagent Formatting
In this pattern, you run FAS before the main agent loop starts. This is useful for “one-shot” tasks where the user’s intent is clearly to find or modify code (e.g., “Fix the bug in the auth service”). By pre-filling the context window with relevant file locations, you save the main agent from having to spend a turn asking for them.Workflow
- Receive User Query: “How is the user session duration calculated?”
- Run FAS: Call
repo.search()immediately with the user’s query. - Hydrate Context: Append the search results to the system prompt or user message.
- Run Main Agent: The agent now has the answer in its context immediately.
Tool Approach
In this pattern, you expose FAS as a tool that your main agent can choose to invoke. This gives the agent autonomy to decide when it needs to search the codebase. This is ideal for multi-turn conversations where the agent might need to look up information dynamically based on intermediate reasoning.Tool Definition
Define a tool (e.g.,search_codebase) that wraps the FAS API.
Merging the Output
When the tool returns, you should format the results into a concise string that the model can digest. This effectively simulates thereport_back behavior of the search agent.