Manta Developers
GitHub
Menu

Agents and chat

Put an agent that understands your data into your app.

The Manta agent works on your knowledge graph. It can answer questions about the data, explain where a fact comes from, write rules, chart results and propose changes as action plans.

Mount the chat

EmbeddedChatProviders connects to your Manta deployment and datastore. EmbeddedChat is the chat itself.

import { EmbeddedChat } from "@manta-eu/react/components/embedded-chat";
import { EmbeddedChatProviders } from "@manta-eu/react/providers";

export function Copilot() {
  return (
    <EmbeddedChatProviders datastoreId="your-datastore">
      <EmbeddedChat
        user={{ id: "…", email: "you@example.com", name: "You" }}
        isOperator={false}
        datastore={{ id: "your-datastore", name: "Your datastore" }}
        assistantName="Copilot"
      />
    </EmbeddedChatProviders>
  );
}

EmbeddedChat needs its own datastore prop for the chat socket. datastoreId on the providers is what GraphQL and SPARQL from this tree use. Requests carry the session from mantaBaseUrl, which defaults to https://app.hiremanta.com, so the user signs in there.

Shape the conversation

EmbeddedChat takes optional props to fit your app, including:

  • title, assistantName, assistantIcon and welcomeSubtitle to brand it
  • initialPrompt and initialDraft to start a conversation from a button elsewhere in your UI
  • pageContext to tell the agent what the user is looking at
  • onClose to show a close button when you dock it beside your own screens

Tell the agent what the user sees

pageContext takes the IRIs and types of the entities on screen. The agent then answers about “this campaign” or “these orders” without the user having to name them.

<EmbeddedChat {...props} pageContext={{ iris: [campaignIri], typenames: ["Campaign"] }} />

What the agent can do

Within the datastore the user has access to, the agent can:

  • query the graph and explain how a fact was derived
  • read, write and explain rules
  • show entities and generate charts
  • read files the user uploads in the chat
  • remember preferences and facts across conversations
  • propose action plans for you to review and run

Pages in this chapter