# jotalexvalencia/ai-local-ollama-scripts architecture

> Architecture diagram of the GitHub repository jotalexvalencia/ai-local-ollama-scripts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jotalexvalencia/ai-local-ollama-scripts
- Repository: https://github.com/jotalexvalencia/ai-local-ollama-scripts

## Overview

This repository is a set of independent Python examples for using local Ollama models: web research, external tool calling, streaming, reasoning, and vision. The main user-to-result flow is the web-search agent: a query leads to search results, page text, and a model-generated answer. Other scripts demonstrate separate request/response workflows rather than one shared application. Edges reflect calls shown in excerpts; the README is empty, and unsampled lines or files do not support additional connections.

Main entry points: [`Ollama-Streaming-Test/app_cero_ruido_tools.py`](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_cero_ruido_tools.py) (Email Rules Agent), [`Clase-18-WebSearch/web_search_agent.py`](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Clase-18-WebSearch/web_search_agent.py) (Web Search), [`Ollama-Streaming-Test/app_api_externa.py`](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_api_externa.py) (Crypto Tool Agent), [`Ollama-Streaming-Test/app.py`](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app.py) (Stream Comparison)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_research["Web Research"]
  node_query["Search Query"]
  node_search["Web Search"]
  node_fetch["Page Fetch"]
  node_synthesis["Answer Synthesis"]
end

subgraph group_agents["Tool Agents"]
  node_crypto_agent["Crypto Tool Agent<br/>[app_api_externa.py]"]
  node_crypto_tool["Crypto Price Tool<br/>[app_api_externa.py]"]
  node_mail_agent["Email Rules Agent"]
  node_alias_category["Alias Categorizer"]
  node_category_rule["Category Rules"]
end

subgraph group_ollama["Ollama Demos"]
  node_stream_compare["Stream Comparison<br/>[app.py]"]
  node_nonstream["Nonstream Request<br/>[app.py]"]
  node_stream_request["Streaming Request<br/>[app.py]"]
  node_thinking_http["Thinking HTTP Demo<br/>[app_thinking.py]"]
  node_thinking_sdk["Thinking SDK Demo"]
  node_vision_demo["Vision Demo"]
end

node_user(("User"))
node_ddg{{"DuckDuckGo"}}
node_web{{"Web Pages"}}
node_ollama_service{{"Ollama Service"}}
node_api_ninjas{{"API Ninjas"}}
node_image_file["Image Input"]

node_user -->|"asks"| node_query
node_query -->|"searches"| node_search
node_search -->|"queries"| node_ddg
node_search -->|"passes URL"| node_fetch
node_fetch -->|"downloads"| node_web
node_fetch -->|"provides text"| node_synthesis
node_synthesis -->|"requests answer"| node_ollama_service
node_user -->|"asks prices"| node_crypto_agent
node_crypto_agent -->|"requests tool choice"| node_ollama_service
node_crypto_agent -->|"executes tool"| node_crypto_tool
node_crypto_tool -->|"fetches price"| node_api_ninjas
node_user -->|"asks email rule"| node_mail_agent
node_mail_agent -->|"requests tool choice"| node_ollama_service
node_mail_agent -->|"executes tool"| node_alias_category
node_mail_agent -->|"executes tool"| node_category_rule
node_user -->|"starts demo"| node_stream_compare
node_stream_compare -->|"runs"| node_nonstream
node_stream_compare -->|"runs"| node_stream_request
node_nonstream -->|"posts request"| node_ollama_service
node_stream_request -->|"streams request"| node_ollama_service
node_user -->|"starts demo"| node_thinking_http
node_thinking_http -->|"streams chat"| node_ollama_service
node_user -->|"starts demo"| node_thinking_sdk
node_thinking_sdk -->|"streams chat"| node_ollama_service
node_user -->|"starts demo"| node_vision_demo
node_image_file -->|"provides image"| node_vision_demo
node_vision_demo -->|"requests description"| node_ollama_service

