Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

KeyError: 'tables' when listing agents with SQL skills created via CREATE AGENT

オープン
#201 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
api

調査の方向性

skills.py の SQLSkill.from_json() 付近から開始し、server.agents.list() で使用される agents.py Agent.from_json() のパスを追跡します。include_tables を含む SQL スキルを持つエージェントで問題を再現し、エージェントの一覧表示が報告されたスキル JSON を処理する際に KeyError: 'tables' を発生させないことを確認します。

索引モデルが issue の本文から書いたものです。

説明

My Environment

  • Python version: 3.12.11
  • Operating system: Linux 6.12.12-061212-generic (Ubuntu-based)
  • Mindsdb Python SDK version: 3.4.4
  • Additional info if applicable: MindsDB Cloud instance, self hosted at mindsdb.openpolis.io

When attempting to list agents using server.agents.list(), the SDK throws a KeyError: 'tables' for agents that have SQL skills created through the SQL interface.

Steps to Reproduce:

  1. Create an agent using SQL with table references:
CREATE AGENT agent_001
USING
    model = {
        "provider": "google",
        "model_name": "gemini-2.0-flash",
        "api_key": "your_api_key"
    },
    data = {
         "tables": ["sales_manager_data.public.prospects_details", "sales_manager_data.public.call_summaries"]
    },
    prompt_template='
        sales_manager_data.public.prospects_details stores prospects data
        sales_manager_data.public.call_summaries stores calls from companies data
    ';
  1. Try to list agents via Python SDK:
import mindsdb_sdk
server = mindsdb_sdk.connect('https://your-instance.com', login='user', password='pass')
agents = server.agents.list()  # This throws KeyError: 'tables'

Error Details:

Traceback (most recent call last):
  File "<string>", line 16, in <module>
  File "/path/to/mindsdb_sdk/agents.py", line 233, in list
    return [Agent.from_json(agent, self) for agent in data]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/mindsdb_sdk/agents.py", line 203, in from_json
    [Skill.from_json(skill) for skill in json['skills']],
     ^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/mindsdb_sdk/skills.py", line 57, in from_json
    return SQLSkill(name, params['tables'], params['database'], params.get('description', ''))
                          ~~~~~~^^^^^^^^^^
KeyError: 'tables'

Root Cause Analysis:

When agents are created via SQL, MindsDB stores the table information in the skill params as include_tables,
but the SDK's SQLSkill.from_json() method expects the key to be tables.

Actual skill JSON structure from MindsDB:

{
  "type": "sql",
  "params": {
    "database": null,
    "description": "Auto-generated SQL skill for agent agent_001",
    "include_tables": [
      "sales_manager_data.public.prospects_details", 
      "sales_manager_data.public.call_summaries"
    ],
    "knowledge_base_database": "mindsdb",
    "type": "sql"
  }
}

Expected by SDK (skills.py:57):

return SQLSkill(name, params['tables'], params['database'], params.get('description', ''))

Suggested Fix:

The SQLSkill.from_json() method should handle both tables and include_tables keys:

# In skills.py around line 57
tables = params.get('tables') or params.get('include_tables', [])
return SQLSkill(name, tables, params['database'], params.get('description', ''))

This appears to be a version compatibility issue between how MindsDB server stores agent skills and how the SDK expects to parse them.

主要言語
Python
スター
44
フォーク
16
平均マージ
6時間 53分
マージ済み PR(30日)
1

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mindsdb/mindsdb_python_sdk のほかの issue

mindsdb/mindsdb_python_sdk の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。