Skip to main content

Citing Sources

When interacting with agents, it's important to let end users know where information was sourced when answering a question or performing an action. In BotDojo, we provide several options for doing this.

When using BotDojo's chat UI, we render markdown-based footnotes using the following format: Markdown Footnote Format

Example

The current weather in Austin, TX is 79°F and cloudy, with a RealFeel® of 89° and described as very warm[^1].

[^1]: [Current Weather Austin, TX](https://www.accuweather.com/en/us/austin/78701/current-weather/351193)

This will render in chat like this: Citations Example

If you prompt an agent to output this format , it should all work. However, when searching 40-80 websites and documents, LLMs often mess up links. So we provide some workarounds for doing this.

Creating Citations

BotDojo provides a structured way to reference and attribute information sources within your AI applications. Each source - whether it's a webpage, document, or other content - is automatically assigned a unique citation ID when processed through BotDojo's search and indexing tools. This system allows language models to easily reference sources by simply including the citation ID in their responses, making it simple to maintain proper attribution and get dependable links to sources.

The following tools will create citations by default when returning results:

Any results returned from these tools will create a citation id for each source. The citation id is a number and can be referenced in an agent output as [^{citation id}].

When an agent is finished, the Agent Node can create the appropriate markdown footer with the correct links. Make sure you have Add citation references to LLM output turned on to enable this.

Agent and Citations

The Agent node collects citation objects from every tool call in the run. At runtime it stores them in a session-scoped citation store that keeps track of the next numeric Citation ID inside the session state.

When the agent emits a final reply and the Add citation references to LLM output toggle is enabled each citation link out to the reference document or webpage.

Citation Metadata

Each citation carries the metadata supplied by the retrieval tool. The chat UI uses meta.reference_url for the hyperlink target and meta.reference_title (falling back to meta.title or the document path) for the visible label in both the inline footnote and the Show Sources panel. Make sure your data sources populate those fields—via Markdown front matter, loader configuration, or a code node—so citations render with the right title and a dependable link.

Using citations in evaluations

Every completed flow request persists its citation store with the session record. Evaluation flows can map the citations to an evaluation input. This is how context-focused evaluators—such as the Context Recall metric audit whether the agent had enough supporting information to answer the question.

Custom citations from Code nodes

Need to cite bespoke data that didn't come from a retrieval node? Code nodes can attach an _citations array to their tool output (see Code nodes) and the Agent Node will merge those objects into the same session store.

Many LLMs will cite items automatically, but we recommend you add something like the following to your system prompt to nudge the model to correctly cite sources:

 For each search, if citations are provided in the search results, cite your sources by adding references in the form [^citation_id], for example [^3]. Only reference the documents from the search results; If you don't have a citationId then don't add a citation.

Showing All Sources

In addition to citing sources inline, there is an option in Chat Settings called Show Sources that will list icons for all the citations created. When clicked, this will open a panel with all the links.

Sources