mindsdb / mindsdb/minds_python_sdk

[Bug]: [mindsdb_sdk] KeyError when listing agents using server.agents.list()

Open
#80 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13
Forks
12
Avg merge
15h 28m
Merged PRs (30d)
2

Description

Short description of current behavior

When attempting to list agents using the server.agents.list() method, a KeyError is raised due to a missing 'tables' key in the params dictionary. This error occurs even when the agents are properly configured.

Actual Result:
A KeyError is raised with the message "'tables'".
Stacktrace:

Traceback (most recent call last):
  File "C:\work\clients\mindsdb\server.py", line 7, in <module>
    agents = server.agents.list()
             ^^^^^^^^^^^^^^^^^^^^
  File "C:\work\clients\mindsdb\venv\Lib\site-packages\mindsdb_sdk\agents.py", line 233, in list
    return [Agent.from_json(agent, self) for agent in data]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\work\clients\mindsdb\venv\Lib\site-packages\mindsdb_sdk\agents.py", line 203, in from_json
    [Skill.from_json(skill) for skill in json['skills']],
     ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\work\clients\mindsdb\venv\Lib\site-packages\mindsdb_sdk\skills.py", line 57, in from_json
    return SQLSkill(name, params['tables'], params['database'], params.get('description', ''))
                          ~~~~~~^^^^^^^^^^
KeyError: 'tables'
Video or screenshots

No response

Expected behavior

The server.agents.list() method should return a list of agent objects without raising any errors.

How to reproduce the error
  • Connect to MindsDB using mindsdb_sdk.connect()

  • List all databases using server.list_databases()

  • Attempt to list all agents using server.agents.list()

Anything else?

Environment:

MindsDB SDK version:

mindsdb_sdk==3.4.4
mindsdb_sql_parser==0.0.2

Python version: Python 3.12.4

Operating System: Windows 11pro

Additional Information:

This issue may be related to the configuration of the agents or the MindsDB SDK itself. Further investigation is needed to determine the root cause of the error.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mindsdb_sdk/agents.py at Agent.from_json and mindsdb_sdk/skills.py at Skill.from_json, then reproduce the failure with server.agents.list() using the versions in the report. Trace the agent skill payload, especially SQL skills missing the 'tables' key; done means configured agents can be listed without a KeyError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.