sagixs 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sagixs-0.2.0/.gitignore +10 -0
- sagixs-0.2.0/CHANGELOG.md +18 -0
- sagixs-0.2.0/CONTRIBUTING.md +11 -0
- sagixs-0.2.0/LICENSE +17 -0
- sagixs-0.2.0/PKG-INFO +248 -0
- sagixs-0.2.0/README.md +197 -0
- sagixs-0.2.0/pyproject.toml +62 -0
- sagixs-0.2.0/src/sagixs/__init__.py +3 -0
- sagixs-0.2.0/src/sagixs/__main__.py +4 -0
- sagixs-0.2.0/src/sagixs/agent.py +271 -0
- sagixs-0.2.0/src/sagixs/cli.py +373 -0
- sagixs-0.2.0/src/sagixs/config.py +91 -0
- sagixs-0.2.0/src/sagixs/prompts.py +79 -0
- sagixs-0.2.0/src/sagixs/providers/__init__.py +1 -0
- sagixs-0.2.0/src/sagixs/providers/anthropic.py +180 -0
- sagixs-0.2.0/src/sagixs/providers/base.py +119 -0
- sagixs-0.2.0/src/sagixs/providers/http.py +88 -0
- sagixs-0.2.0/src/sagixs/providers/local_gguf.py +112 -0
- sagixs-0.2.0/src/sagixs/providers/local_transformers.py +192 -0
- sagixs-0.2.0/src/sagixs/providers/openai_compat.py +178 -0
- sagixs-0.2.0/src/sagixs/providers/registry.py +273 -0
- sagixs-0.2.0/src/sagixs/repl.py +110 -0
- sagixs-0.2.0/src/sagixs/sessions.py +37 -0
- sagixs-0.2.0/src/sagixs/toolprompt.py +186 -0
- sagixs-0.2.0/src/sagixs/tools/__init__.py +15 -0
- sagixs-0.2.0/src/sagixs/tools/base.py +107 -0
- sagixs-0.2.0/src/sagixs/tools/files.py +228 -0
- sagixs-0.2.0/src/sagixs/tools/search.py +136 -0
- sagixs-0.2.0/src/sagixs/tools/shell.py +95 -0
- sagixs-0.2.0/src/sagixs/ui.py +121 -0
- sagixs-0.2.0/tests/conftest.py +165 -0
- sagixs-0.2.0/tests/test_agent.py +254 -0
- sagixs-0.2.0/tests/test_cli.py +208 -0
- sagixs-0.2.0/tests/test_local_providers.py +223 -0
- sagixs-0.2.0/tests/test_providers_http.py +204 -0
- sagixs-0.2.0/tests/test_registry.py +133 -0
- sagixs-0.2.0/tests/test_repl.py +86 -0
- sagixs-0.2.0/tests/test_toolprompt.py +103 -0
- sagixs-0.2.0/tests/test_tools.py +148 -0
sagixs-0.2.0/.gitignore
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
Sagixs becomes an agent, not just a chat loop.
|
|
6
|
+
|
|
7
|
+
- **Agent with tools**: `read_file`, `list_dir`, `glob`, `grep`, `edit_file`, `write_file`, `bash`, with permission modes (`readonly`, `ask`, `auto-edit`, `yolo`), diff previews, and a workspace sandbox for file paths.
|
|
8
|
+
- **Any model**: OpenAI-compatible presets (OpenAI, OpenRouter, Groq, Together, Hugging Face router, Cylink, Ollama, LM Studio, llama.cpp), native Anthropic provider, user-defined providers, and local Hugging Face (`transformers`) and GGUF (`llama-cpp-python`) providers.
|
|
9
|
+
- **Two tool-call styles**: native function calling, or a text `<tool_call>` protocol that works with any model. `auto` mode falls back to text when an API rejects tools.
|
|
10
|
+
- Streaming output, Ctrl-C to stop a turn, `-p/--print` one-shot mode with stdin support, `-c` to continue a session, `SAGIXS.md` project instructions.
|
|
11
|
+
- `sagixs models`, `sagixs auth`, `sagixs config add-provider`, improved `sagixs providers` and `sagixs doctor`.
|
|
12
|
+
- **No runtime dependencies**: HTTP now uses the standard library (`httpx` and `huggingface_hub` are no longer required). The Hugging Face API is reached through the Inference Providers router (`--provider huggingface`).
|
|
13
|
+
- Retries on 429/5xx with `Retry-After`.
|
|
14
|
+
- **Changed**: `sagixs chat` is now the same as `sagixs` (agent with tools; use `--no-tools` for plain chat). The `huggingface` extra is replaced by `local` and `gguf`. Default `temperature` is now unset (provider default) instead of 0.7. Credentials and `base_url` safety rules are described in the README.
|
|
15
|
+
|
|
16
|
+
## 0.1.0 - Initial alpha
|
|
17
|
+
|
|
18
|
+
- Terminal chat loop, OpenAI-compatible and Hugging Face Inference Providers adapters, user configuration, basic tests.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
1. Open an issue describing the change or bug.
|
|
4
|
+
2. Create a focused branch.
|
|
5
|
+
3. Install development dependencies with `python -m pip install -e ".[dev]"`.
|
|
6
|
+
4. Run `pytest` and `ruff check .`.
|
|
7
|
+
5. Submit a pull request with a clear description and test notes.
|
|
8
|
+
|
|
9
|
+
Tests must not need network access or model weights: use the fake provider and local HTTP server in `tests/conftest.py`. If you change a local provider (`local_transformers.py`, `local_gguf.py`), please also try it once against a real small model and say so in the PR.
|
|
10
|
+
|
|
11
|
+
Do not commit credentials, access tokens, private model weights, or personal data.
|
sagixs-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CyanixLabs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
sagixs-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sagixs
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A Claude Code-style terminal agent that works with any model API or a local Hugging Face model.
|
|
5
|
+
Project-URL: Homepage, https://github.com/suprosmith-coder/sagixs
|
|
6
|
+
Project-URL: Repository, https://github.com/suprosmith-coder/sagixs
|
|
7
|
+
Project-URL: Issues, https://github.com/suprosmith-coder/sagixs/issues
|
|
8
|
+
Author: CyanixLabs
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2026 CyanixLabs
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Keywords: agent,ai,cli,coding-agent,huggingface,llm,terminal,termux
|
|
28
|
+
Classifier: Development Status :: 3 - Alpha
|
|
29
|
+
Classifier: Environment :: Console
|
|
30
|
+
Classifier: Intended Audience :: Developers
|
|
31
|
+
Classifier: Operating System :: OS Independent
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
37
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
38
|
+
Classifier: Topic :: Software Development
|
|
39
|
+
Requires-Python: >=3.10
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
42
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
43
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
44
|
+
Provides-Extra: gguf
|
|
45
|
+
Requires-Dist: llama-cpp-python>=0.2.90; extra == 'gguf'
|
|
46
|
+
Provides-Extra: local
|
|
47
|
+
Requires-Dist: accelerate>=0.30; extra == 'local'
|
|
48
|
+
Requires-Dist: torch>=2.2; extra == 'local'
|
|
49
|
+
Requires-Dist: transformers>=4.44; extra == 'local'
|
|
50
|
+
Description-Content-Type: text/markdown
|
|
51
|
+
|
|
52
|
+
# Sagixs In Terminal
|
|
53
|
+
|
|
54
|
+
A Claude Code-style AI agent for your terminal. It reads and edits files, searches your project, and runs commands, using **any model you point it at**:
|
|
55
|
+
|
|
56
|
+
- **Any API:** OpenAI, Anthropic, OpenRouter, Groq, Together, Hugging Face Inference Providers, the Cylink API, or any OpenAI-compatible endpoint.
|
|
57
|
+
- **Local servers:** Ollama, LM Studio, llama.cpp `llama-server`, vLLM.
|
|
58
|
+
- **Local Hugging Face models:** run a model from the Hub (or a folder on disk) directly on your machine with `transformers`, or a GGUF file with `llama-cpp-python`.
|
|
59
|
+
|
|
60
|
+
No runtime dependencies for the API providers (standard library only), so it installs cleanly on Termux.
|
|
61
|
+
|
|
62
|
+
> **Status: 0.2.0 alpha.** The agent loop, tools, API providers and CLI are covered by an automated test suite (106 tests, including end-to-end runs against a local fake API server). The local model providers are tested against stand-ins for `transformers` and `llama_cpp`, **not against real model weights** - please report problems. See [Limitations](#limitations).
|
|
63
|
+
|
|
64
|
+
## Install
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
python -m pip install sagixs # agent + every API provider
|
|
68
|
+
python -m pip install "sagixs[local]" # + run Hugging Face models locally (torch, transformers)
|
|
69
|
+
python -m pip install "sagixs[gguf]" # + run GGUF models locally (llama-cpp-python)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
From a checkout: `python -m pip install -e ".[dev]"`. Python 3.10+.
|
|
73
|
+
|
|
74
|
+
## Quick start
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
cd your-project
|
|
78
|
+
export GROQ_API_KEY=... # or: sagixs auth set groq
|
|
79
|
+
sagixs --provider groq
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
> add a --verbose flag to cli.py and update the tests
|
|
84
|
+
● read_file(cli.py)
|
|
85
|
+
● edit_file(cli.py)
|
|
86
|
+
Edit cli.py
|
|
87
|
+
--- a/cli.py ...
|
|
88
|
+
Allow edit_file? [y]es / [n]o / [a]lways this session:
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
One-shot mode, for scripts and pipes:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
sagixs -p "summarize what this repo does"
|
|
95
|
+
git diff | sagixs -p "review this diff" --provider openrouter --model anthropic/claude-sonnet-4.5
|
|
96
|
+
sagixs -p --yes "run the tests and fix any failures"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Choosing a model
|
|
100
|
+
|
|
101
|
+
Pick a provider with `--provider` and a model with `--model`, or combine them as `provider:model`.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
sagixs providers # what's available and which keys are set
|
|
105
|
+
sagixs models --provider groq # list a provider's models
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
| Provider | Key | Notes |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| `openai` | `OPENAI_API_KEY` | default model `gpt-4o-mini` |
|
|
111
|
+
| `anthropic` | `ANTHROPIC_API_KEY` | native Messages API; pass `--model` |
|
|
112
|
+
| `openrouter` | `OPENROUTER_API_KEY` | default `openrouter/auto`; any model id from their catalog |
|
|
113
|
+
| `groq` | `GROQ_API_KEY` | default `llama-3.3-70b-versatile` |
|
|
114
|
+
| `together` | `TOGETHER_API_KEY` | pass `--model` |
|
|
115
|
+
| `huggingface` | `HF_TOKEN` | Hugging Face Inference Providers (hosted); pass `--model` |
|
|
116
|
+
| `cylink` | `CYLINK_API_KEY` | default `cyanix-core`; uses text tool calls (see below) |
|
|
117
|
+
| `ollama` | none | `http://127.0.0.1:11434/v1` |
|
|
118
|
+
| `lmstudio` | none | `http://127.0.0.1:1234/v1` |
|
|
119
|
+
| `llamacpp` | none | `llama-server` on `http://127.0.0.1:8080/v1` |
|
|
120
|
+
| `custom` | `SAGIXS_API_KEY` | any OpenAI-compatible URL via `--base-url` |
|
|
121
|
+
| `hf-local` | `HF_TOKEN` (gated models) | run a Hub model locally with transformers |
|
|
122
|
+
| `gguf` | `HF_TOKEN` (gated models) | run a GGUF model locally |
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
sagixs --provider openrouter --model deepseek/deepseek-chat
|
|
126
|
+
sagixs --model groq:llama-3.1-8b-instant
|
|
127
|
+
sagixs --provider anthropic --model <a model id from `sagixs models --provider anthropic`>
|
|
128
|
+
sagixs --provider cylink
|
|
129
|
+
sagixs --provider ollama --model qwen2.5-coder:7b
|
|
130
|
+
sagixs --provider custom --base-url https://my.server/v1 --model my-model
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Your own provider
|
|
134
|
+
|
|
135
|
+
Register any OpenAI-compatible endpoint once and use it by name:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
sagixs config add-provider mylab --base-url https://api.mylab.dev/v1 --api-key-env MYLAB_KEY --model mylab-1
|
|
139
|
+
sagixs --provider mylab
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Local Hugging Face models
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
pip install "sagixs[local]"
|
|
146
|
+
sagixs --provider hf-local --model Qwen/Qwen2.5-Coder-1.5B-Instruct
|
|
147
|
+
sagixs --provider hf-local --model ./my-finetuned-model --device cpu
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Accepts a Hub repo id or a local directory. Options: `--device` (`cpu`, `cuda`, `mps`, `auto`), `--dtype` (`auto`, `float16`, `bfloat16`, `float32`), `--max-tokens`, `--temperature`, `--trust-remote-code` (off by default; only enable it for repos you trust). The model must have a chat template.
|
|
151
|
+
|
|
152
|
+
### Local GGUF models
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
pip install "sagixs[gguf]"
|
|
156
|
+
sagixs --provider gguf --model ./model-q4_k_m.gguf
|
|
157
|
+
sagixs --provider gguf --model "Qwen/Qwen2.5-Coder-7B-Instruct-GGUF:*q4_k_m.gguf" --n-ctx 8192
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`owner/repo` downloads a `*q4_k_m.gguf` file; add `:FILE_OR_GLOB` to choose another. `--n-gpu-layers` offloads layers to a GPU.
|
|
161
|
+
|
|
162
|
+
### Termux (Android)
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
pkg install python
|
|
166
|
+
pip install sagixs
|
|
167
|
+
sagixs auth set groq
|
|
168
|
+
sagixs --provider groq
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
PyTorch generally isn't available on Termux, so for on-device models use a GGUF model or run `llama-server` / Ollama and connect with `--provider llamacpp` / `ollama`. API providers work as-is.
|
|
172
|
+
|
|
173
|
+
## How tool calling works
|
|
174
|
+
|
|
175
|
+
Models act through tools: `read_file`, `list_dir`, `glob`, `grep`, `edit_file`, `write_file`, and `bash`.
|
|
176
|
+
|
|
177
|
+
- **Native** - for APIs with function calling (OpenAI, Anthropic, Groq, OpenRouter, ...), Sagixs uses the provider's own tool-calling field.
|
|
178
|
+
- **Text protocol** - for local models, and APIs without a `tools` field (Cylink, `llama-server` by default), Sagixs teaches the model a small `<tool_call>{json}</tool_call>` format in the system prompt and parses it from the reply. Any model that can follow instructions can use this; one tool call per reply.
|
|
179
|
+
- **Auto** - the default. APIs start native; if one rejects the request because of tools, Sagixs switches to the text protocol mid-conversation and carries on. Force a style with `--tool-mode native|prompt`.
|
|
180
|
+
|
|
181
|
+
Small models can write malformed or wrong tool calls. Sagixs reports parse problems back to the model so it can retry, but a 1B model is not going to behave like a frontier model.
|
|
182
|
+
|
|
183
|
+
## Permissions
|
|
184
|
+
|
|
185
|
+
By default Sagixs **asks before it edits a file or runs a command**, showing a diff for edits. Reading and searching never ask.
|
|
186
|
+
|
|
187
|
+
| Mode | Reads | Edits | Commands |
|
|
188
|
+
|---|---|---|---|
|
|
189
|
+
| `readonly` | yes | blocked | blocked |
|
|
190
|
+
| `ask` (default) | yes | asks | asks |
|
|
191
|
+
| `auto-edit` | yes | yes | asks |
|
|
192
|
+
| `yolo` (`--yes`) | yes | yes | yes |
|
|
193
|
+
|
|
194
|
+
Set with `--mode`, `/mode` in a session, or `sagixs config set mode auto-edit`. Answer `a` at a prompt to stop asking about that tool for the session. When not run from a terminal (`-p` with piped input), anything that would need approval is **declined** unless you pass `--yes` or `--mode auto-edit`.
|
|
195
|
+
|
|
196
|
+
File tools only touch files inside the folder you launched from (`--cwd` to change it); symlinks that point outside it are refused. **`bash` is not sandboxed** - an approved command can do anything your user can. Use `ask` mode (or a container) with models you don't trust.
|
|
197
|
+
|
|
198
|
+
## In a session
|
|
199
|
+
|
|
200
|
+
`/help` `/model NAME` `/provider NAME [MODEL]` `/mode MODE` `/tools` `/status` `/clear` `/exit`. End a line with `\` to continue it. **Ctrl-C** stops the current turn without quitting; files already changed stay changed. `sagixs -c` continues the last conversation in the current folder.
|
|
201
|
+
|
|
202
|
+
Put standing instructions in `SAGIXS.md` in your project (`AGENTS.md` or `CLAUDE.md` are read too). Machine-wide instructions go in `~/.config/sagixs/SAGIXS.md`.
|
|
203
|
+
|
|
204
|
+
## Configuration
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
sagixs config set provider groq
|
|
208
|
+
sagixs config set model llama-3.3-70b-versatile
|
|
209
|
+
sagixs config set mode auto-edit
|
|
210
|
+
sagixs config show # never prints keys
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Keys: `provider model base_url mode tool_mode max_steps temperature max_tokens timeout system_prompt device dtype n_ctx n_gpu_layers`. Flags override the config file.
|
|
214
|
+
|
|
215
|
+
**API keys** come from, in order: `--api-key`, the provider's environment variable, then `sagixs auth set PROVIDER`, which stores the key in `~/.config/sagixs/credentials.json` with owner-only permissions (plain text on disk - it is not encrypted). Keys are never written to `config.json`.
|
|
216
|
+
|
|
217
|
+
Safeguards against sending a key to the wrong place: a `base_url` saved in config only applies to the `custom` provider, and if you point a preset at a different host with `--base-url`, Sagixs will not send that preset's key there - supply `SAGIXS_API_KEY` or `--api-key` for that endpoint.
|
|
218
|
+
|
|
219
|
+
## Limitations
|
|
220
|
+
|
|
221
|
+
- **Local providers are not yet verified against real weights.** The code paths (loading, streaming, stop handling, errors) are tested with stand-ins, and `transformers`/`llama-cpp-python` APIs change between versions. If something breaks, `sagixs doctor` shows what's installed.
|
|
222
|
+
- **The Cylink base URL (`https://cylinkdev.vercel.app/api/v1`) is an assumption.** If your endpoint differs, use `sagixs config add-provider cylink --base-url ... --tool-mode prompt`. Cylink currently ignores `temperature`, `top_p` and `stop`; Sagixs tolerates that, but the model may write text after a tool call, which Sagixs discards.
|
|
223
|
+
- Local chat templates vary: some reject a `system` role (Sagixs folds it into the first user message) or require strict user/assistant alternation.
|
|
224
|
+
- Context management is simple: when a conversation outgrows the model's budget, old tool output is dropped. There is no summarization yet; use `/clear` if answers degrade. Local models default to a small budget.
|
|
225
|
+
- No web access, MCP, or sub-agents yet. `bash` can fetch URLs if you approve it.
|
|
226
|
+
|
|
227
|
+
## Development
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
git clone https://github.com/suprosmith-coder/sagixs.git && cd sagixs
|
|
231
|
+
python -m pip install -e ".[dev]"
|
|
232
|
+
pytest && ruff check .
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Roadmap
|
|
236
|
+
|
|
237
|
+
- [x] Provider adapters: OpenAI-compatible, Anthropic, local transformers, GGUF
|
|
238
|
+
- [x] Streaming output
|
|
239
|
+
- [x] Tool runtime (files, search, shell) with permission modes
|
|
240
|
+
- [x] Text tool-call protocol for any model
|
|
241
|
+
- [ ] Verify local providers against real models; model capability registry
|
|
242
|
+
- [ ] Context summarization
|
|
243
|
+
- [ ] Web fetch/search tool, MCP client
|
|
244
|
+
- [ ] Native Sagixs model adapter
|
|
245
|
+
|
|
246
|
+
## License
|
|
247
|
+
|
|
248
|
+
MIT. See [LICENSE](LICENSE).
|
sagixs-0.2.0/README.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Sagixs In Terminal
|
|
2
|
+
|
|
3
|
+
A Claude Code-style AI agent for your terminal. It reads and edits files, searches your project, and runs commands, using **any model you point it at**:
|
|
4
|
+
|
|
5
|
+
- **Any API:** OpenAI, Anthropic, OpenRouter, Groq, Together, Hugging Face Inference Providers, the Cylink API, or any OpenAI-compatible endpoint.
|
|
6
|
+
- **Local servers:** Ollama, LM Studio, llama.cpp `llama-server`, vLLM.
|
|
7
|
+
- **Local Hugging Face models:** run a model from the Hub (or a folder on disk) directly on your machine with `transformers`, or a GGUF file with `llama-cpp-python`.
|
|
8
|
+
|
|
9
|
+
No runtime dependencies for the API providers (standard library only), so it installs cleanly on Termux.
|
|
10
|
+
|
|
11
|
+
> **Status: 0.2.0 alpha.** The agent loop, tools, API providers and CLI are covered by an automated test suite (106 tests, including end-to-end runs against a local fake API server). The local model providers are tested against stand-ins for `transformers` and `llama_cpp`, **not against real model weights** - please report problems. See [Limitations](#limitations).
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
python -m pip install sagixs # agent + every API provider
|
|
17
|
+
python -m pip install "sagixs[local]" # + run Hugging Face models locally (torch, transformers)
|
|
18
|
+
python -m pip install "sagixs[gguf]" # + run GGUF models locally (llama-cpp-python)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
From a checkout: `python -m pip install -e ".[dev]"`. Python 3.10+.
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cd your-project
|
|
27
|
+
export GROQ_API_KEY=... # or: sagixs auth set groq
|
|
28
|
+
sagixs --provider groq
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
> add a --verbose flag to cli.py and update the tests
|
|
33
|
+
● read_file(cli.py)
|
|
34
|
+
● edit_file(cli.py)
|
|
35
|
+
Edit cli.py
|
|
36
|
+
--- a/cli.py ...
|
|
37
|
+
Allow edit_file? [y]es / [n]o / [a]lways this session:
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
One-shot mode, for scripts and pipes:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
sagixs -p "summarize what this repo does"
|
|
44
|
+
git diff | sagixs -p "review this diff" --provider openrouter --model anthropic/claude-sonnet-4.5
|
|
45
|
+
sagixs -p --yes "run the tests and fix any failures"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Choosing a model
|
|
49
|
+
|
|
50
|
+
Pick a provider with `--provider` and a model with `--model`, or combine them as `provider:model`.
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
sagixs providers # what's available and which keys are set
|
|
54
|
+
sagixs models --provider groq # list a provider's models
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
| Provider | Key | Notes |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `openai` | `OPENAI_API_KEY` | default model `gpt-4o-mini` |
|
|
60
|
+
| `anthropic` | `ANTHROPIC_API_KEY` | native Messages API; pass `--model` |
|
|
61
|
+
| `openrouter` | `OPENROUTER_API_KEY` | default `openrouter/auto`; any model id from their catalog |
|
|
62
|
+
| `groq` | `GROQ_API_KEY` | default `llama-3.3-70b-versatile` |
|
|
63
|
+
| `together` | `TOGETHER_API_KEY` | pass `--model` |
|
|
64
|
+
| `huggingface` | `HF_TOKEN` | Hugging Face Inference Providers (hosted); pass `--model` |
|
|
65
|
+
| `cylink` | `CYLINK_API_KEY` | default `cyanix-core`; uses text tool calls (see below) |
|
|
66
|
+
| `ollama` | none | `http://127.0.0.1:11434/v1` |
|
|
67
|
+
| `lmstudio` | none | `http://127.0.0.1:1234/v1` |
|
|
68
|
+
| `llamacpp` | none | `llama-server` on `http://127.0.0.1:8080/v1` |
|
|
69
|
+
| `custom` | `SAGIXS_API_KEY` | any OpenAI-compatible URL via `--base-url` |
|
|
70
|
+
| `hf-local` | `HF_TOKEN` (gated models) | run a Hub model locally with transformers |
|
|
71
|
+
| `gguf` | `HF_TOKEN` (gated models) | run a GGUF model locally |
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
sagixs --provider openrouter --model deepseek/deepseek-chat
|
|
75
|
+
sagixs --model groq:llama-3.1-8b-instant
|
|
76
|
+
sagixs --provider anthropic --model <a model id from `sagixs models --provider anthropic`>
|
|
77
|
+
sagixs --provider cylink
|
|
78
|
+
sagixs --provider ollama --model qwen2.5-coder:7b
|
|
79
|
+
sagixs --provider custom --base-url https://my.server/v1 --model my-model
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Your own provider
|
|
83
|
+
|
|
84
|
+
Register any OpenAI-compatible endpoint once and use it by name:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
sagixs config add-provider mylab --base-url https://api.mylab.dev/v1 --api-key-env MYLAB_KEY --model mylab-1
|
|
88
|
+
sagixs --provider mylab
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Local Hugging Face models
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pip install "sagixs[local]"
|
|
95
|
+
sagixs --provider hf-local --model Qwen/Qwen2.5-Coder-1.5B-Instruct
|
|
96
|
+
sagixs --provider hf-local --model ./my-finetuned-model --device cpu
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Accepts a Hub repo id or a local directory. Options: `--device` (`cpu`, `cuda`, `mps`, `auto`), `--dtype` (`auto`, `float16`, `bfloat16`, `float32`), `--max-tokens`, `--temperature`, `--trust-remote-code` (off by default; only enable it for repos you trust). The model must have a chat template.
|
|
100
|
+
|
|
101
|
+
### Local GGUF models
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
pip install "sagixs[gguf]"
|
|
105
|
+
sagixs --provider gguf --model ./model-q4_k_m.gguf
|
|
106
|
+
sagixs --provider gguf --model "Qwen/Qwen2.5-Coder-7B-Instruct-GGUF:*q4_k_m.gguf" --n-ctx 8192
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`owner/repo` downloads a `*q4_k_m.gguf` file; add `:FILE_OR_GLOB` to choose another. `--n-gpu-layers` offloads layers to a GPU.
|
|
110
|
+
|
|
111
|
+
### Termux (Android)
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
pkg install python
|
|
115
|
+
pip install sagixs
|
|
116
|
+
sagixs auth set groq
|
|
117
|
+
sagixs --provider groq
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
PyTorch generally isn't available on Termux, so for on-device models use a GGUF model or run `llama-server` / Ollama and connect with `--provider llamacpp` / `ollama`. API providers work as-is.
|
|
121
|
+
|
|
122
|
+
## How tool calling works
|
|
123
|
+
|
|
124
|
+
Models act through tools: `read_file`, `list_dir`, `glob`, `grep`, `edit_file`, `write_file`, and `bash`.
|
|
125
|
+
|
|
126
|
+
- **Native** - for APIs with function calling (OpenAI, Anthropic, Groq, OpenRouter, ...), Sagixs uses the provider's own tool-calling field.
|
|
127
|
+
- **Text protocol** - for local models, and APIs without a `tools` field (Cylink, `llama-server` by default), Sagixs teaches the model a small `<tool_call>{json}</tool_call>` format in the system prompt and parses it from the reply. Any model that can follow instructions can use this; one tool call per reply.
|
|
128
|
+
- **Auto** - the default. APIs start native; if one rejects the request because of tools, Sagixs switches to the text protocol mid-conversation and carries on. Force a style with `--tool-mode native|prompt`.
|
|
129
|
+
|
|
130
|
+
Small models can write malformed or wrong tool calls. Sagixs reports parse problems back to the model so it can retry, but a 1B model is not going to behave like a frontier model.
|
|
131
|
+
|
|
132
|
+
## Permissions
|
|
133
|
+
|
|
134
|
+
By default Sagixs **asks before it edits a file or runs a command**, showing a diff for edits. Reading and searching never ask.
|
|
135
|
+
|
|
136
|
+
| Mode | Reads | Edits | Commands |
|
|
137
|
+
|---|---|---|---|
|
|
138
|
+
| `readonly` | yes | blocked | blocked |
|
|
139
|
+
| `ask` (default) | yes | asks | asks |
|
|
140
|
+
| `auto-edit` | yes | yes | asks |
|
|
141
|
+
| `yolo` (`--yes`) | yes | yes | yes |
|
|
142
|
+
|
|
143
|
+
Set with `--mode`, `/mode` in a session, or `sagixs config set mode auto-edit`. Answer `a` at a prompt to stop asking about that tool for the session. When not run from a terminal (`-p` with piped input), anything that would need approval is **declined** unless you pass `--yes` or `--mode auto-edit`.
|
|
144
|
+
|
|
145
|
+
File tools only touch files inside the folder you launched from (`--cwd` to change it); symlinks that point outside it are refused. **`bash` is not sandboxed** - an approved command can do anything your user can. Use `ask` mode (or a container) with models you don't trust.
|
|
146
|
+
|
|
147
|
+
## In a session
|
|
148
|
+
|
|
149
|
+
`/help` `/model NAME` `/provider NAME [MODEL]` `/mode MODE` `/tools` `/status` `/clear` `/exit`. End a line with `\` to continue it. **Ctrl-C** stops the current turn without quitting; files already changed stay changed. `sagixs -c` continues the last conversation in the current folder.
|
|
150
|
+
|
|
151
|
+
Put standing instructions in `SAGIXS.md` in your project (`AGENTS.md` or `CLAUDE.md` are read too). Machine-wide instructions go in `~/.config/sagixs/SAGIXS.md`.
|
|
152
|
+
|
|
153
|
+
## Configuration
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
sagixs config set provider groq
|
|
157
|
+
sagixs config set model llama-3.3-70b-versatile
|
|
158
|
+
sagixs config set mode auto-edit
|
|
159
|
+
sagixs config show # never prints keys
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Keys: `provider model base_url mode tool_mode max_steps temperature max_tokens timeout system_prompt device dtype n_ctx n_gpu_layers`. Flags override the config file.
|
|
163
|
+
|
|
164
|
+
**API keys** come from, in order: `--api-key`, the provider's environment variable, then `sagixs auth set PROVIDER`, which stores the key in `~/.config/sagixs/credentials.json` with owner-only permissions (plain text on disk - it is not encrypted). Keys are never written to `config.json`.
|
|
165
|
+
|
|
166
|
+
Safeguards against sending a key to the wrong place: a `base_url` saved in config only applies to the `custom` provider, and if you point a preset at a different host with `--base-url`, Sagixs will not send that preset's key there - supply `SAGIXS_API_KEY` or `--api-key` for that endpoint.
|
|
167
|
+
|
|
168
|
+
## Limitations
|
|
169
|
+
|
|
170
|
+
- **Local providers are not yet verified against real weights.** The code paths (loading, streaming, stop handling, errors) are tested with stand-ins, and `transformers`/`llama-cpp-python` APIs change between versions. If something breaks, `sagixs doctor` shows what's installed.
|
|
171
|
+
- **The Cylink base URL (`https://cylinkdev.vercel.app/api/v1`) is an assumption.** If your endpoint differs, use `sagixs config add-provider cylink --base-url ... --tool-mode prompt`. Cylink currently ignores `temperature`, `top_p` and `stop`; Sagixs tolerates that, but the model may write text after a tool call, which Sagixs discards.
|
|
172
|
+
- Local chat templates vary: some reject a `system` role (Sagixs folds it into the first user message) or require strict user/assistant alternation.
|
|
173
|
+
- Context management is simple: when a conversation outgrows the model's budget, old tool output is dropped. There is no summarization yet; use `/clear` if answers degrade. Local models default to a small budget.
|
|
174
|
+
- No web access, MCP, or sub-agents yet. `bash` can fetch URLs if you approve it.
|
|
175
|
+
|
|
176
|
+
## Development
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
git clone https://github.com/suprosmith-coder/sagixs.git && cd sagixs
|
|
180
|
+
python -m pip install -e ".[dev]"
|
|
181
|
+
pytest && ruff check .
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Roadmap
|
|
185
|
+
|
|
186
|
+
- [x] Provider adapters: OpenAI-compatible, Anthropic, local transformers, GGUF
|
|
187
|
+
- [x] Streaming output
|
|
188
|
+
- [x] Tool runtime (files, search, shell) with permission modes
|
|
189
|
+
- [x] Text tool-call protocol for any model
|
|
190
|
+
- [ ] Verify local providers against real models; model capability registry
|
|
191
|
+
- [ ] Context summarization
|
|
192
|
+
- [ ] Web fetch/search tool, MCP client
|
|
193
|
+
- [ ] Native Sagixs model adapter
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.25"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sagixs"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "A Claude Code-style terminal agent that works with any model API or a local Hugging Face model."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [{ name = "CyanixLabs" }]
|
|
13
|
+
keywords = ["ai", "agent", "terminal", "cli", "huggingface", "llm", "coding-agent", "termux"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
25
|
+
"Topic :: Software Development",
|
|
26
|
+
]
|
|
27
|
+
# No runtime dependencies: HTTP uses the standard library, which keeps installs
|
|
28
|
+
# fast and reliable on Termux and other constrained systems.
|
|
29
|
+
dependencies = []
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
# Run Hugging Face models on this machine with transformers + PyTorch.
|
|
33
|
+
local = ["transformers>=4.44", "torch>=2.2", "accelerate>=0.30"]
|
|
34
|
+
# Run GGUF models (llama.cpp) on this machine.
|
|
35
|
+
gguf = ["llama-cpp-python>=0.2.90"]
|
|
36
|
+
dev = ["pytest>=8", "build>=1.2", "ruff>=0.6"]
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
sagixs = "sagixs.cli:main"
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://github.com/suprosmith-coder/sagixs"
|
|
43
|
+
Repository = "https://github.com/suprosmith-coder/sagixs"
|
|
44
|
+
Issues = "https://github.com/suprosmith-coder/sagixs/issues"
|
|
45
|
+
|
|
46
|
+
[tool.hatch.build.targets.wheel]
|
|
47
|
+
packages = ["src/sagixs"]
|
|
48
|
+
|
|
49
|
+
[tool.hatch.build.targets.sdist]
|
|
50
|
+
include = ["src", "tests", "README.md", "LICENSE", "CHANGELOG.md", "CONTRIBUTING.md"]
|
|
51
|
+
|
|
52
|
+
[tool.pytest.ini_options]
|
|
53
|
+
testpaths = ["tests"]
|
|
54
|
+
pythonpath = ["src", "tests"]
|
|
55
|
+
|
|
56
|
+
[tool.ruff]
|
|
57
|
+
line-length = 120
|
|
58
|
+
target-version = "py310"
|
|
59
|
+
|
|
60
|
+
[tool.ruff.lint]
|
|
61
|
+
select = ["E", "F", "W", "I", "B"]
|
|
62
|
+
ignore = ["E501"]
|