agent-mini 0.1.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.
Files changed (43) hide show
  1. agent_mini-0.1.0/.github/workflows/ci.yml +32 -0
  2. agent_mini-0.1.0/.github/workflows/publish.yml +28 -0
  3. agent_mini-0.1.0/.gitignore +36 -0
  4. agent_mini-0.1.0/CONTRIBUTING.md +105 -0
  5. agent_mini-0.1.0/LICENSE +21 -0
  6. agent_mini-0.1.0/PKG-INFO +530 -0
  7. agent_mini-0.1.0/README.md +495 -0
  8. agent_mini-0.1.0/config.example.json +44 -0
  9. agent_mini-0.1.0/docs/01-openclaw-inspired-improvements.md +1282 -0
  10. agent_mini-0.1.0/docs/02-small-llm-optimization-guide.md +1299 -0
  11. agent_mini-0.1.0/pyproject.toml +65 -0
  12. agent_mini-0.1.0/src/agent_mini/__init__.py +3 -0
  13. agent_mini-0.1.0/src/agent_mini/__main__.py +6 -0
  14. agent_mini-0.1.0/src/agent_mini/agent/__init__.py +7 -0
  15. agent_mini-0.1.0/src/agent_mini/agent/context.py +48 -0
  16. agent_mini-0.1.0/src/agent_mini/agent/loop.py +372 -0
  17. agent_mini-0.1.0/src/agent_mini/agent/memory.py +152 -0
  18. agent_mini-0.1.0/src/agent_mini/agent/token_estimator.py +105 -0
  19. agent_mini-0.1.0/src/agent_mini/agent/tools.py +582 -0
  20. agent_mini-0.1.0/src/agent_mini/agent/vision.py +80 -0
  21. agent_mini-0.1.0/src/agent_mini/bus.py +45 -0
  22. agent_mini-0.1.0/src/agent_mini/channels/__init__.py +11 -0
  23. agent_mini-0.1.0/src/agent_mini/channels/base.py +36 -0
  24. agent_mini-0.1.0/src/agent_mini/channels/telegram.py +164 -0
  25. agent_mini-0.1.0/src/agent_mini/cli.py +621 -0
  26. agent_mini-0.1.0/src/agent_mini/config.py +161 -0
  27. agent_mini-0.1.0/src/agent_mini/providers/__init__.py +57 -0
  28. agent_mini-0.1.0/src/agent_mini/providers/base.py +147 -0
  29. agent_mini-0.1.0/src/agent_mini/providers/gemini.py +257 -0
  30. agent_mini-0.1.0/src/agent_mini/providers/github_copilot.py +253 -0
  31. agent_mini-0.1.0/src/agent_mini/providers/local.py +158 -0
  32. agent_mini-0.1.0/src/agent_mini/providers/ollama.py +171 -0
  33. agent_mini-0.1.0/src/agent_mini/sessions.py +95 -0
  34. agent_mini-0.1.0/tests/__init__.py +0 -0
  35. agent_mini-0.1.0/tests/test_config.py +28 -0
  36. agent_mini-0.1.0/tests/test_context.py +66 -0
  37. agent_mini-0.1.0/tests/test_json_repair.py +39 -0
  38. agent_mini-0.1.0/tests/test_loop.py +303 -0
  39. agent_mini-0.1.0/tests/test_memory.py +76 -0
  40. agent_mini-0.1.0/tests/test_phases.py +228 -0
  41. agent_mini-0.1.0/tests/test_token_estimator.py +107 -0
  42. agent_mini-0.1.0/tests/test_tools.py +240 -0
  43. agent_mini-0.1.0/uv.lock +278 -0
