Qwen3-1.7B Strands Adapter
LoRA adapter that teaches Qwen3-1.7B-4bit comprehensive knowledge of the Strands Agents SDK - without breaking tool calling capabilities.
π― What This Does
Transforms base Qwen3-1.7B into a Strands SDK expert that can:
- β Explain Strands architecture and patterns
- β Generate correct installation commands
- β Show working code examples for agent creation
- β Describe tool creation patterns (@tool decorator, hot reload)
- β Explain all model providers (Bedrock, Anthropic, OpenAI, Ollama, MLX)
- β Guide through MLX training pipelines
- β Describe multi-agent systems (Swarm, Workflow)
- β Preserve 100% tool calling capability
π Training Results
| Metric | Base Model | Trained Model |
|---|---|---|
| Strands Knowledge | 0/10 (hallucinates) | 10/10 (accurate) |
| Tool Calling | Works | β 100% preserved |
| Training Time | - | 14 minutes |
| Adapter Size | - | 19MB |
π Quick Start
pip install strands-agents strands-mlx
from strands import Agent
from strands_mlx import MLXModel
# Load base model + this adapter
model = MLXModel(
model_id="mlx-community/Qwen3-1.7B-4bit",
adapter_path="cagataycali/qwen3-strands-adapter" # Your HF repo
)
agent = Agent(model=model)
# Now it knows Strands!
agent("How do I create a Strands tool?")
# β Accurate answer with working code examples
agent("What model providers does Strands support?")
# β Complete list: Bedrock, Anthropic, OpenAI, Ollama, MLX, etc.
π Training Details
Dataset:
- 105 question-answer pairs about Strands SDK
- Generated using embedded Strands documentation
- Avg 1,621 tokens per example
- Complete tool call cycles captured (user β assistant(tool_calls) β tool(results) β assistant(final))
Training Configuration:
- Base Model: mlx-community/Qwen3-1.7B-4bit
- Method: LoRA (Low-Rank Adaptation)
- Iterations: 200 (conservative to prevent overfitting)
- Learning Rate: 1e-5
- LoRA Rank: 8
- LoRA Scale: 16.0
- Training Time: 14 minutes on Apple Silicon
- Hardware: M-series Mac
Key Training Strategy:
- Conservative iteration count to avoid catastrophic forgetting
mask_prompt=True- Only train on assistant completions- Gradient checkpointing for memory efficiency
- ChatML format with proper tool call structure
π§ Advanced Usage
With Tools
from strands import Agent
from strands_mlx import MLXModel
model = MLXModel(
model_id="mlx-community/Qwen3-1.7B-4bit",
adapter_path="cagataycali/qwen3-strands-adapter"
)
# Tool calling still works perfectly!
agent = Agent(
model=model,
tools=["calculator", "shell", "file_read"]
)
agent("Calculate 15 * 7 and explain Strands")
# β Uses calculator AND provides Strands knowledge
Swap Adapters
# Load different adapters for different domains
strands_model = MLXModel(
"mlx-community/Qwen3-1.7B-4bit",
adapter_path="cagataycali/qwen3-strands-adapter"
)
coding_model = MLXModel(
"mlx-community/Qwen3-1.7B-4bit",
adapter_path="your-coding-adapter"
)
π What It Learned
The adapter was trained on comprehensive Strands documentation covering:
Installation & Setup
- pip installation methods
- Virtual environment setup
- Model provider configuration
Core Concepts
- Agent creation patterns
- Tool creation (@tool decorator, hot reload)
- Session managers
- System prompts
Model Providers
- Bedrock (AWS)
- Anthropic
- OpenAI
- Ollama (local)
- MLX (Apple Silicon)
- Gemini, LiteLLM, GitHub Models
Advanced Features
- Multi-agent systems (Swarm, Workflow)
- MLX training pipeline
- MCP server integration
- Direct tool calls
π Training Your Own Domain Expert
Want to create your own domain-specific adapter? Here's how:
from strands import Agent
from strands_mlx import MLXModel, MLXSessionManager
from strands_mlx.tools import mlx_trainer, dataset_splitter
# 1. Collect training data
session = MLXSessionManager(session_id="my_domain")
model = MLXModel("mlx-community/Qwen3-1.7B-4bit")
agent = Agent(model=model, session_manager=session)
# Have conversations (100-200 examples recommended)
agent("Teach me about X")
# Data auto-saved to ~/.strands/mlx_training_data/my_domain.jsonl
# 2. Split dataset
dataset_splitter(
input_path="~/.strands/mlx_training_data/my_domain.jsonl",
train_ratio=0.8,
valid_ratio=0.1,
test_ratio=0.1
)
# 3. Train
mlx_trainer(
action="train",
config={
"model": "mlx-community/Qwen3-1.7B-4bit",
"data": "~/.strands/mlx_training_data/my_domain",
"iters": 200,
"learning_rate": 1e-5,
"batch_size": 1,
"grad_checkpoint": True
}
)
# 4. Use it!
trained = MLXModel("mlx-community/Qwen3-1.7B-4bit", adapter_path="./adapter")
π¬ Benchmarks
Question: "How do I create a Strands agent with tools?"
Base Model Response:
I'll help you create a strands agent. Let me use the system_monitor tool...
<tool_call>{"name": "system_monitor", ...}</tool_call> β Hallucinated tool
Trained Model Response:
from strands import Agent
agent = Agent(
system_prompt="You are a helpful assistant",
tools=["calculator", "shell", "file_read"]
)
agent("Calculate 2+2")
π¦ Files in This Adapter
adapters.safetensors- Trained LoRA weightsadapter_config.json- LoRA configuration0000100_adapters.safetensors- Checkpoint at iter 1000000200_adapters.safetensors- Checkpoint at iter 200
π οΈ Requirements
pip install strands-agents>=0.2.0 strands-mlx>=0.2.1
π License
Same as base model (Apache 2.0)
π Acknowledgments
- Built with Strands Agents SDK
- Base model: Qwen3-1.7B-4bit
- Training framework: MLX
π Links
- Strands SDK: https://github.com/strands-agents/sdk-python
- Strands MLX: https://github.com/cagataycali/strands-mlx
- Base Model: https://huggingface.co/mlx-community/Qwen3-1.7B-4bit