Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
320fe40
feat: WhatsApp integration with MCP resilience and SQLite deduplication
jeancsil Mar 1, 2026
6e51117
Apply code review suggestions for WhatsApp bridge
jeancsil Mar 1, 2026
3831601
fix: bring back tree-sitter
jeancsil Mar 1, 2026
c9a1171
fix: apply code review improvements to WhatsApp integration
jeancsil Mar 1, 2026
e354f4a
fix: CI Workflow (ci.yml): Changed Python version from 3.13 to 3.12
jeancsil Mar 1, 2026
7671c07
fix: rollback to previous python verision
jeancsil Mar 1, 2026
6cd0fe5
fix: pass test ci var
jeancsil Mar 1, 2026
be87ef3
fix: upgrade openai langchain
jeancsil Mar 1, 2026
ce0d7e8
fix: make check failures
jeancsil Mar 1, 2026
9c429a0
fix: test_developer_agent and test_core_agents
jeancsil Mar 1, 2026
e259c75
fix: mypy errors
jeancsil Mar 1, 2026
677cbd4
fix: improve WhatsApp contact filtering and add comprehensive tests
jeancsil Mar 1, 2026
5bcb139
fix: typing signal
jeancsil Mar 1, 2026
beda129
fix: secure WhatsApp contact filtering and add schema migration
jeancsil Mar 1, 2026
3f3e08a
test: add validation for self-message with phone number in RecipientAlt
jeancsil Mar 1, 2026
058c34e
chore: fix Issue: Inconsistent pydantic import styles across the co…
jeancsil Mar 1, 2026
5075587
fix: handle MCP tool exceptions gracefully and improve Docker setup
jeancsil Mar 2, 2026
9d3f04b
fix: Implemented and validated all three review findings, plus regres…
Mar 2, 2026
4e4a859
Update .gitignore
jeancsil Mar 2, 2026
ee09d91
Update README.md
jeancsil Mar 2, 2026
975ba1f
refactor: rename whatsapp-bridge command to whatsapp
jeancsil Mar 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
matrix:
python-version: ['3.12']
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
env:
OPENAI_API_KEY: sk-test
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -54,7 +60,6 @@ jobs:

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.python-version == '3.12'
with:
file: ./agentic-framework/coverage.xml
fail_ci_if_error: false
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ htmlcov/
# Logging
agentic-framework/logs/
!agentic-framework/logs/.gitkeep