@@ -0,0 +1,32 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v4
21
+
22
+ - name: Set up Python ${{ matrix.python-version }}
23
+ run: uv python install ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: uv sync --extra dev
27
+
28
+ - name: Lint with ruff
29
+ run: uv run ruff check src/ tests/
30
+
31
+ - name: Run tests
32
+ run: uv run pytest tests/ -v
@@ -0,0 +1,28 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ id-token: write
9
+
10
+ jobs:
11
+ publish:
12
+ runs-on: ubuntu-latest
13
+ environment: pypi
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v4
20
+
21
+ - name: Set up Python
22
+ run: uv python install 3.12
23
+
24
+ - name: Build package
25
+ run: uv build
26
+
27
+ - name: Publish to PyPI
28
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,36 @@
1
+ # Byte-compiled / optimized
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+
7
+ # Distribution
8
+ dist/
9
+ build/
10
+ *.egg-info/
11
+ *.egg
12
+
13
+ # Virtual environments
14
+ .venv/
15
+ venv/
16
+ env/
17
+
18
+ # IDE
19
+ .idea/
20
+ .vscode/
21
+ *.swp
22
+ *.swo
23
+ *~
24
+
25
+ # OS
26
+ .DS_Store
27
+ Thumbs.db
28
+
29
+ # Project specific
30
+ node_modules/
31
+
32
+ # Config (contains secrets)
33
+ # ~/.agent-mini/ is outside the repo, but just in case:
34
+ config.json
35
+ .pytest_cache/
36
+ .ruff_cache/
@@ -0,0 +1,105 @@
1
+ # Contributing to Agent Mini
2
+
3
+ Thanks for your interest in contributing! Agent Mini is intentionally lean — every line of code must earn its place.
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ # Clone
9
+ git clone https://github.com/mohsinkaleem/agent-mini.git
10
+ cd agent-mini
11
+
12
+ # Install with dev dependencies (uses uv)
13
+ uv sync --extra dev
14
+
15
+ # Run tests
16
+ uv run pytest tests/ -v
17
+
18
+ # Lint
19
+ uv run ruff check src/ tests/
20
+ ```
21
+
22
+ ## Project Principles
23
+
24
+ - **Stay lean.** The core is ~3,500 LOC. Don't add frameworks, heavy abstractions, or dependencies unless absolutely necessary.
25
+ - **Zero-framework.** Pure `httpx` + `asyncio`. No LangChain, no LiteLLM, no abstractions-on-abstractions.
26
+ - **One file, one job.** Each module has a clear, single responsibility.
27
+ - **Tests are required.** Every new feature or bug fix needs a test in `tests/`.
28
+
29
+ ## How to Contribute
30
+
31
+ ### Bug Reports
32
+
33
+ Open an issue with:
34
+ 1. What you expected
35
+ 2. What happened
36
+ 3. Steps to reproduce
37
+ 4. Your provider/model (e.g., Ollama + qwen2.5:7b)
38
+
39
+ ### Pull Requests
40
+
41
+ 1. Fork the repo and create a branch from `main`.
42
+ 2. Make your changes — keep the diff small and focused.
43
+ 3. Add or update tests in `tests/`.
44
+ 4. Run the test suite: `uv run pytest tests/ -v`
45
+ 5. Run the linter: `uv run ruff check src/ tests/`
46
+ 6. Open a PR with a clear description of *what* and *why*.
47
+
48
+ ### What We Welcome
49
+
50
+ - Bug fixes
51
+ - New LLM provider integrations (following `providers/base.py` interface)
52
+ - New built-in tools (keep them small and self-contained)
53
+ - Plugin examples
54
+ - Documentation improvements
55
+ - Performance improvements (with benchmarks)
56
+
57
+ ### What We Avoid
58
+
59
+ - Adding large dependencies (if it can be done with stdlib, do it with stdlib)
60
+ - Framework integrations (LangChain, LlamaIndex, etc.)
61
+ - Features that increase complexity without clear user value
62
+ - Refactors that change everything but fix nothing
63
+
64
+ ## Code Style
65
+
66
+ - Python 3.11+, type hints where they help readability.
67
+ - Ruff for linting (`ruff check`).
68
+ - No docstrings required for obvious methods — code should be self-explanatory.
69
+ - Prefer `match/case` for dispatch over `if/elif` chains.
70
+
71
+ ## Project Structure
72
+
73
+ ```
74
+ src/agent_mini/
75
+ ├── cli.py # CLI entry point (Click)
76
+ ├── config.py # Typed config loading
77
+ ├── bus.py # Multi-channel message routing
78
+ ├── sessions.py # Session persistence
79
+ ├── agent/
80
+ │ ├── loop.py # Core ReAct agent loop
81
+ │ ├── context.py # System prompt builder
82
+ │ ├── memory.py # Persistent JSON memory + TF-IDF search
83
+ │ ├── tools.py # Built-in tools + plugin loader
84
+ │ ├── token_estimator.py # Token counting + model tier classification
85
+ │ └── vision.py # Image detection + encoding
86
+ ├── providers/
87
+ │ ├── base.py # Provider interface + tool call parsing
88
+ │ ├── ollama.py # Ollama provider
89
+ │ ├── gemini.py # Google Gemini provider
90
+ │ ├── github_copilot.py # GitHub Copilot (OAuth device flow)
91
+ │ └── local.py # Any OpenAI-compatible endpoint
92
+ └── channels/
93
+ ├── base.py # Channel interface
94
+ └── telegram.py # Telegram bot channel
95
+ ```
96
+
97
+ ## Releasing
98
+
99
+ Releases are automated via GitHub Actions:
100
+
101
+ 1. Update `version` in both `pyproject.toml` and `src/agent_mini/__init__.py`.
102
+ 2. Commit: `git commit -am "release: v0.2.0"`
103
+ 3. Tag: `git tag v0.2.0`
104
+ 4. Push: `git push && git push --tags`
105
+ 5. Create a GitHub Release from the tag — PyPI publish runs automatically.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mohsin Kaleem
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. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.