Back to Copilotkit

Frontend Tool Persistence

showcase/shell-docs/src/content/snippets/integrations/agno/frontend-tool-persistence.mdx

1.69.3772 B
Original Source
<Callout type="warn" title="Configure session storage"> Agno must store the paused run before a frontend tool can return its result. Configure a database on the `Agent` that owns the external tool.

Install the SQLite dependency:

bash
pip install sqlalchemy

Use a project-relative SQLite file for local development:

python
from agno.agent import Agent
from agno.db.sqlite import SqliteDb

db = SqliteDb(db_file="tmp/agno.db")

agent = Agent(
    # ...
    db=db,
)

The deployed showcase uses /tmp/agno.db because its application directory is read-only to the runtime user.

For production, use durable shared storage such as PgDb. An ephemeral container file cannot resume a run on another instance. </Callout>