Before you attempt to build a complex agent, it can be helpful to build a plan for what the agent will do, what data (if any) is required, and the logic of how the agent should accomplish its task. You should account for both high-level logic that informs the sequencing of steps the agent will take as well as the behavior you want the agent to follow for specific actions.
Note that it’s helpful to start by defining the overall functionality, as this can inform which data sources you will need to build your agent successfully.
Your plan does not need to be overly detailed - here’s an example of a plan we used to construct a demo HR chatbot that can handle a wide variety of inquiries.
Having this plan in place will speed up the process of building a complex Glean Agent. Here’s what our completed HR Agent looks like:
Once you have a rough plan for how your agent should work, what data you need, and the high-level logic to be followed, you should start creating your agent.
Using your plan as a reference, start constructing your agent based on where the required data comes from. This data will come from one of three places: a) it is provided by the user, b) it is deterministically read into memory every time the agent executes, or c) the necessary data is determined by the LLM when the agent runs.
Data that comes from the agent user: For a task-based agent, anything that you need the user to provide should become an input field (in conversational agents, any documents in the user message are automatically read into memory).
Data that is read every time the agent runs: Some documents will need to be read every time an agent runs. These documents should be directly linked in Think, Respond, or Read content steps.
Data that depends on the agent user input: some documents needed by your agent may not be known at the time you build the agent. For example, if you want to read the jira tickets mentioned in a support ticket, you will not know what those jira URLs are when you create the agent. In this case, assuming the support ticket is taken as an input field, you will need to use natural language instructions in a Read document step to read the Jiras. See an example below:
In this example,
Once you have the initial data gathering steps completed, you can move onto control flow. If the steps your agent should take never change, you do not need to worry about adding any branches. Otherwise, if certain conditions alter the behavior of your agent, you should consider adding a branch, which allows you to specify a natural language condition for each branch. The branch will be executed if the condition is met; conditions are executed sequentially from 1 onwards, and only one branch will execute.
Note that it can be helpful to tag a previous step’s output within one of these conditions. For example, in the below example, condition 1 will execute only if the output of the tagged step contains at least one URL:
If the condition you want to check in your branch is either complicated or requires company-specific knowledge, providing the branch step with examples of when the condition is met can improve the performance of your agent.
Each step adds its output to the agent’s “memory” - this is what each step has access to by default. This means that the memory grows larger as more steps execute. Reading large documents or including a large number of search results will fill up the memory faster.
When You have a few tools at your disposal to manage the memory of agents:
Glean Agents allow you to customize the model used at the agent level as well as at the step level. If your task involves complex reasoning or requires generating a large amount of tokens, it may be worth selecting a more advanced model, such as reasoning models including o3 and Gemini 2.5 Pro.
To configure the LLM for the entire agent, click the gear icon in the top right of the screen and click on the “Select Model” dropdown.
To configure the LLM for a specific step, select that step, click the three dot icon close to the top right of the screen, select ‘Advanced settings”, and then click the “Select Model” dropdown.
Before you attempt to build a complex agent, it can be helpful to build a plan for what the agent will do, what data (if any) is required, and the logic of how the agent should accomplish its task. You should account for both high-level logic that informs the sequencing of steps the agent will take as well as the behavior you want the agent to follow for specific actions.
Note that it’s helpful to start by defining the overall functionality, as this can inform which data sources you will need to build your agent successfully.
Your plan does not need to be overly detailed - here’s an example of a plan we used to construct a demo HR chatbot that can handle a wide variety of inquiries.
Having this plan in place will speed up the process of building a complex Glean Agent. Here’s what our completed HR Agent looks like:
Once you have a rough plan for how your agent should work, what data you need, and the high-level logic to be followed, you should start creating your agent.
Using your plan as a reference, start constructing your agent based on where the required data comes from. This data will come from one of three places: a) it is provided by the user, b) it is deterministically read into memory every time the agent executes, or c) the necessary data is determined by the LLM when the agent runs.
Data that comes from the agent user: For a task-based agent, anything that you need the user to provide should become an input field (in conversational agents, any documents in the user message are automatically read into memory).
Data that is read every time the agent runs: Some documents will need to be read every time an agent runs. These documents should be directly linked in Think, Respond, or Read content steps.
Data that depends on the agent user input: some documents needed by your agent may not be known at the time you build the agent. For example, if you want to read the jira tickets mentioned in a support ticket, you will not know what those jira URLs are when you create the agent. In this case, assuming the support ticket is taken as an input field, you will need to use natural language instructions in a Read document step to read the Jiras. See an example below:
In this example,
Once you have the initial data gathering steps completed, you can move onto control flow. If the steps your agent should take never change, you do not need to worry about adding any branches. Otherwise, if certain conditions alter the behavior of your agent, you should consider adding a branch, which allows you to specify a natural language condition for each branch. The branch will be executed if the condition is met; conditions are executed sequentially from 1 onwards, and only one branch will execute.
Note that it can be helpful to tag a previous step’s output within one of these conditions. For example, in the below example, condition 1 will execute only if the output of the tagged step contains at least one URL:
If the condition you want to check in your branch is either complicated or requires company-specific knowledge, providing the branch step with examples of when the condition is met can improve the performance of your agent.
Each step adds its output to the agent’s “memory” - this is what each step has access to by default. This means that the memory grows larger as more steps execute. Reading large documents or including a large number of search results will fill up the memory faster.
When You have a few tools at your disposal to manage the memory of agents:
Glean Agents allow you to customize the model used at the agent level as well as at the step level. If your task involves complex reasoning or requires generating a large amount of tokens, it may be worth selecting a more advanced model, such as reasoning models including o3 and Gemini 2.5 Pro.
To configure the LLM for the entire agent, click the gear icon in the top right of the screen and click on the “Select Model” dropdown.
To configure the LLM for a specific step, select that step, click the three dot icon close to the top right of the screen, select ‘Advanced settings”, and then click the “Select Model” dropdown.