Skip to main content
Use timbal.platform.knowledge_bases.query to execute SQL against a Timbal knowledge base. Configure TIMBAL_API_HOST, TIMBAL_API_KEY, TIMBAL_ORG_ID, and TIMBAL_KB_ID before creating the run context, or supply an authenticated platform configuration. See Semantic search for a complete environment example. Create the tickets table through your database setup or migration process first. This example assumes customer_id and priority columns. The agent receives specific operations rather than a tool accepting arbitrary SQL:
query(sql, params, org_id=..., kb_id=...) targets the current K2 endpoint and returns parsed response JSON, typically with a rows list. Set legacy=True only for an existing legacy knowledge base. The removed timbal.platform.kbs.tables and embedding-management helpers are not part of the current Python package. User values belong in positional parameters, while table and column identifiers stay fixed in code. The sample insert tool requires approval; handle and resume it as described in Approval gates. Query counts depend on the records already in your database.