Wrapping a Griptape chat with Gradio

I am trying to wrap this simple Python program (link to source) based on the Griptape framework into a Gradio user interface:

import io
import requests
from griptape.engines import VectorQueryEngine
from griptape.loaders import PdfLoader
from griptape.structures import Agent
from griptape.tools import KnowledgeBaseClient
from griptape.utils import Chat

namespace = "attention"

response = requests.get("https://arxiv.org/pdf/1706.03762.pdf")
engine = VectorQueryEngine()

        namespace: PdfLoader().load(

kb_client = KnowledgeBaseClient(
    description="Contains information about the Attention Is All You Need paper. "
                "Use it to answer any related questions.",

agent = Agent(


In addition to adding import gradio as gr as an import at the beginning, and removin the last line (Chat(agent).start()) … I am trying to figure out what object I need to wrap with Gradio.

I was assuming that Gradio would be alternative to using the Chat utils that ship with the framework but trying to wrap the agent object does not seem to be working.

The closest I can get it to work is by wrapping Chat as follows:

iface = gr.Interface(fn=Chat(agent).start, inputs="my input", outputs="the output")

The program seems to be launching just fine, I can connect to the (public) endpoint created and I am shown the Gradio chat UI BUT as soon as I submit the prompt in the user interface the program spits:

Traceback (most recent call last):
  File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/routes.py", line 437, in run_predict
    output = await app.get_blocks().process_api(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/blocks.py", line 1352, in process_api
    result = await self.call_function(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/blocks.py", line 1077, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/home/ec2-user/.local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
TypeError: start() takes 1 positional argument but 2 were given

Is there something obvious that I am missing?