python-slack-agents 0.5.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.
- python_slack_agents-0.5.0/.dockerignore +11 -0
- python_slack_agents-0.5.0/.env.example +18 -0
- python_slack_agents-0.5.0/.github/workflows/ci.yml +42 -0
- python_slack_agents-0.5.0/.github/workflows/publish.yml +36 -0
- python_slack_agents-0.5.0/.gitignore +37 -0
- python_slack_agents-0.5.0/.pre-commit-config.yaml +26 -0
- python_slack_agents-0.5.0/AGENTS.md +98 -0
- python_slack_agents-0.5.0/CHANGELOG.md +22 -0
- python_slack_agents-0.5.0/CODE_OF_CONDUCT.md +9 -0
- python_slack_agents-0.5.0/CONTRIBUTING.md +72 -0
- python_slack_agents-0.5.0/LICENSE +202 -0
- python_slack_agents-0.5.0/PKG-INFO +318 -0
- python_slack_agents-0.5.0/README.md +272 -0
- python_slack_agents-0.5.0/SECURITY.md +9 -0
- python_slack_agents-0.5.0/agents/README.md +21 -0
- python_slack_agents-0.5.0/agents/docs-assistant/config.yaml +42 -0
- python_slack_agents-0.5.0/agents/docs-assistant/system_prompt.txt +4 -0
- python_slack_agents-0.5.0/agents/hello-world/config.yaml +26 -0
- python_slack_agents-0.5.0/agents/hello-world/system_prompt.txt +3 -0
- python_slack_agents-0.5.0/agents/kitchen-sink/config.yaml +141 -0
- python_slack_agents-0.5.0/agents/kitchen-sink/system_prompt.txt +1 -0
- python_slack_agents-0.5.0/docs/access-control.md +74 -0
- python_slack_agents-0.5.0/docs/agents.md +82 -0
- python_slack_agents-0.5.0/docs/canvas.md +83 -0
- python_slack_agents-0.5.0/docs/cli.md +83 -0
- python_slack_agents-0.5.0/docs/deployment.md +129 -0
- python_slack_agents-0.5.0/docs/llm.md +72 -0
- python_slack_agents-0.5.0/docs/media/demo.gif +0 -0
- python_slack_agents-0.5.0/docs/observability.md +125 -0
- python_slack_agents-0.5.0/docs/private-repo.md +72 -0
- python_slack_agents-0.5.0/docs/setup.md +72 -0
- python_slack_agents-0.5.0/docs/slack-app-manifest.json +59 -0
- python_slack_agents-0.5.0/docs/storage.md +89 -0
- python_slack_agents-0.5.0/docs/tools.md +141 -0
- python_slack_agents-0.5.0/docs/user-context.md +67 -0
- python_slack_agents-0.5.0/pyproject.toml +73 -0
- python_slack_agents-0.5.0/src/slack_agents/Dockerfile +25 -0
- python_slack_agents-0.5.0/src/slack_agents/__init__.py +25 -0
- python_slack_agents-0.5.0/src/slack_agents/access/__init__.py +0 -0
- python_slack_agents-0.5.0/src/slack_agents/access/allow_all.py +9 -0
- python_slack_agents-0.5.0/src/slack_agents/access/allow_list.py +19 -0
- python_slack_agents-0.5.0/src/slack_agents/access/base.py +20 -0
- python_slack_agents-0.5.0/src/slack_agents/agent_loop.py +208 -0
- python_slack_agents-0.5.0/src/slack_agents/cli/__init__.py +48 -0
- python_slack_agents-0.5.0/src/slack_agents/cli/build_docker.py +94 -0
- python_slack_agents-0.5.0/src/slack_agents/cli/export_conversations.py +84 -0
- python_slack_agents-0.5.0/src/slack_agents/cli/export_conversations_html.py +605 -0
- python_slack_agents-0.5.0/src/slack_agents/cli/export_usage.py +81 -0
- python_slack_agents-0.5.0/src/slack_agents/cli/export_usage_csv.py +151 -0
- python_slack_agents-0.5.0/src/slack_agents/cli/healthcheck.py +67 -0
- python_slack_agents-0.5.0/src/slack_agents/cli/run.py +16 -0
- python_slack_agents-0.5.0/src/slack_agents/config.py +113 -0
- python_slack_agents-0.5.0/src/slack_agents/conversations.py +273 -0
- python_slack_agents-0.5.0/src/slack_agents/files.py +59 -0
- python_slack_agents-0.5.0/src/slack_agents/llm/__init__.py +1 -0
- python_slack_agents-0.5.0/src/slack_agents/llm/anthropic.py +207 -0
- python_slack_agents-0.5.0/src/slack_agents/llm/base.py +82 -0
- python_slack_agents-0.5.0/src/slack_agents/llm/openai.py +283 -0
- python_slack_agents-0.5.0/src/slack_agents/main.py +55 -0
- python_slack_agents-0.5.0/src/slack_agents/observability.py +175 -0
- python_slack_agents-0.5.0/src/slack_agents/py.typed +0 -0
- python_slack_agents-0.5.0/src/slack_agents/scripts/__init__.py +0 -0
- python_slack_agents-0.5.0/src/slack_agents/scripts/download_fonts.py +39 -0
- python_slack_agents-0.5.0/src/slack_agents/slack/__init__.py +0 -0
- python_slack_agents-0.5.0/src/slack_agents/slack/actions.py +119 -0
- python_slack_agents-0.5.0/src/slack_agents/slack/agent.py +688 -0
- python_slack_agents-0.5.0/src/slack_agents/slack/canvases.py +225 -0
- python_slack_agents-0.5.0/src/slack_agents/slack/files.py +102 -0
- python_slack_agents-0.5.0/src/slack_agents/slack/format.py +55 -0
- python_slack_agents-0.5.0/src/slack_agents/slack/streaming.py +70 -0
- python_slack_agents-0.5.0/src/slack_agents/slack/streaming_formatter.py +182 -0
- python_slack_agents-0.5.0/src/slack_agents/slack/tool_blocks.py +97 -0
- python_slack_agents-0.5.0/src/slack_agents/storage/__init__.py +0 -0
- python_slack_agents-0.5.0/src/slack_agents/storage/base.py +304 -0
- python_slack_agents-0.5.0/src/slack_agents/storage/postgres.py +612 -0
- python_slack_agents-0.5.0/src/slack_agents/storage/postgres.sql +120 -0
- python_slack_agents-0.5.0/src/slack_agents/storage/sqlite.py +473 -0
- python_slack_agents-0.5.0/src/slack_agents/storage/sqlite.sql +73 -0
- python_slack_agents-0.5.0/src/slack_agents/tools/__init__.py +0 -0
- python_slack_agents-0.5.0/src/slack_agents/tools/base.py +140 -0
- python_slack_agents-0.5.0/src/slack_agents/tools/canvas.py +401 -0
- python_slack_agents-0.5.0/src/slack_agents/tools/file_exporter.py +582 -0
- python_slack_agents-0.5.0/src/slack_agents/tools/file_importer.py +363 -0
- python_slack_agents-0.5.0/src/slack_agents/tools/mcp_http.py +203 -0
- python_slack_agents-0.5.0/src/slack_agents/tools/user_context.py +239 -0
- python_slack_agents-0.5.0/tests/__init__.py +0 -0
- python_slack_agents-0.5.0/tests/test_access.py +173 -0
- python_slack_agents-0.5.0/tests/test_agent_loop.py +148 -0
- python_slack_agents-0.5.0/tests/test_cli.py +263 -0
- python_slack_agents-0.5.0/tests/test_config.py +278 -0
- python_slack_agents-0.5.0/tests/test_conversations.py +383 -0
- python_slack_agents-0.5.0/tests/test_cost.py +98 -0
- python_slack_agents-0.5.0/tests/test_export_documents.py +420 -0
- python_slack_agents-0.5.0/tests/test_export_usage.py +234 -0
- python_slack_agents-0.5.0/tests/test_file_extractors.py +560 -0
- python_slack_agents-0.5.0/tests/test_format.py +70 -0
- python_slack_agents-0.5.0/tests/test_llm_factory.py +46 -0
- python_slack_agents-0.5.0/tests/test_mcp_client.py +117 -0
- python_slack_agents-0.5.0/tests/test_openai_convert.py +133 -0
- python_slack_agents-0.5.0/tests/test_tool_blocks.py +125 -0
- python_slack_agents-0.5.0/uv.lock +2124 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Slack tokens (one set per agent, referenced via {ENV_VAR} in config.yaml)
|
|
2
|
+
SLACK_BOT_TOKEN=xoxb-...
|
|
3
|
+
SLACK_APP_TOKEN=xapp-...
|
|
4
|
+
|
|
5
|
+
# LLM API keys
|
|
6
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
7
|
+
OPENAI_API_KEY=sk-...
|
|
8
|
+
|
|
9
|
+
# PostgreSQL (optional — only needed if using slack_agents.storage.postgres)
|
|
10
|
+
POSTGRES_PASSWORD=your-password-here
|
|
11
|
+
DATABASE_URL=postgresql://slack_agents:${POSTGRES_PASSWORD}@localhost:5432/slack_agents
|
|
12
|
+
|
|
13
|
+
# Observability (optional — configured per-agent in config.yaml)
|
|
14
|
+
LANGFUSE_PUBLIC_KEY=
|
|
15
|
+
LANGFUSE_SECRET_KEY=
|
|
16
|
+
LANGFUSE_HOST=https://cloud.langfuse.com
|
|
17
|
+
|
|
18
|
+
LOG_LEVEL=DEBUG
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-python@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.12"
|
|
16
|
+
- run: pip install ruff
|
|
17
|
+
- run: ruff check src/ tests/
|
|
18
|
+
- run: ruff format --check src/ tests/
|
|
19
|
+
|
|
20
|
+
test:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
strategy:
|
|
23
|
+
matrix:
|
|
24
|
+
python-version: ["3.12", "3.13"]
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: ${{ matrix.python-version }}
|
|
30
|
+
- run: pip install -e ".[dev]"
|
|
31
|
+
- run: pytest
|
|
32
|
+
|
|
33
|
+
build:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
- uses: actions/setup-python@v5
|
|
38
|
+
with:
|
|
39
|
+
python-version: "3.12"
|
|
40
|
+
- run: pip install build twine
|
|
41
|
+
- run: python -m build
|
|
42
|
+
- run: twine check dist/*
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
- run: pip install build
|
|
19
|
+
- run: python -m build
|
|
20
|
+
- uses: actions/upload-artifact@v4
|
|
21
|
+
with:
|
|
22
|
+
name: dist
|
|
23
|
+
path: dist/
|
|
24
|
+
|
|
25
|
+
publish:
|
|
26
|
+
needs: build
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
environment: pypi
|
|
29
|
+
permissions:
|
|
30
|
+
id-token: write
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/download-artifact@v4
|
|
33
|
+
with:
|
|
34
|
+
name: dist
|
|
35
|
+
path: dist/
|
|
36
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Worktrees
|
|
2
|
+
.worktrees/
|
|
3
|
+
|
|
4
|
+
# Python
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
*$py.class
|
|
8
|
+
*.so
|
|
9
|
+
*.egg-info/
|
|
10
|
+
dist/
|
|
11
|
+
build/
|
|
12
|
+
*.egg
|
|
13
|
+
.eggs/
|
|
14
|
+
.venv/
|
|
15
|
+
venv/
|
|
16
|
+
|
|
17
|
+
# Fonts (downloaded, not committed)
|
|
18
|
+
fonts/
|
|
19
|
+
|
|
20
|
+
# Environment
|
|
21
|
+
.env
|
|
22
|
+
|
|
23
|
+
# IDE
|
|
24
|
+
.idea/
|
|
25
|
+
.vscode/
|
|
26
|
+
*.swp
|
|
27
|
+
*.swo
|
|
28
|
+
|
|
29
|
+
# OS
|
|
30
|
+
.DS_Store
|
|
31
|
+
Thumbs.db
|
|
32
|
+
|
|
33
|
+
agents-local/
|
|
34
|
+
|
|
35
|
+
# Certificates
|
|
36
|
+
*.pem
|
|
37
|
+
/ONGOING.md
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
rev: v0.9.7
|
|
4
|
+
hooks:
|
|
5
|
+
- id: ruff
|
|
6
|
+
args: [--fix]
|
|
7
|
+
- id: ruff-format
|
|
8
|
+
|
|
9
|
+
- repo: local
|
|
10
|
+
hooks:
|
|
11
|
+
- id: pytest
|
|
12
|
+
name: pytest
|
|
13
|
+
entry: pytest
|
|
14
|
+
language: system
|
|
15
|
+
pass_filenames: false
|
|
16
|
+
always_run: true
|
|
17
|
+
stages: [pre-commit]
|
|
18
|
+
|
|
19
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
20
|
+
rev: v5.0.0
|
|
21
|
+
hooks:
|
|
22
|
+
- id: trailing-whitespace
|
|
23
|
+
- id: end-of-file-fixer
|
|
24
|
+
- id: check-yaml
|
|
25
|
+
- id: check-added-large-files
|
|
26
|
+
- id: check-merge-conflict
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Instructions for AI coding assistants working on this codebase.
|
|
4
|
+
|
|
5
|
+
## What This Is
|
|
6
|
+
|
|
7
|
+
A Python framework for deploying AI agents as Slack bots. One Docker image per agent — each agent has its own Slack app identity, system prompt, LLM provider, and tool servers. No LangChain/LlamaIndex; the agent loop is a custom ~200-line async generator.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Create and activate venv (one-time setup)
|
|
13
|
+
python3 -m venv .venv
|
|
14
|
+
source .venv/bin/activate
|
|
15
|
+
|
|
16
|
+
# Install for development
|
|
17
|
+
pip install -e ".[dev]"
|
|
18
|
+
|
|
19
|
+
# Run an agent locally
|
|
20
|
+
slack-agents run agents/<agent-dir>
|
|
21
|
+
|
|
22
|
+
# Check agent health (requires persistent storage)
|
|
23
|
+
slack-agents healthcheck agents/<agent-dir>
|
|
24
|
+
|
|
25
|
+
# Export conversations to HTML
|
|
26
|
+
slack-agents export-conversations agents/<agent-dir> --format=html
|
|
27
|
+
|
|
28
|
+
# Build Docker image for an agent
|
|
29
|
+
slack-agents build-docker agents/<agent-dir>
|
|
30
|
+
|
|
31
|
+
# Build and push to a registry
|
|
32
|
+
slack-agents build-docker agents/<agent-dir> --push registry.example.com
|
|
33
|
+
|
|
34
|
+
# Tests (asyncio_mode=auto, no flags needed)
|
|
35
|
+
pytest
|
|
36
|
+
pytest tests/test_format.py # single file
|
|
37
|
+
pytest tests/test_format.py::test_name # single test
|
|
38
|
+
|
|
39
|
+
# Lint and format
|
|
40
|
+
ruff check --fix src/ tests/
|
|
41
|
+
ruff format src/ tests/
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
All commands assume the `.venv` virtualenv is active.
|
|
45
|
+
|
|
46
|
+
Pre-commit hooks run ruff check+format automatically on commit.
|
|
47
|
+
|
|
48
|
+
## Architecture
|
|
49
|
+
|
|
50
|
+
**Plugin system:** All pluggable concerns (LLM, storage, tools) follow the same pattern: a `type` field with a dotted import path, and a `Provider` class in that module. `load_plugin(type_path, **kwargs)` loads any plugin.
|
|
51
|
+
|
|
52
|
+
**Startup:** `main.py` -> `load_agent_config()` returns `(config, system_prompt, agent_name)` -> `SlackAgent()` -> connects storage/tools/Slack Socket Mode.
|
|
53
|
+
|
|
54
|
+
**Per-message flow:** Slack event -> `agent.py._handle_message()` -> load conversation history via `ConversationManager` -> extract file attachments -> `run_agent_loop_streaming()` async generator -> `StreamingFormatter` routes text to `SlackStreamer` and tables to native `TableBlock` messages -> tool calls shown as Slack attachments -> usage footer posted -> response persisted.
|
|
55
|
+
|
|
56
|
+
**Key modules:**
|
|
57
|
+
- `agent_loop.py` -- Core LLM->tools->LLM loop (max 15 iterations, parallel tool execution via `asyncio.gather`), defines `ToolProvider` protocol
|
|
58
|
+
- `llm/base.py` -- `BaseLLMProvider` ABC, `StreamEvent` dataclass, internal Anthropic-style message format
|
|
59
|
+
- `llm/anthropic.py`, `llm/openai.py` -- Provider implementations (OpenAI provider converts at its boundary)
|
|
60
|
+
- `tools/base.py` -- `BaseToolProvider` and `BaseFileImporterProvider` ABCs with `allowed_functions` regex filtering
|
|
61
|
+
- `tools/mcp_http.py` -- MCP over HTTP/SSE tool provider
|
|
62
|
+
- `tools/file_exporter.py` -- Built-in document generation tool (PDF, DOCX, XLSX, CSV, PPTX)
|
|
63
|
+
- `tools/file_importer.py` -- Built-in file import provider (PDF, DOCX, XLSX, PPTX, text, images)
|
|
64
|
+
- `storage/base.py` -- `BaseStorageProvider` ABC (generic persistence layer)
|
|
65
|
+
- `storage/sqlite.py` -- SQLite storage provider (in-memory or file-based, via aiosqlite)
|
|
66
|
+
- `storage/postgres.py` -- PostgreSQL storage provider (asyncpg)
|
|
67
|
+
- `slack/agent.py` -- `SlackAgent` with Bolt AsyncApp, event routing, cost tracking
|
|
68
|
+
- `slack/conversations.py` -- `ConversationManager` wrapping storage with conversation logic
|
|
69
|
+
- `slack/streaming.py` + `streaming_formatter.py` -- Streaming output with table detection
|
|
70
|
+
|
|
71
|
+
**Internal message format is Anthropic-style throughout** (content as list of typed blocks: `text`, `tool_use`, `tool_result`). The OpenAI provider converts at its boundary via `_convert_messages()` and `_convert_tools()`.
|
|
72
|
+
|
|
73
|
+
## Agent Configuration
|
|
74
|
+
|
|
75
|
+
Each agent lives in `agents/<name>/` with `config.yaml` and `system_prompt.txt`. The agent name is derived from the directory name. Config supports `{ENV_VAR}` interpolation (uppercase + underscore patterns only).
|
|
76
|
+
|
|
77
|
+
**Top-level config fields:**
|
|
78
|
+
- `version` (required) -- user-controlled string shown in the usage footer **and used as the Docker image tag** when building with `slack-agents build-docker`. Track changes to the agent's prompts, tools, or behavior. The framework does not interpret this — it can be semver, a date, or any string.
|
|
79
|
+
- `schema` (required) -- config format identifier, currently `"slack-agents/v1"`. The framework checks this to ensure it can parse the config. Newer schemas fail with a clear upgrade message.
|
|
80
|
+
|
|
81
|
+
## Key Design Decisions
|
|
82
|
+
|
|
83
|
+
- **Async everywhere** -- all I/O (Slack, LLM, tools, storage) is async
|
|
84
|
+
- **Streaming as async generator** -- `run_agent_loop_streaming()` yields `StreamEvent` (text) and `dict` (tool status)
|
|
85
|
+
- **Unified tool interface** -- `BaseToolProvider` ABC (`.tools` + `.call_tool()`) for LLM-facing tools; `BaseFileImporterProvider` ABC (`.handlers`) for file import — both configured in `tools:` section, separated by isinstance in `_init_tools()`
|
|
86
|
+
- **Explicit configuration over silent defaults** -- do not auto-load providers when none are configured; if no `BaseFileImporterProvider` is in the config, file attachments are rejected with a clear error
|
|
87
|
+
- **Generic storage** -- `BaseStorageProvider` knows nothing about conversations; `ConversationManager` adds conversation logic on top
|
|
88
|
+
- **Lazy initialization** -- SlackStreamer creates stream on first delta; tools connect only when initialized
|
|
89
|
+
- **Caching-aware cost tracking** -- each LLM provider has `estimate_cost()` with provider-specific cache multipliers
|
|
90
|
+
- **Tool definitions in Anthropic format** -- `{"name", "description", "input_schema"}` is the canonical format everywhere
|
|
91
|
+
- **1 replica per agent** -- Socket Mode requires exactly one WebSocket connection per app
|
|
92
|
+
|
|
93
|
+
## Style
|
|
94
|
+
|
|
95
|
+
- Python 3.12+, line length 100
|
|
96
|
+
- Ruff rules: E, F, I (errors, pyflakes, isort)
|
|
97
|
+
- Keep it simple. Minimal abstractions, no unnecessary indirection.
|
|
98
|
+
- Commit messages: Conventional Commits — `feat:`, `fix:`, `docs:`, `chore:`, `test:`, `refactor:`. Lowercase, imperative, under 72 chars.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.5.0] - 2025-03-13
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Plugin architecture for LLM providers, storage backends, and tools
|
|
14
|
+
- Anthropic and OpenAI LLM providers
|
|
15
|
+
- SQLite and PostgreSQL storage providers
|
|
16
|
+
- MCP over HTTP tool provider
|
|
17
|
+
- Built-in document export tools (PDF, DOCX, XLSX, CSV, PPTX)
|
|
18
|
+
- Streaming output with native Slack table rendering
|
|
19
|
+
- Socket Mode support (no public URL required)
|
|
20
|
+
- OpenTelemetry observability
|
|
21
|
+
- `{ENV_VAR}` interpolation in agent configs
|
|
22
|
+
- Per-agent Docker builds via `docker-build-and-push.sh`
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
This project follows the [Contributor Covenant v2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
|
|
4
|
+
|
|
5
|
+
In short: be respectful, be constructive, be inclusive. Harassment and exclusionary behavior are not tolerated.
|
|
6
|
+
|
|
7
|
+
## Reporting
|
|
8
|
+
|
|
9
|
+
Report unacceptable behavior to the project maintainers via GitHub. All reports will be reviewed and handled confidentially.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Contributions are welcome — bug fixes, features, docs, examples.
|
|
4
|
+
|
|
5
|
+
## Before You Start
|
|
6
|
+
|
|
7
|
+
- **Bug fixes and small improvements** — go ahead and open a PR.
|
|
8
|
+
- **Large features or architectural changes** — open an issue first to discuss the approach.
|
|
9
|
+
|
|
10
|
+
## Setup
|
|
11
|
+
|
|
12
|
+
Requires Python >= 3.12.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
git clone https://github.com/CompareNetworks/python-slack-agents.git
|
|
16
|
+
cd python-slack-agents
|
|
17
|
+
python3 -m venv .venv
|
|
18
|
+
source .venv/bin/activate
|
|
19
|
+
pip install -e ".[dev]"
|
|
20
|
+
pre-commit install
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Development
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Run tests
|
|
27
|
+
pytest
|
|
28
|
+
|
|
29
|
+
# Lint and format (also runs automatically on commit via pre-commit hooks)
|
|
30
|
+
ruff check --fix src/ tests/
|
|
31
|
+
ruff format src/ tests/
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Commit Messages
|
|
35
|
+
|
|
36
|
+
We use [Conventional Commits](https://www.conventionalcommits.org/) — lowercase, imperative, short:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
feat: add canvas tool provider
|
|
40
|
+
fix: streaming drops last chunk on disconnect
|
|
41
|
+
docs: clarify MCP server configuration
|
|
42
|
+
chore: bump dependencies
|
|
43
|
+
test: cover PostgreSQL export edge cases
|
|
44
|
+
refactor: simplify streaming formatter table detection
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Prefixes: `feat:`, `fix:`, `docs:`, `chore:`, `test:`, `refactor:`. First line under 72 characters. Add a body after a blank line if context is needed.
|
|
48
|
+
|
|
49
|
+
## Pull Requests
|
|
50
|
+
|
|
51
|
+
1. Fork the repo and create a branch
|
|
52
|
+
2. Make your changes
|
|
53
|
+
3. Ensure tests pass and linting is clean
|
|
54
|
+
4. Open a PR with a clear description of what and why
|
|
55
|
+
|
|
56
|
+
Keep PRs focused — one concern per PR. Small PRs get reviewed faster.
|
|
57
|
+
|
|
58
|
+
## Style
|
|
59
|
+
|
|
60
|
+
- Python 3.12+, line length 100
|
|
61
|
+
- Ruff rules: E, F, I
|
|
62
|
+
- Keep it simple — minimal abstractions, no over-engineering
|
|
63
|
+
- Type hints on function signatures
|
|
64
|
+
- Tests for new functionality
|
|
65
|
+
|
|
66
|
+
## Adding a Plugin
|
|
67
|
+
|
|
68
|
+
LLM providers, storage backends, and tools all follow the same pattern: a module with a `Provider` class. See the [docs/](docs/) directory for guides on creating each type.
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
By contributing, you agree that your contributions will be licensed under the Apache 2.0 License.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|