zejzl

1 models • 1 total models in database
Sort by:

Z Coder

A simple coding agent built with QwenDistilledCoder (via OpenRouter) that can view/edit files and execute bash commands—all in ~200 lines. 1. Create virtual environment and install dependencies: Be sure to add your OpenRouter API key! You can get one from OpenRouter. Note: `uv` and an appropriate virtualenv are prerequisites—our agent will use uv to execute Python scripts This agent uses the OpenRouter API to access the QwenDistilledCoder model. OpenRouter provides a unified API for accessing various AI models, including those from Anthropic, OpenAI, and others. 1. Sign up for an account at OpenRouter 2. Create an API key at OpenRouter Keys 3. Add your API key to the `.env` file 4. Run the agent with `uv run simpleagent.py` The agent uses the OpenAI client library but points it to the OpenRouter API endpoint, allowing it to access the QwenDistilledCoder model. - Fix broken files: `"can you help me fix brokenfile.py?"` - Research and implement: `"research new Python 3.13 features and write a file that demonstrates a simple example"` - Create new code: `"write a simple tip splitting calculator Python file"` The agent follows a straightforward pattern with three core components: - Split system prompt (role) from user instructions for better caching - Use XML tags for structured prompts and interpretability - Include chain-of-thought reasoning with ` ` blocks - Cache tools, system prompt, and first user message for cost optimization - Return structured responses with `iserror` flag for QwenDistilledCoder - Use proper timeout protection (30s default for bash) - Include detailed error logging and handling - Support both file operations and bash commands - Handle all stop reasons robustly (tooluse, endturn, etc.) - Execute multiple tools in parallel when possible - Maintain conversation state through message history - Use low temperature (0.2) for consistent, focused responses - `simpleagent.py` - CLI version - `prompt.md` - System prompt and instructions

NaNK
license:agpl-3.0
0
2