click node_query "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Clase-18-WebSearch/web_search_agent.py"
click node_search "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Clase-18-WebSearch/web_search_agent.py"
click node_fetch "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Clase-18-WebSearch/web_search_agent.py"
click node_synthesis "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Clase-18-WebSearch/web_search_agent.py"
click node_crypto_agent "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_api_externa.py"
click node_crypto_tool "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_api_externa.py"
click node_mail_agent "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_cero_ruido_tools.py"
click node_alias_category "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_cero_ruido_tools.py"
click node_category_rule "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_cero_ruido_tools.py"
click node_stream_compare "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app.py"
click node_nonstream "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app.py"
click node_stream_request "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app.py"
click node_thinking_http "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_thinking.py"
click node_thinking_sdk "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_thinking_sdk.py"
click node_vision_demo "https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_vision_example.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_query,node_search,node_fetch,node_synthesis,node_user toneBlue
class node_crypto_agent,node_crypto_tool,node_mail_agent,node_alias_category,node_category_rule toneAmber
class node_stream_compare,node_nonstream,node_stream_request,node_thinking_http,node_thinking_sdk,node_vision_demo,node_api_ninjas toneMint
class node_ddg,node_web,node_ollama_service,node_image_file toneIndigo
```

## Components

### Web Research

- [Search Query](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Clase-18-WebSearch/web_search_agent.py): `Clase-18-WebSearch/web_search_agent.py`
- [Web Search](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Clase-18-WebSearch/web_search_agent.py): `Clase-18-WebSearch/web_search_agent.py`
- [Page Fetch](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Clase-18-WebSearch/web_search_agent.py): `Clase-18-WebSearch/web_search_agent.py`
- [Answer Synthesis](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Clase-18-WebSearch/web_search_agent.py): `Clase-18-WebSearch/web_search_agent.py`

### Tool Agents

- [Crypto Tool Agent](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_api_externa.py): `Ollama-Streaming-Test/app_api_externa.py`
- [Crypto Price Tool](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_api_externa.py): `Ollama-Streaming-Test/app_api_externa.py`
- [Email Rules Agent](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_cero_ruido_tools.py): `Ollama-Streaming-Test/app_cero_ruido_tools.py`
- [Alias Categorizer](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_cero_ruido_tools.py): `Ollama-Streaming-Test/app_cero_ruido_tools.py`
- [Category Rules](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_cero_ruido_tools.py): `Ollama-Streaming-Test/app_cero_ruido_tools.py`

### Ollama Demos

- [Stream Comparison](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app.py): `Ollama-Streaming-Test/app.py`
- [Nonstream Request](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app.py): `Ollama-Streaming-Test/app.py`
- [Streaming Request](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app.py): `Ollama-Streaming-Test/app.py`
- [Thinking HTTP Demo](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_thinking.py): `Ollama-Streaming-Test/app_thinking.py`
- [Thinking SDK Demo](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_thinking_sdk.py): `Ollama-Streaming-Test/app_thinking_sdk.py`
- [Vision Demo](https://github.com/jotalexvalencia/ai-local-ollama-scripts/blob/main/Ollama-Streaming-Test/app_vision_example.py): `Ollama-Streaming-Test/app_vision_example.py`

### Other components

- **User**
- **DuckDuckGo**
- **Web Pages**
- **Ollama Service**
- **API Ninjas**
- **Image Input**

## Connections

- User → Search Query: asks (evidence: `Clase-18-WebSearch/web_search_agent.py`)
- Search Query → Web Search: searches (evidence: `Clase-18-WebSearch/web_search_agent.py`)
- Web Search → DuckDuckGo: queries (evidence: `Clase-18-WebSearch/web_search_agent.py`)
- Web Search → Page Fetch: passes URL (evidence: `Clase-18-WebSearch/web_search_agent.py`)
- Page Fetch → Web Pages: downloads (evidence: `Clase-18-WebSearch/web_search_agent.py`)
- Page Fetch → Answer Synthesis: provides text (evidence: `Clase-18-WebSearch/web_search_agent.py`)
- Answer Synthesis → Ollama Service: requests answer (evidence: `Clase-18-WebSearch/web_search_agent.py`)
- User → Crypto Tool Agent: asks prices (evidence: `Ollama-Streaming-Test/app_api_externa.py`)
- Crypto Tool Agent → Ollama Service: requests tool choice (evidence: `Ollama-Streaming-Test/app_api_externa.py`)
- Crypto Tool Agent → Crypto Price Tool: executes tool (evidence: `Ollama-Streaming-Test/app_api_externa.py`)
- Crypto Price Tool → API Ninjas: fetches price (evidence: `Ollama-Streaming-Test/app_api_externa.py`)
- User → Email Rules Agent: asks email rule (evidence: `Ollama-Streaming-Test/app_cero_ruido_tools.py`)
- Email Rules Agent → Ollama Service: requests tool choice (evidence: `Ollama-Streaming-Test/app_cero_ruido_tools.py`)
- Email Rules Agent → Alias Categorizer: executes tool (evidence: `Ollama-Streaming-Test/app_cero_ruido_tools.py`)
- Email Rules Agent → Category Rules: executes tool (evidence: `Ollama-Streaming-Test/app_cero_ruido_tools.py`)
- User → Stream Comparison: starts demo (evidence: `Ollama-Streaming-Test/app.py`)
- Stream Comparison → Nonstream Request: runs (evidence: `Ollama-Streaming-Test/app.py`)
- Stream Comparison → Streaming Request: runs (evidence: `Ollama-Streaming-Test/app.py`)
- Nonstream Request → Ollama Service: posts request (evidence: `Ollama-Streaming-Test/app.py`)
- Streaming Request → Ollama Service: streams request (evidence: `Ollama-Streaming-Test/app.py`)
- User → Thinking HTTP Demo: starts demo (evidence: `Ollama-Streaming-Test/app_thinking.py`)
- Thinking HTTP Demo → Ollama Service: streams chat (evidence: `Ollama-Streaming-Test/app_thinking.py`)
- User → Thinking SDK Demo: starts demo (evidence: `Ollama-Streaming-Test/app_thinking_sdk.py`)
- Thinking SDK Demo → Ollama Service: streams chat (evidence: `Ollama-Streaming-Test/app_thinking_sdk.py`)
- User → Vision Demo: starts demo (evidence: `Ollama-Streaming-Test/app_vision_example.py`)
- Image Input → Vision Demo: provides image (evidence: `Ollama-Streaming-Test/app_vision_example.py`)
- Vision Demo → Ollama Service: requests description (evidence: `Ollama-Streaming-Test/app_vision_example.py`)
