Skip to content

Instantly share code, notes, and snippets.

@awni
Last active June 25, 2025 14:58
Show Gist options
  • Save awni/ab251213217adf3798d1b6852bbd9d01 to your computer and use it in GitHub Desktop.
Save awni/ab251213217adf3798d1b6852bbd9d01 to your computer and use it in GitHub Desktop.
MLX LM with Tiny Agents
{
"model": "mlx-community/qwen3-4b-4bit-DWQ",
"endpointUrl": "http://localhost:8080/v1",
"servers": [
{
"type": "stdio",
"config": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"."
]
}
}
]
}

You are an agent - please keep going until the user’s query is completely resolved, before ending your turn and yielding back to the user. Only terminate your turn when you are sure that the problem is solved, or if you need more info from the user to solve the problem. If you are not sure about anything pertaining to the user’s request, use your tools to read files and gather the relevant information: do NOT guess or make up an answer. You MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.

@pasky
Copy link

pasky commented Jun 9, 2025

@Wauplin
Copy link

Wauplin commented Jun 10, 2025

Nice! Found out about this demo from https://x.com/awnihannun/status/1931755333011349831. Would be cool to contribute it to https://huggingface.co/datasets/tiny-agents/tiny-agents as an example. Wanna open a PR? :)

@awni
Copy link
Author

awni commented Jun 10, 2025

@Wauplin 👋 Sure thing, I'll add it once the necessary change in mlx-lm lands.

@Wauplin
Copy link

Wauplin commented Jun 10, 2025

🙌

@kannib
Copy link

kannib commented Jun 19, 2025

I set it up exactly as your did. Server works (tested with MCP Inspector), files are accessible, agent calls the funcion but does not return anything. I should add that it does work with the default remote model, just not with mlx-community/qwen3-4b-4bit-DWQ
Screenshot 2025-06-19 at 02 33 40

@awni
Copy link
Author

awni commented Jun 19, 2025

Indeed you need a special fork of mlx-lm right now for this to work: ml-explore/mlx-lm#217

We will try and get it landed and into a new release within the next few days!

@Wauplin
Copy link

Wauplin commented Jun 25, 2025

Just wanted to let you know @awni that we are pushing huggingface/huggingface_hub#3166 and huggingface/huggingface.js#1556 that will modify the file format expected by agent.json (and introduce a breaking change). The main change is that the "config" values are now at the root level and not under .config. The rational behind this is to be on-par with VSCode MCP format which should be more future-proof

{
    "model": "mlx-community/qwen3-4b-4bit-DWQ",
    "endpointUrl": "http://localhost:8080/v1",
    "servers": [
        {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@modelcontextprotocol/server-filesystem",
                "."
            ]
        }
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment