Runtype
BlogPersona

Files, Tool Calls, and Thinking: Rich AI Interactions in Persona

Persona handles file uploads, tool call visualization, and reasoning display natively. Build AI features that go beyond plain text responses.

Runtype TeamRuntype Team
personaattachmentstool-callingreasoningfiles

A plain text chat is fine for simple Q&A. But real AI products need more. Users want to upload documents for the agent to analyze. Developers need to see what tools the model is calling. Product teams want to understand when the model is reasoning through complex problems.

Persona handles all of this natively.

File attachments

Users can drag and drop files directly into the chat. Images, PDFs, text files, Office documents. The files get sent to the model, and the agent can reason about their contents.

Enable file attachments
initAgentWidget({
target: document.getElementById('chat'),
config: {
  attachments: {
    enabled: true,
    maxFiles: 5,
    maxFileSize: 10 * 1024 * 1024  // 10MB
  }
}
})

This opens up a whole category of use cases: a B2B purchase order processor that reads uploaded invoices, a support agent that analyzes screenshots of errors, a document reviewer that takes PDFs and provides feedback.

The chat widget shows file thumbnails inline, handles upload progress, and the agent's response references the uploaded content naturally.

Tool call visualization

When your agent calls tools, Persona can show that activity to users. Each tool invocation appears as an expandable bubble showing the tool name, its inputs, and the results.

For some products, this transparency builds trust. Users can see that the agent actually looked up their order status or checked inventory before responding. It's not a black box.

For other products, you might want to keep tool calls hidden. That's fine too. The visibility is configurable per deployment.

Human-in-the-loop approval

For sensitive tool calls, Persona supports an approval flow. The agent proposes a tool call, the user sees what it wants to do, and they approve or reject it before execution.

This is useful for actions with real consequences: updating a record, sending a message, modifying a configuration. The user stays in control.

Thinking and reasoning display

Some models support extended thinking or chain-of-thought reasoning. Persona can optionally show this to users.

When enabled, users see the model's reasoning process as it works through a problem. This is particularly valuable for:

  • Technical users who want to understand how the AI reached its conclusion
  • Debugging your product during development, even if you hide reasoning in production
  • Complex workflows where seeing the thought process adds confidence in the result

The reasoning display works with Persona's event stream panel. During development, you can toggle this on to watch every SSE event as it flows through, giving you full visibility into what the model is doing at each step.

Enable debug mode for development
// During development, show the full event stream
initAgentWidget({
target: document.getElementById('chat'),
config: {
  debug: true,
  features: {
    showToolCalls: true,
    showThinking: true
  }
}
})

Putting it together

The real power comes from combining these capabilities. A user uploads a purchase order PDF. The agent reads it, calls a tool to check inventory for the listed items, reasons through any discrepancies, and responds with a detailed analysis.

The user sees the file they uploaded, the tool calls checking inventory, and a clear response. Everything is transparent, interactive, and built into the chat experience.

Enable attachments and showToolCalls in your Persona config, point it at a flow with tool steps, and watch the whole interaction play out in the chat thread.