Skip to content

Instantly share code, notes, and snippets.

@awni
Last active June 19, 2025 12:52
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!

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