xiaohongshu
xiaohongshu
cva-concepts-agent-types
Agent system taxonomy (A/B/C/D) based on capabilities - Type A (pure AI), Type B (AI+database context), Type C (AI+web grounding), Type D (AI+database+web). Includes latency/cost analysis, decision tree, healthcare pipeline mapping, and ROI optimization. Use when designing agent architecture, sel...
Full skill instructions
Core Concept: Taxonomy of AI agent systems based on their capabilities (data sources) Origin: Validated architecture from FluSisTip project (healthcare production system) Applicability: Generic for any regulated domain or rich-context requirements
In production AI agent development, especially in regulated domains (healthcare, legal, finance), not all agents need the same capabilities. The A/B/C/D typology classifies agents by type of data they access, enabling cost, performance, and complexity optimization.
Type A (Pure AI)
↓ +Database Context
Type B (AI + CAG)
↓ +Web Grounding
Type C (AI + Web)
↓ +Database Context
Type D (AI + CAG + Web)
| Type | Capabilities | Cost | Latency | Use Cases | Vertex AI Feature |
|---|---|---|---|---|---|
| A | Pure AI | $ | ~3s | Analysis, classification, extraction | Standard prompting |
| B | AI + CAG | $$ | ~5s | Personalization, compliance | Context injection |
| C | AI + Web | $$$ | ~12s | Research, external validation | Grounding API |
| D | AI + CAG + Web | $$$$ | ~17s | Maximum context consolidation | Context + Grounding |
Cost Legend:
Direct input → LLM → Structured output
Agent processes only data provided in input (by user or previous system in workflow). No database access, external APIs, or web search.
Function: Identify medical claims in raw text requiring scientific validation
Implementation Pattern (Clojure):
(ns lab.agents.claims-identifier
"Type A: Pure AI - Medical claims identification"
(:require [lab.config.google-cloud :as gc])
(:import [com.google.cloud.vertexai VertexAI]
[com.google.cloud.vertexai.generativeai GenerativeModel]))
(defn create-claims-agent
"Creates Type A agent for medical claims identification."
[{:keys [project-id location model]
:or {model "gemini-1.5-flash"}}]
(let [vertex-ai (VertexAI. project-id location)
generation-config (-> (GenerationConfig/newBuilder)
(.setTemperature 0.2) ; Low for technical analysis
(.setMaxOutputTokens 2000)
(.build))
model-instance (.getGenerativeModel vertex-ai model)]
(.withGenerationConfig model-instance generation-config)))
(defn identify-claims
"Identifies medical claims in content."
[agent content specialty]
(let [prompt (format
"Analyze this %s content and extract ALL scientific claims
that require validation. Return JSON with 'claims' array."
specialty content)
response (.generateContent agent prompt)
text (-> response .getText)]
(cheshire.core/parse-string text true)))
Real Metrics (Healthcare Pipeline):
Input + Database Context → LLM → Personalized output
Agent enriches prompt with data from tenant database (Context-Aware Generation). Enables personalization based on history, profile, stored business rules.
Function: Optimize content for SEO considering professional profile and specialized keywords
Implementation Pattern (Clojure):
(ns lab.agents.seo-optimizer
"Type B: AI + CAG - SEO optimization with tenant context"
(:require [lab.config.google-cloud :as gc]
[next.jdbc :as jdbc]))
(defn fetch-professional-profile
"Fetches complete professional profile (Context 1)."
[db-spec prof-id]
(jdbc/execute-one!
(jdbc/get-datasource db-spec)
["SELECT nome_completo, crm, especialidade, anos_experiencia,
tom_voz, cidade_atuacao
FROM profissionais
WHERE id = ?::uuid"
(str prof-id)]
{:builder-fn rs/as-unqualified-lower-maps}))
(defn fetch-seo-keywords
"Fetches specialized SEO keywords (Context 2)."
[db-spec specialty city]
(jdbc/execute!
(jdbc/get-datasource db-spec)
["SELECT keyword, tipo, search_volume
FROM seo_keywords
WHERE especialidade = ? AND cidade = ?
ORDER BY relevancia DESC LIMIT 10"
specialty city]
{:builder-fn rs/as-unqualified-lower-maps}))
(defn optimize-seo
"Optimizes content for SEO with professional context."
[agent db-spec content prof-id]
(let [profile (fetch-professional-profile db-spec prof-id)
keywords (fetch-seo-keywords db-spec
(:especialidade profile)
(:cidade_atuacao profile))
prompt (build-enriched-prompt content profile keywords)
response (.generateContent agent prompt)]
(parse-response response)))
Real Metrics:
Input + Web Search/Grounding → LLM → Validated output
Agent performs real-time external searches (web, scientific databases, public APIs) to enrich context and validate information. Uses Vertex AI Grounding API or custom tools.
Function: Find scientific references to validate medical claims
Implementation Pattern (Clojure):
(ns lab.agents.scientific-search
"Type C: AI + Web Grounding - Scientific reference search"
(:require [lab.config.google-cloud :as gc])
(:import [com.google.cloud.vertexai.api Tool GroundingMetadata]))
(defn create-grounded-agent
"Creates Type C agent with grounding enabled."
[{:keys [project-id location grounding-sources]
:or {grounding-sources ["google_search" "google_scholar"]}}]
(let [vertex-ai (VertexAI. project-id location)
grounding-tool (-> (Tool/newBuilder)
(.setGoogleSearchRetrieval
(-> (GoogleSearchRetrieval/newBuilder)
(.build)))
(.build))
model-instance (-> (.getGenerativeModel vertex-ai "gemini-1.5-pro")
(.withTools [grounding-tool]))]
model-instance))
(defn search-scientific-references
"Searches scientific references with grounding."
[agent claims]
(let [prompt (format
"For each medical claim, search reliable scientific references.
Minimum 2 primary sources, 1 systematic review if available.
Sources: PubMed, Google Scholar, SciELO. Return JSON."
(json/generate-string claims))
response (.generateContent agent prompt)
text (-> response .getText)
grounding-metadata (.getGroundingMetadata response)]
(assoc (json/parse-string text true)
:grounding-sources (-> grounding-metadata .getSearchQueries vec)
:grounding-confidence (-> grounding-metadata .getConfidence))))
Real Metrics:
Input + Database Context + Web Grounding → LLM → Consolidated output
Agent combines all capabilities: accesses tenant DB AND performs external searches. Maximum possible context, used for final consolidation or complex decisions.
Function: Consolidate all previous outputs (LGPD data, validated claims, references, SEO) into final professional text ready for publication
Real Metrics:
📘 Complete implementation: See
cva-healthcare-pipelineskill, System S.4.
┌─────────────────────────────────────────┐
│ Need external data (web/APIs)? │
└─────────────┬───────────────────────────┘
│
┌─────┴─────┐
│ │
NO YES
│ │
v v
┌───────────┐ ┌─────────────────────────────┐
│ Need │ │ Need tenant DB also? │
│ tenant DB?│ └──────────┬──────────────────┘
└─────┬─────┘ │
│ ┌─────┴─────┐
┌───┴───┐ │ │
│ │ NO YES
NO YES │ │
│ │ v v
v v ┌────────┐ ┌────────┐
┌───┐ ┌───┐ │ TYPE C │ │ TYPE D │
│ A │ │ B │ │ │ │ │
└───┘ └───┘ └────────┘ └────────┘
| Task | Need DB? | Need Web? | Type | Justification |
|---|---|---|---|---|
| Extract entities from text | ❌ | ❌ | A | Direct input sufficient |
| Classify sentiment | ❌ | ❌ | A | Pure text analysis |
| Generate personalized text | ✅ | ❌ | B | Need profile/history |
| Validate tenant compliance | ✅ | ❌ | B | Rules in DB |
| Search scientific papers | ❌ | ✅ | C | External sources |
| Check real-time prices | ❌ | ✅ | C | Public APIs |
| Consolidate executive report | ✅ | ✅ | D | Internal + market data |
| Total regulatory validation | ✅ | ✅ | D | Internal + CFM/CRP rules |
"Premature optimization is the root of all evil" - Donald Knuth
Implement first as Type A. If output is unsatisfactory, consider B/C/D. Often, a well-structured Type A prompt is sufficient.
DB contexts rarely change. Aggressive caching:
Observed savings: 85% query reduction
Grounding is expensive. Group multiple claims in a single call:
;; ❌ Inefficient: 5 calls
(doseq [claim claims]
(search-references agent [claim]))
;; ✅ Efficient: 1 call
(search-references agent claims)
Savings: ~70% cost and latency
Not always need web grounding. Use conditional logic:
(defn consolidate-content
[agent inputs]
(let [db-contexts (fetch-all-contexts inputs)
needs-grounding? (requires-external-validation? inputs)
web-data (when needs-grounding?
(perform-grounding inputs))]
(generate-final-content agent db-contexts web-data)))
Grounding can fail (rate limits, timeout). Have fallback to Type B:
(defn robust-consolidation
[agent inputs]
(try
(consolidate-tipo-d agent inputs) ; Try with grounding
(catch Exception e
(log/warn "Grounding failed, falling back to Type B" e)
(consolidate-tipo-b agent inputs)))) ; Fallback without web
| Aspect | Type A | Type B | Type C | Type D |
|---|---|---|---|---|
| Primary use | Analysis, extraction | Personalization | Research, validation | Consolidation |
| Latency | ~3s | ~5s | ~12s | ~17s |
| Cost | $0.02 | $0.08 | $0.18 | $0.42 |
| Complexity | ⭐ | ⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ |
| Success rate | 96% | 95% | 92% | 89% |
| When to use | Default | Tenant context | External data | Critical decisions |
Recommended Distribution in Pipeline (Healthcare):
ROI Multi-Model + Typing:
cva-healthcare-pipeline - Practical application of all 4 types ⭐cva-patterns-cost - Cost optimization strategiescva-patterns-context - Context management (CAG) implementationcva-patterns-workflows - Multi-agent orchestrationFor detailed examples by type, see:
This taxonomy is validated in production with proven ROI. Use it to make systematic architecture decisions and optimize costs.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience