PTENES
TRACK 4

๐Ÿ”— Memory and Integrations

OpenRouter (100+ models), local Ollama, the BaseTool tools system, Google Workspace, GitHub, and automation with webhooks and sub-agents.

3
Modules
18
Topics
~4h
Duration
Interm.
Level
Detailed Content
4.1~60 min

๐Ÿ”— AI Providers

OpenRouter (100+ models), local Ollama, the BaseProvider interface, multi-provider failover, and task-based model selection.

What is:

OpenRouter is an LLM gateway that brings together 100+ models with a single API key and unified billing.

Why learn:

Eliminates vendor lock-in. Switching from Claude to GPT-4o is just changing a configuration string.

Key Concepts:

API key, model routing, cost tracking, rate limits per model.

What is:

Ollama runs models like Llama 3, Mistral, and Gemma 2 locally without sending data to external APIs.

Why learn:

For sensitive data or heavy use, Ollama eliminates API costs and ensures complete data privacy.

Key Concepts:

Local inference, quantization, GGUF format, context length, GPU acceleration.

What is:

BaseProvider defines async chat(messages) -> str as the only required method. The Agent never accesses LLMs directly.

Why learn:

Any LLM that implements BaseProvider works with the Agent without changes. Add Anthropic directly? 20 lines.

Key Concepts:

Abstract base class, async interface, message format normalization, error handling.

What is:

ProviderChain tries the primary provider and, if it fails, switches to the secondary one. This is transparent to the Agent.

Why learn:

LLM APIs have outages. Without failover, your assistant goes offline when the provider goes down. With failover, it keeps working.

Key Concepts:

Circuit breaker, retry logic, provider priority, health check, fallback chain.

What is:

Different tasks have different needs: code needs a technical model, summaries can use an inexpensive model, and complex reasoning needs the most capable one.

Why learn:

Using GPT-4o for everything is expensive and slow. Intelligent routing reduces costs by 60-80% with no perceptible loss of quality.

Key Concepts:

Task classification, model routing, cost optimization, quality vs. speed tradeoff.

What is:

cost_tracker.py tracks tokens consumed per session, per model, and per day, with alerts when thresholds are reached.

Why learn:

LLMs can quickly generate unexpected costs. Proactive monitoring prevents billing surprises and costly loops.

Key Concepts:

Token counting, cost per model, daily budget, alert thresholds, cost breakdown.

View Full
4.2~60 min

๐Ÿงฐ Skills and Tools

Tools system with BaseTool, automatic discovery via registry.py, Google Workspace, GitHub, and custom tool creation.

What is:

BaseTool defines: name (identifier), description (what the tool doesโ€”sent to the LLM), parameters (JSON Schema for the arguments), and async execute(**kwargs) -> str.

Why learn:

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.

Key Concepts:

Function calling, JSON Schema, docstring as documentation, return format conventions.

What is:

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.

Why learn:

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.

Key Concepts:

Plugin architecture, auto-discovery, importlib, class introspection.

What is:

GoogleCalendarTool lets you create, list, and update events. GoogleDriveTool uploads, downloads, and searches files. Authentication via OAuth2 with automatic token refresh.

Why learn:

For Google Workspace users, integrating Jarvis with Calendar and Drive creates an assistant that truly manages your schedule and documents.

Key Concepts:

OAuth2 flow, service account, API quota, token refresh, batch requests.

What is:

GitHubTool covers: creating and closing issues, reviewing PRs, making commits, and searching repository code semantically. Uses the GitHub API with a personal access token.

Why learn:

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.

Key Concepts:

GitHub API, personal access token, webhook events, code search, PR review automation.

What is:

BrowserTool uses Playwright for headless browsing. Lets you search the web, extract page content, and fill out forms with user approval.

Why learn:

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.

Key Concepts:

Playwright, headless browser, content extraction, safety wrapper, JavaScript execution.

What is:

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.

Why learn:

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.

Key Concepts:

Inheritance pattern, async execute, error handling, return string format, type hints.

View Full
4.3~60 min

โš™ Automation and Webhooks

Cron scheduling, Heartbeat for periodic checks, webhooks (n8n, Zapier), sub-agents, and collaboration between agents.

What is:

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.

Why learn:

A truly proactive Jarvis doesnโ€™t wait to be calledโ€”it acts at the right moment. Cron turns the assistant from reactive to proactive.

Key Concepts:

Cron expression, asyncio scheduler, task persistence, timezone handling, error recovery.

What is:

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.

Why learn:

Reactive monitoring (you find out when the user complains) is unacceptable for infrastructure. Heartbeat makes Jarvis an active monitor.

Key Concepts:

Health checks, threshold monitoring, alert fatigue prevention, escalation policy.

What is:

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.

Why learn:

Webhooks connect Jarvis to the existing automation ecosystem. You don't need to rewrite existing workflows โ€” just add Jarvis as an intelligent step.

Key Concepts:

FastAPI, HMAC signature verification, event queuing, idempotency, retry handling.

What is:

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.

Why learn:

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.

Key Concepts:

Asyncio tasks, task queue, progress notification, cancellation, result aggregation.

What is:

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.

Why learn:

A single generalist agent is less effective than collaborating specialists. The TinyClaw pattern enables agent composition for complex tasks.

Key Concepts:

Agent messaging, role specialization, work handoff, consensus mechanism, orchestration.

What is:

metrics.py collects: latency per request, tokens consumed, tools called, errors by type. Dashboard via Telegram or an HTTP endpoint with current metrics.

Why learn:

Without observability, you donโ€™t know why Jarvis is slow or expensive. Metrics enable data-driven optimization instead of relying on intuition.

Key Concepts:

Metrics collection, latency tracking, error rate, cost per action, dashboard design.

View Full
โ† PreviousTrack 5: Architectures โ†’