Developer Guide for DeepSeek-Reasonix Setup: Building the Autonomous Coding Agent
DeepSeek-Reasonix is a Go-based autonomous coding agent that ships as a single static binary, configurable via TOML files and extensible through MCP plugins, requiring only Go 1.21+ and a valid API key to get started.
This developer guide for DeepSeek-Reasonix setup walks you through the complete process of building, configuring, and extending the agent. The platform follows a clean, layered architecture with a config-driven core that remains model-agnostic through its provider interface and MCP (Modular Compute Plugin) extension system.
Prerequisites and Installation
DeepSeek-Reasonix requires Go 1.21 or later and operates as a single static binary with minimal dependencies. You can install the pre-built binary via npm or Homebrew, or compile from source.
Install via package manager:
npm i -g reasonix # pulls pre-built binary for your OS
brew install esengine/reasonix/reasonix # macOS only
Or build from source:
git clone https://github.com/esengine/DeepSeek-Reasonix.git
cd DeepSeek-Reasonix
go build -o reasonix ./cmd/reasonix/main.go
The entry point at cmd/reasonix/main.go handles crash reporting and injects build metadata before launching the agent.
Architecture Overview
The codebase follows a strict layered design that separates concerns between the CLI, agent logic, providers, and plugins:
| Layer | Package | Responsibility |
|---|---|---|
| CLI / Desktop | cmd/reasonix/main.go |
Entry point, parses flags, injects build metadata |
| Agent | internal/agent |
Orchestrates the session loop and tool calls |
| Provider | internal/provider |
Abstracts LLM backends via the Provider interface |
| Tool | internal/tool/builtin |
Built-in file-system and shell utilities |
| Plugin | internal/plugin |
Runtime MCP client for external tools |
| Config | internal/config |
Loads hierarchical TOML configuration |
| Security | internal/permission, internal/workspacelease |
Enforces policies and sandbox constraints |
This architecture ensures the engine remains dependency-light (only requiring BurntSushi/toml) while supporting complex workflows through external MCP servers.
Configuration System
DeepSeek-Reasonix uses a hierarchical TOML configuration system with the following resolution order: flag → ./reasonix.toml → user config (~/.reasonix/config.toml) → defaults.
Provider Configuration
Providers are defined in reasonix.toml and implement the Provider interface defined in internal/provider/provider.go. The registry pattern allows new models to be added without code changes.
Minimal configuration for DeepSeek models:
default_model = "deepseek-flash"
[[providers]]
name = "deepseek-flash"
kind = "anthropic"
base_url = "https://api.deepseek.com/anthropic"
model = "deepseek-v4-flash"
api_key_env = "DEEPSEEK_API_KEY"
web_search = true
Critical security note: All provider secrets are read from environment variables (DEEPSEEK_API_KEY), never from the TOML file itself.
MCP Plugin Configuration
External plugins communicate via JSON-RPC 2.0 over stdio, HTTP, or SSE transports. Register plugins in reasonix.toml:
[[plugins]]
name = "wordcount"
command = "reasonix-plugin-example"
The runtime client in internal/plugin/plugin.go adapts each remote tool to the internal Tool interface, prefixing names with mcp__<server>__ to avoid namespace collisions.
Core Components Deep Dive
The Agent Loop
The internal/agent package orchestrates the session loop, building requests, streaming responses, and handling tool calls. It maintains compacted session memory with configurable pruning (tool_result_snip_ratio) and supports checkpoints for rewinding to previous states during autonomous runs.
Provider Interface
Providers implement the interface defined in internal/provider/provider.go. Factories register via init() functions under a specific kind (e.g., "openai"). The OpenAI-compatible implementation in internal/provider/openai/openai.go supports DeepSeek endpoints, while internal/provider/anthropic/anthropic.go handles Anthropic-style APIs including DeepSeek-Flash.
Tool System
Built-in tools self-register using tool.RegisterBuiltin in internal/tool/builtin/builtin.go. Each tool must satisfy the Tool interface:
type Tool interface {
Name() string
Description() string
Schema() json.RawMessage
Execute(ctx context.Context, args json.RawMessage) (string, error)
}
Available built-ins include read_file, write_file, bash, and glob. The contract is enforced by validation logic in internal/provider/schema_validate.go.
Development Workflow
Building from Source
Compile the binary with embedded version information:
go build -ldflags "-X main.version=$(git describe --tags)" -o reasonix ./cmd/reasonix/main.go
The desktop application builds separately from desktop/main.go, which handles window management, tray icons, and auto-updates.
Running in Development Mode
Initialize your development environment:
./reasonix setup # generates initial config interactively
./reasonix # starts interactive REPL/TUI
Key REPL commands:
/init– Generate project-level instructions/skill enable <name>– Activate specific skills/config edit– Open configuration in$EDITOR
Execute one-shot tasks without entering the REPL:
./reasonix run "implement the TODOs in main.go"
Adding Custom MCP Plugins
Create a binary implementing the MCP JSON-RPC spec (see cmd/reasonix-plugin-example/main.go). The plugin can expose tools, prompts, or resources. Once registered in reasonix.toml, the agent automatically discovers and lists available tools prefixed with mcp__<server>__.
Security and Sandboxing
The permission system in internal/permission evaluates rule sets (allow, ask, deny) per tool call. Default mode is "ask" with hard-blocked patterns like Bash(rm -rf*).
The workspace lease system in internal/workspacelease confines file I/O to the workspace root and whitelisted directories. This protects the host filesystem while allowing the agent to edit project files safely.
Summary
- Single binary deployment: DeepSeek-Reasonix compiles to one static binary with pure-Go dependencies
- Config-driven architecture: Hierarchical TOML resolution (flag → local → user → defaults)
- Model-agnostic design: Provider interface abstracts OpenAI, Anthropic, and custom endpoints
- MCP extensibility: External plugins communicate via JSON-RPC without recompiling the core
- Security-first: Sandboxed file access and per-call permission evaluation protect the host system
Frequently Asked Questions
How do I add a new AI model provider without modifying source code?
Add a new provider entry to your reasonix.toml file. The internal/provider/provider.go registry automatically picks up any provider kind that has a registered factory (e.g., "openai" or "anthropic"). No recompilation is required—just define the base_url, model, and api_key_env parameters.
What is the difference between built-in tools and MCP plugins?
Built-in tools are compiled into the binary in internal/tool/builtin/ and include file system and shell operations. MCP plugins are external binaries that communicate via JSON-RPC, loaded at runtime from internal/plugin/plugin.go. MCP tools are prefixed with mcp__<server>__ to prevent naming conflicts.
Where should I store my API keys securely?
Never store API keys in reasonix.toml. Instead, reference environment variables using the api_key_env field. The configuration loader in internal/config/config.go resolves these at runtime, keeping credentials out of version control.
Can I use the Go SDK to build my own applications on top of Reasonix?
Yes. The Go SDK lives under sdk/go/ and includes runnable examples. Import reasonix/sdk/go and reasonix/sdk/go/provider to load configurations and create providers programmatically, as shown in the starter extension.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →