> For the complete documentation index, see [llms.txt](https://docs.dagploy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dagploy.com/documentation/ai-agent/ocr.md).

# Scan Photos or Images

Many raw photos coming from outside like Sales Order, Fuel notes, Reimbursement, Paper document, checklist and other thing. We are building AI agent to read those image, restructure the information and pass it into next AI Agent or internal system.

### Create Agent

Go to "Agent", select "Add Agent" menu on the top right. Once the page showing-up, choose the "New Connection"&#x20;

<figure><img src="https://2967462928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1ihwSpws3fgJmUYzJFWJ%2Fuploads%2Fl0wl8kVxLNUaf1kph9Bo%2Fimage.png?alt=media&amp;token=4338c780-0ccc-4e10-880a-e1ff932efec1" alt=""><figcaption></figcaption></figure>

### Choose the OCR model

There are several OCR model you can try. Its recommended to use "OCR-G001" for heavy tasks to manage handwritten notes.

<figure><img src="https://2967462928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1ihwSpws3fgJmUYzJFWJ%2Fuploads%2F7QzsEnWTO8d3fSMyrRHU%2Fimage.png?alt=media&amp;token=23739083-be37-4f19-90ad-bdaaa70b48ac" alt=""><figcaption></figcaption></figure>

### Setup the AI Agent name&#x20;

You can give name for the AI agent and also see how the default prompt being used for this OCR

<figure><img src="https://2967462928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1ihwSpws3fgJmUYzJFWJ%2Fuploads%2Foc4BvObem2qoNfs41S5L%2Fimage.png?alt=media&amp;token=0838f561-522c-4610-81a9-285a3908aca1" alt=""><figcaption></figcaption></figure>

### Bonus: Next Agent to Parse

This is only scan image and convert into text. The result will be unstructured and need to be re-formated to make it works with system integration that you needed. In that case, you can chain with another AI Agent to manage it.

To chain it, you can tick which the AI Agent will be activated once the OCR completed&#x20;

<figure><img src="https://2967462928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1ihwSpws3fgJmUYzJFWJ%2Fuploads%2F3fyzwlFdPeXbELhVuK8c%2Fimage.png?alt=media&amp;token=218c42cb-a6b3-4813-bceb-cf1f4430f597" alt=""><figcaption></figcaption></figure>

### Give a shot!

![](https://2967462928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1ihwSpws3fgJmUYzJFWJ%2Fuploads%2FGXw0hoA6GmTud0iwVCuI%2Fimage.png?alt=media\&token=8809bae4-6ba4-4876-abc6-07cbef1c1d49)

Url: <https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTWfmugKdj2iTRTeLb2qWDFMF7YIjc2Ui_rCbG-nykAqv13MdpvHav_xdM&s=10>

You can paste the image url into the chat

<figure><img src="https://2967462928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1ihwSpws3fgJmUYzJFWJ%2Fuploads%2FqW5SQXmMLxq8t3r2M94Z%2Fimage.png?alt=media&amp;token=373369c4-72d9-439b-b481-2cf055816425" alt=""><figcaption></figcaption></figure>

### API Integration

You can submit the URL into AI Agents via API. Go to "Channels", Select "Add" and Choose "API". Generate the "API Key" and use that as the authentication during API call.&#x20;

![](https://2967462928-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1ihwSpws3fgJmUYzJFWJ%2Fuploads%2FOFyAupdfpqW0mrfNYGBt%2Fimage.png?alt=media\&token=a4b4a868-a3bf-414b-8e44-fa892759f53f) &#x20;

Congratulations! Now you made OCR AI agent successfully!&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.dagploy.com/documentation/ai-agent/ocr.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
