Skip to main content

Making an Agent That Reads from a File

To make an agent that reads from a PDF or Office document (like Word, Excel, or PowerPoint), all you need to do is state that you are reading from a file in the agent’s body. The Logic API will automatically convert and handle the rest. demo pdf

Step 1: Creating an agent that summarizes lease agreements

As an example, let’s create an agent that summarizes lease agreements. The agent will read from a PDF file and summarize the key points of the lease agreement. We want the agent to contain a summary of the costs, terms, and conditions of the lease agreement. The agent will also include a list of the parties involved in the lease agreement. To start, let’s create an agent with the following content:

Step 2: Testing this iteration of the agent

Using the Preview button, we can test this agent to see if it works as expected. The agent will read from the PDF file and summarize the key points of the lease agreement. By testing this agent with an example lease agreement PDF, we can see the output:
Output
The agent is working as expected, but it still needs some tweaks. The Logic API was able to read the PDF file and create a summary of the charges and monthly fees, but the summary doesn’t include details like the resident’s name, the address of the housing, or the name of the owner of the property. The API did correctly summarize the avoidable charges, with cost.

Step 3: Improving the agent

To improve the agent, we can add more specific instructions to the agent’s body. For example, we can specify that we want the agent to include the cost of each item in the summary.

Step 4: Testing this new iteration of the agent

Using the Preview button, we can test this agent to see if it works as expected. The agent will read from the PDF file and summarize the key points of the lease agreement.
new output
In this new iteration of the agent, the Logic API was able to read the PDF file and create a summary of the key points of the lease agreement. The agent included the cost of each item in the summary, as well as a simple explanation of what each fee is and what it means to the user.

Conclusion

In summary, the Logic API makes it simple to read from a PDF or Office file. By including an instruction in the agent body indicating that a file should be read, the Logic API will automatically manage the required processing, including any necessary conversions from formats like Word or Excel into PDF. You can correct and improve the agent by adding more specific instructions to the agent’s body. This will help the Logic API understand what you want it to do with the file. Now, you can publish your agent and begin using the API to read from PDF files and other documents.