# Configuration files
**/whatsapp.yaml
agentic-framework/config/*.yaml

# WhatsApp runtime data (sessions, databases, media)
agentic-framework/storage/whatsapp/
!agentic-framework/storage/whatsapp/.gitkeep
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@ WORKDIR /app
# Copy from the official installer: https://github.com/astral-sh/uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Install Search Tools
# Install Search Tools and Network Diagnostics
# ripgrep: ultra-fast text searching
# fd-find: user-friendly alternative to 'find'
# fzf: general-purpose command-line fuzzy finder
# libmagic: Required by neonize/python-magic for file type detection
# curl: For testing HTTP/HTTPS connections
# dnsutils: For DNS resolution troubleshooting
RUN apt-get update && apt-get install -y --no-install-recommends \
ripgrep \
fd-find \
fzf \
libmagic1 \
curl \
dnsutils \
&& rm -rf /var/lib/apt/lists/*

# Note: In Debian/Ubuntu, the 'fd' executable is renamed to 'fdfind'.
Expand All @@ -33,6 +39,7 @@ ENV PYTHONUNBUFFERED=1 \
COPY agentic-framework/pyproject.toml agentic-framework/uv.lock ./agentic-framework/
COPY agentic-framework/README.md ./agentic-framework/
COPY agentic-framework/src ./agentic-framework/src
COPY agentic-framework/config ./agentic-framework/config

# Install dependencies using uv
# This installs the package in editable mode with all dependencies
Expand Down
77 changes: 75 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# 🤖 Agentic Framework
**Build AI agents that *actually* do things.**

[![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue?style=plastic&logo=python&logoColor=white)](https://python.org)
[![Python 3.13+](https://img.shields.io/badge/python-3.13%2B-blue?style=plastic&logo=python&logoColor=white)](https://python.org)
[![LangChain](https://img.shields.io/badge/langchain-%23007BA7.svg?style=plastic&logo=langchain&logoColor=white)](https://python.langchain.com/)
[![MCP](https://img.shields.io/badge/MCP-Model%20Context%20Protocol-green?style=plastic&logo=modelcontextprotocol&logoColor=white)](https://modelcontextprotocol.io/)
[![Docker Ready](https://img.shields.io/badge/docker-ready-blue?style=plastic&logo=docker&logoColor=white)](https://www.docker.com/)
Expand Down Expand Up @@ -124,9 +124,76 @@ Instead of spending days wiring together LLMs, tools, and execution environments
</details>
</td>
</tr>
<tr>
<td><code>whatsapp</code></td>
<td><b>WhatsApp Agent:</b> Bidirectional WhatsApp communication (personal account).</td>
<td><code>webfetch</code><br><code>duckduckgo-search</code></td>
<td>-</td>
</tr>
</tbody>
</table>

<details>
<summary><strong>📱 WhatsApp Agent Setup</strong></summary>

The WhatsApp agent enables bidirectional communication through your personal WhatsApp account using QR code authentication.

**Requirements:**
- Go 1.21+ and Git (for WhatsApp backend)
- Python 3.13+
- A configured LLM provider (see environment variables below)

**Configuration:**
```bash
# 1. Copy example config
cp agentic-framework/config/whatsapp.yaml.example agentic-framework/config/whatsapp.yaml

# 2. Edit config/whatsapp.yaml with your settings:
# - model: "claude-sonnet-4-6" # Your LLM model
# - privacy.allowed_contact: "+34 666 666 666" # Your phone number (only this number can interact)
# - channel.storage_path: "~/storage/whatsapp" # Where to store session data
# - mcp_servers: ["web-fetch", "duckduckgo-search"] # Optional: MCP servers to use
```

**Usage:**
```bash
# Start the WhatsApp agent
bin/agent.sh whatsapp --config config/whatsapp.yaml

# With custom settings (overrides config file)
bin/agent.sh whatsapp --allowed-contact "+1234567890" --storage ~/custom/path

# Customize MCP servers
bin/agent.sh whatsapp --mcp-servers "web-fetch,duckduckgo-search"
bin/agent.sh whatsapp --mcp-servers none # Disable MCP

# Verbose mode for debugging
bin/agent.sh whatsapp --verbose
```

**First Run:**
1. Scan the QR code displayed in your terminal
2. Wait for WhatsApp to authenticate
3. Send a message from your configured phone number
4. Agent will respond automatically

**Privacy & Security:**
- 🔒 Only processes messages from the configured contact
- 🔒 Group chat messages are automatically filtered (not sent to LLM)
- 🔒 All data stored locally (no cloud storage of conversations)
- 🔒 Messages from other contacts are silently ignored
- 🔒 Message deduplication prevents reprocessing

**Configuration Options:**
- `model`: LLM model to use (defaults to provider default)
- `mcp_servers`: MCP servers for web search and content fetching
- `privacy.allowed_contact`: Only this phone number can interact with the agent
- `privacy.log_filtered_messages`: Log filtered messages for debugging
- `channel.storage_path`: Directory for WhatsApp session and database files
- `features.group_messages`: Currently disabled by default for privacy

</details>

### 📦 Local Tools (Zero External Dependencies)

<table>
Expand Down Expand Up @@ -565,6 +632,12 @@ bin/agent.sh developer -i "Hello" -v

# 📜 Access logs (same location as local)
tail -f agentic-framework/logs/agent.log

# 📱 Run the WhatsApp agent (requires config)
agentic-run whatsapp --config config/whatsapp.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this supposed to be ./bin/agent.sh
I can't make it to work, it keeps saying it can not find config/whatsapp.yaml
I even tried to provide the absolute path

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I run it via docker, how do you run it so I can try the same @rafaelzimmermann ?


# 📱 Run WhatsApp with custom settings
agentic-run whatsapp --allowed-contact "+1234567890" --storage ~/custom/path
```

---
Expand All @@ -578,7 +651,7 @@ Prefer running without Docker? We got you.
<summary><strong>System Requirements & Setup</strong></summary>

**Requirements:**
- Python 3.12+
- Python 3.13+
- `ripgrep`, `fd`, `fzf`

```bash
Expand Down
42 changes: 42 additions & 0 deletions agentic-framework/config/whatsapp.yaml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# WhatsApp Agent Configuration

# Agent model configuration
model: "claude-sonnet-4-6" # or any supported model

# MCP Servers (optional - overrides registry defaults)
# By default, uses: web-fetch, duckduckgo-search
# Set to empty list [] to disable MCP entirely
# mcp_servers:
# - web-fetch
# - duckduckgo-search

# Channel configuration
channel:
type: "whatsapp"
storage_path: "~/storage/whatsapp"

# Privacy and filtering
privacy:
allowed_contact: "+34 666 666 666" # Only process messages from this number
# Option: log_filtered_messages to file for debugging (default: false)
# log_filtered_messages: true

# Feature flags
features:
text_messages: true # Enable text messages
media_messages: true # Enable media (images, videos, documents, audio)
group_messages: false # Enable group messages (disabled by default for privacy)
presence_updates: true # Enable presence (online/typing status)
typing_indicators: true # Send typing indicators when processing

# whatsapp specific
whatsapp_bridge:
auto_setup: true # Auto-clone Go bridge on first run
auto_connect: true # Auto-connect on startup
bridge_timeout_sec: 180 # Max wait for bridge startup
poll_interval_sec: 1 # Check for new messages every N seconds

# Logging
logging:
level: "INFO" # DEBUG, INFO, WARNING, ERROR
file: "logs/agent.log" # Log file location
8 changes: 6 additions & 2 deletions agentic-framework/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ name = "agentic-framework"
version = "0.1.0"
description = "Agentic Framework"
readme = "README.md"
requires-python = ">=3.12,<3.14"
requires-python = ">=3.12,<3.15"

dependencies = [
"neonize",
"httpx>=0.28.0",
"dotenv>=0.9.9",
"pyyaml>=6.0",
"langchain>=1.1.3",
"langchain-openai>=1.1.1",
"langchain-openai>=1.1.10",
"langchain-anthropic>=1.0.3",
"langchain-model-profiles>=0.0.4",
"langchain-community>=0.4.1",
Expand All @@ -32,6 +35,7 @@ dependencies = [
"langchain-cohere>=0.5.0",
"langchain-aws>=1.3.1",
"langchain-huggingface>=1.2.0",
"pydantic>=2.12.5",
]

[project.scripts]
Expand Down
25 changes: 25 additions & 0 deletions agentic-framework/src/agentic_framework/channels/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Communication channels for agents (WhatsApp, Discord, Telegram, etc.)."""

from agentic_framework.channels.base import (
Channel,
ChannelError,
ConfigurationError,
ConnectionError,
IncomingMessage,
MessageError,
OutgoingMessage,
)
from agentic_framework.channels.whatsapp import WhatsAppChannel
from agentic_framework.channels.whatsapp_config import WhatsAppAgentConfig

__all__ = [
"Channel",
"IncomingMessage",
"OutgoingMessage",
"ChannelError",
"ConnectionError",
"MessageError",
"ConfigurationError",
"WhatsAppChannel",
"WhatsAppAgentConfig",
]
Loading