๐ AI Providers
OpenRouter (100+ models), local Ollama, the BaseProvider interface, multi-provider failover, and task-based model selection.
OpenRouter is an LLM gateway that brings together 100+ models with a single API key and unified billing.
Eliminates vendor lock-in. Switching from Claude to GPT-4o is just changing a configuration string.
API key, model routing, cost tracking, rate limits per model.
Ollama runs models like Llama 3, Mistral, and Gemma 2 locally without sending data to external APIs.
For sensitive data or heavy use, Ollama eliminates API costs and ensures complete data privacy.
Local inference, quantization, GGUF format, context length, GPU acceleration.
BaseProvider defines async chat(messages) -> str as the only required method. The Agent never accesses LLMs directly.
Any LLM that implements BaseProvider works with the Agent without changes. Add Anthropic directly? 20 lines.
Abstract base class, async interface, message format normalization, error handling.
ProviderChain tries the primary provider and, if it fails, switches to the secondary one. This is transparent to the Agent.
LLM APIs have outages. Without failover, your assistant goes offline when the provider goes down. With failover, it keeps working.
Circuit breaker, retry logic, provider priority, health check, fallback chain.
Different tasks have different needs: code needs a technical model, summaries can use an inexpensive model, and complex reasoning needs the most capable one.
Using GPT-4o for everything is expensive and slow. Intelligent routing reduces costs by 60-80% with no perceptible loss of quality.
Task classification, model routing, cost optimization, quality vs. speed tradeoff.
cost_tracker.py tracks tokens consumed per session, per model, and per day, with alerts when thresholds are reached.
LLMs can quickly generate unexpected costs. Proactive monitoring prevents billing surprises and costly loops.
Token counting, cost per model, daily budget, alert thresholds, cost breakdown.
๐งฐ Skills and Tools
Tools system with BaseTool, automatic discovery via registry.py, Google Workspace, GitHub, and custom tool creation.
BaseTool defines: name (identifier), description (what the tool doesโsent to the LLM), parameters (JSON Schema for the arguments), and async execute(**kwargs) -> str.
The LLM uses description and parameters to decide when and how to call the tool. A well-written description is just as important as the implementation.
Function calling, JSON Schema, docstring as documentation, return format conventions.
registry.py scans the tools/ directory and automatically discovers all classes that extend BaseTool. Adding a new tool = creating the file. No changes to the Agent.
Without automatic registration, adding a tool requires modifying the Agent. With the registry, you create the tool and it automatically becomes available on the next run.
Plugin architecture, auto-discovery, importlib, class introspection.
GoogleCalendarTool lets you create, list, and update events. GoogleDriveTool uploads, downloads, and searches files. Authentication via OAuth2 with automatic token refresh.
For Google Workspace users, integrating Jarvis with Calendar and Drive creates an assistant that truly manages your schedule and documents.
OAuth2 flow, service account, API quota, token refresh, batch requests.
GitHubTool covers: creating and closing issues, reviewing PRs, making commits, and searching repository code semantically. Uses the GitHub API with a personal access token.
A Jarvis integrated with GitHub can answer โWhatโs the status of PR #123?โ, create issues based on bugs reported in conversation, and commit simple fixes.
GitHub API, personal access token, webhook events, code search, PR review automation.
BrowserTool uses Playwright for headless browsing. Lets you search the web, extract page content, and fill out forms with user approval.
A Jarvis without web access is limited to its training. BrowserTool provides access to up-to-date information and enables automation of repetitive web tasks.
Playwright, headless browser, content extraction, safety wrapper, JavaScript execution.
Create a tool: (1) create a file at tools/minha_tool.py, (2) extend BaseTool, (3) define name, description, parameters, (4) implement execute(). The registry detects it automatically.
The INTELECTO extension model is deliberately simple. Any REST API, web service, or local script can become a tool in fewer than 50 lines of code.
Inheritance pattern, async execute, error handling, return string format, type hints.
โ Automation and Webhooks
Cron scheduling, Heartbeat for periodic checks, webhooks (n8n, Zapier), sub-agents, and collaboration between agents.
INTELECTOโs cron.py lets you schedule tasks in standard cron format. Jarvis can generate a daily report at 9 a.m., check emails every 30min, or run a weekly backup.
A truly proactive Jarvis doesnโt wait to be calledโit acts at the right moment. Cron turns the assistant from reactive to proactive.
Cron expression, asyncio scheduler, task persistence, timezone handling, error recovery.
Heartbeat is a periodic loop that checks configured conditions: Is a third-party API down? Did a deploy fail? Has database memory exceeded its limit? It sends proactive alerts.
Reactive monitoring (you find out when the user complains) is unacceptable for infrastructure. Heartbeat makes Jarvis an active monitor.
Health checks, threshold monitoring, alert fatigue prevention, escalation policy.
webhook_server.py exposes HTTPS endpoints that receive external events. n8n or Zapier send events (new lead, email received, issue opened) that trigger actions by Jarvis.
Webhooks connect Jarvis to the existing automation ecosystem. You don't need to rewrite existing workflows โ just add Jarvis as an intelligent step.
FastAPI, HMAC signature verification, event queuing, idempotency, retry handling.
Sub-agents are Agent instances that run in the background for tasks that take minutes or hours. The main Jarvis can create sub-agents for research, compilation, or analysis.
Without sub-agents, long tasks block Jarvis from handling other conversations. With sub-agents, the user can keep chatting while the work happens in parallel.
Asyncio tasks, task queue, progress notification, cancellation, result aggregation.
Multiple specialized agents collaborate via messages: @coder generates the code, @reviewer analyzes it, and @deployer deploys it. Each agent has its own specialized SOUL.md.
A single generalist agent is less effective than collaborating specialists. The TinyClaw pattern enables agent composition for complex tasks.
Agent messaging, role specialization, work handoff, consensus mechanism, orchestration.
metrics.py collects: latency per request, tokens consumed, tools called, errors by type. Dashboard via Telegram or an HTTP endpoint with current metrics.
Without observability, you donโt know why Jarvis is slow or expensive. Metrics enable data-driven optimization instead of relying on intuition.
Metrics collection, latency tracking, error rate, cost per action, dashboard design.