Artificial Intelligence

core

Artificial Intelligence

Definition

Artificial intelligence (AI) is the field of computer science concerned with the design and construction of computational systems that perform tasks typically associated with human cognitive capabilities, including reasoning, learning from experience, perception of complex environments, natural language understanding, pattern recognition, planning, and autonomous decision-making. AI encompasses a broad spectrum of techniques ranging from rule-based expert systems and statistical machine learning to deep neural networks, large language models (LLMs), reinforcement learning, and multi-agent systems. The field's central challenge is creating systems that can generalize from training data or programmed rules to novel situations, making intelligent decisions in domains they were not explicitly programmed for.

In the context of modern software engineering, AI has evolved from a research curiosity to a foundational infrastructure component. Large language models power code generation, documentation, code review, and architectural analysis. Machine learning models drive anomaly detection, predictive monitoring, and intelligent routing. Agent-based AI systems orchestrate complex workflows that span multiple tools, APIs, and decision points. The Prismatic Platform integrates AI at every level of its architecture, from its 530+ AIAD agents to its Ollama local inference capability and Claude API integration.

Overview

The evolution of artificial intelligence spans seven decades of research, punctuated by periods of rapid progress ("AI summers") and funding contractions ("AI winters"). Understanding this trajectory provides context for the current state of AI integration in production software systems.

Historical Trajectory

EraPeriodKey DevelopmentsParadigm
Symbolic AI1956-1980Logic programming, expert systems, LISPRules and symbols
First AI Winter1974-1980Funding cuts, limited computing powerDisillusionment
Expert Systems1980-1987MYCIN, R1/XCON, commercial deploymentsKnowledge engineering
Second AI Winter1987-1993Expert system maintenance costs, narrow applicabilityReassessment
Statistical ML1993-2012SVMs, random forests, Bayesian methodsData-driven learning
Deep Learning2012-2020CNNs, RNNs, transformers, ImageNet breakthroughNeural networks at scale
Foundation Models2020-presentGPT, Claude, Gemini, open-source LLMs, agentsPre-trained general models

AI Taxonomy

Modern AI systems can be classified along several dimensions:

DimensionCategoriesExamples
Learning paradigmSupervised, unsupervised, reinforcement, self-supervisedClassification, clustering, game playing, LLM pre-training
ArchitectureTransformers, CNNs, RNNs, GNNs, diffusion modelsGPT-4, ResNet, LSTM, GCN, Stable Diffusion
Deployment modelCloud API, local inference, edge deployment, hybridClaude API, Ollama, TensorFlow Lite
Autonomy levelTool (human-directed), assistant (collaborative), agent (autonomous)Code formatter, Claude Code, AIAD agents
Domain specificityGeneral-purpose, domain-specific, task-specificLLMs, medical imaging, spam detection

The LLM Revolution

Large language models represent the most significant recent advance in AI. Trained on vast corpora of text data, LLMs develop emergent capabilities including:

  • In-context learning: Performing new tasks from a few examples without parameter updates
  • Chain-of-thought reasoning: Breaking complex problems into sequential reasoning steps
  • Code generation: Producing syntactically and semantically correct code from natural language descriptions
  • Tool use: Invoking external APIs and tools to accomplish tasks beyond text generation
  • Multi-turn dialogue: Maintaining coherent conversation context across extended interactions

These capabilities make LLMs particularly valuable for software engineering tasks, where they can serve as architectural advisors, code reviewers, documentation generators, and autonomous agents.

Technical Details

AI Agent Architecture

An AI agent is a system that perceives its environment, makes decisions, and takes actions to achieve goals. In the AIAD (AI Agent Definition) framework used by Prismatic, agents are formally specified with capabilities, constraints, communication protocols, and enforcement rules.

defmodule PrismaticAgents.AgentRuntime do
  @moduledoc """
  Runtime execution environment for AIAD-specified AI agents.

  Provides process isolation, capability enforcement, telemetry,
  and supervised execution for all 530+ platform agents.
  """

  use GenServer

  @type agent_level :: :l1_strategic | :l2_tactical | :l3_operational | :l4_specialist
  @type agent_status :: :idle | :executing | :waiting | :error | :completed

  @type agent_state :: %{
    id: String.t(),
    name: String.t(),
    level: agent_level(),
    status: agent_status(),
    capabilities: [atom()],
    constraints: [atom()],
    execution_count: non_neg_integer(),
    last_execution: DateTime.t() | nil
  }

  @spec start_agent(String.t(), keyword()) :: {:ok, pid()} | {:error, term()}
  def start_agent(agent_id, opts \\ []) do
    GenServer.start_link(__MODULE__, %{
      id: agent_id,
      name: Keyword.get(opts, :name, agent_id),
      level: Keyword.get(opts, :level, :l4_specialist),
      status: :idle,
      capabilities: Keyword.get(opts, :capabilities, []),
      constraints: Keyword.get(opts, :constraints, []),
      execution_count: 0,
      last_execution: nil
    })
  end

  @spec execute(pid(), map()) :: {:ok, map()} | {:error, String.t()}
  def execute(agent_pid, task) when is_map(task) do
    GenServer.call(agent_pid, {:execute, task}, :timer.seconds(30))
  end

  @impl true
  def init(state) do
    :telemetry.execute(
      [:prismatic_agents, :agent, :started],
      %{system_time: System.system_time()},
      %{agent_id: state.id, level: state.level}
    )

    {:ok, state}
  end

  @impl true
  def handle_call({:execute, task}, _from, state) do
    case validate_capabilities(task, state.capabilities) do
      :ok ->
        result = perform_execution(task, state)

        new_state = %{state |
          status: :completed,
          execution_count: state.execution_count + 1,
          last_execution: DateTime.utc_now()
        }

        :telemetry.execute(
          [:prismatic_agents, :agent, :executed],
          %{duration: result.duration_ms},
          %{agent_id: state.id, task_type: task.type}
        )

        {:reply, {:ok, result}, new_state}

      {:error, missing} ->
        {:reply, {:error, "Missing capabilities: #{inspect(missing)}"}, state}
    end
  end

  @spec validate_capabilities(map(), [atom()]) :: :ok | {:error, [atom()]}
  defp validate_capabilities(task, capabilities) do
    required = Map.get(task, :required_capabilities, [])
    missing = required -- capabilities

    case missing do
      [] -> :ok
      missing_caps -> {:error, missing_caps}
    end
  end

  @spec perform_execution(map(), agent_state()) :: map()
  defp perform_execution(task, state) do
    start_time = System.monotonic_time(:millisecond)

    # Agent-specific execution logic dispatched by task type
    result = dispatch_task(task, state)

    end_time = System.monotonic_time(:millisecond)

    Map.put(result, :duration_ms, end_time - start_time)
  end

  @spec dispatch_task(map(), agent_state()) :: map()
  defp dispatch_task(%{type: :analysis} = task, _state) do
    %{type: :analysis, status: :completed, output: analyze(task.input)}
  end

  defp dispatch_task(%{type: :transformation} = task, _state) do
    %{type: :transformation, status: :completed, output: transform(task.input)}
  end

  defp dispatch_task(task, _state) do
    %{type: task.type, status: :completed, output: nil}
  end

  defp analyze(input), do: input
  defp transform(input), do: input
end

LLM Integration Patterns

Integrating LLMs into production systems requires careful architectural consideration. The key patterns observed in Prismatic and the broader industry include:

PatternDescriptionTrade-offs
Direct APISynchronous calls to LLM provider APIsSimple, latency-dependent, vendor lock-in risk
Local inferenceRunning models locally via Ollama, llama.cpp, vLLMPrivacy, latency control, hardware requirements
Hybrid routingLocal for simple tasks, cloud for complexBest of both worlds, routing complexity
Agent orchestrationLLMs as reasoning engines driving tool-using agentsPowerful, complex error handling, cost management
RAG (Retrieval-Augmented)LLM + vector database for domain-specific knowledgeAccurate, requires embedding pipeline, index maintenance
Fine-tuned modelsDomain-specific model adaptationHigh accuracy, training cost, data requirements

Inference Architecture

defmodule PrismaticAI.InferenceRouter do
  @moduledoc """
  Routes AI inference requests to the optimal backend based on
  task complexity, latency requirements, and resource availability.

  Supports Ollama (local), Claude API (cloud), and custom model endpoints.
  """

  @type backend :: :ollama | :claude_api | :custom
  @type routing_strategy :: :latency_optimized | :cost_optimized | :quality_optimized

  @type inference_request :: %{
    prompt: String.t(),
    max_tokens: pos_integer(),
    temperature: float(),
    model_preference: backend() | nil,
    timeout_ms: pos_integer()
  }

  @type inference_response :: %{
    text: String.t(),
    model: String.t(),
    backend: backend(),
    latency_ms: non_neg_integer(),
    tokens_used: non_neg_integer()
  }

  @spec route(inference_request(), routing_strategy()) ::
    {:ok, inference_response()} | {:error, String.t()}
  def route(request, strategy \\ :quality_optimized) do
    backend = select_backend(request, strategy)

    case execute_inference(backend, request) do
      {:ok, response} ->
        {:ok, response}

      {:error, reason} ->
        # Fallback to cloud if local inference fails
        fallback(backend, request, reason)
    end
  end

  @spec select_backend(inference_request(), routing_strategy()) :: backend()
  defp select_backend(%{model_preference: preference}, _strategy)
       when not is_nil(preference) do
    preference
  end

  defp select_backend(request, :latency_optimized) do
    if estimated_tokens(request.prompt) < 500, do: :ollama, else: :claude_api
  end

  defp select_backend(_request, :cost_optimized), do: :ollama
  defp select_backend(_request, :quality_optimized), do: :claude_api

  @spec execute_inference(backend(), inference_request()) ::
    {:ok, inference_response()} | {:error, String.t()}
  defp execute_inference(:ollama, request) do
    # Ollama local inference via HTTP API
    PrismaticAI.Ollama.generate(request)
  end

  defp execute_inference(:claude_api, request) do
    # Claude API cloud inference
    PrismaticAI.Claude.complete(request)
  end

  defp execute_inference(:custom, request) do
    PrismaticAI.Custom.infer(request)
  end

  @spec fallback(backend(), inference_request(), String.t()) ::
    {:ok, inference_response()} | {:error, String.t()}
  defp fallback(:ollama, request, _reason) do
    execute_inference(:claude_api, request)
  end

  defp fallback(_backend, _request, reason) do
    {:error, "All inference backends failed. Last error: #{reason}"}
  end

  @spec estimated_tokens(String.t()) :: non_neg_integer()
  defp estimated_tokens(text), do: div(String.length(text), 4)
end

The AIAD Standard

The AI Agent Definition (AIAD) standard is Prismatic's formal specification language for AI agents. Each of the 530+ agents is defined in a structured YAML-based format that captures:

ComponentPurposeExample
Agent specificationIdentity, level, capabilities, constraintsarcher-supreme.agent.md
Command specificationInvocation interface, parameters, outputsorchestrate.cmd.md
Pipeline definitionMulti-agent workflow orchestrationAssessment pipelines
Policy definitionBehavioral constraints and enforcement rulesSafety policies
DoctrineOverarching principles governing all agentsNO MERCY, NO DOUBTS

Implementation in Prismatic Platform

Prismatic integrates AI across its entire architecture, from development tooling to runtime intelligence to security operations.

530+ AIAD Agents

The platform operates 530+ formally specified AI agents organized into a hierarchical command structure:

LevelRoleCountExamples
L1 StrategicPlatform-level coordination and planning~10Archer Supreme, Supreme Coordinator
L2 TacticalDomain-specific orchestration~50Red Commander, Blue Commander, Quality Architect
L3 OperationalTask execution and monitoring~170Color team agents, OSINT operators
L4 SpecialistFocused single-capability agents~300Edge Finder, Contract Validator, Signal Aggregator

Ollama Local AI Integration

Prismatic supports local AI inference through Ollama, enabling privacy-sensitive operations and reducing cloud API dependency:

  • Models: qwen3-coder (7B), gpt-oss:20b (20B), deepseek-coder (6.7B)
  • Response time: < 3 seconds for 7B models, < 5 seconds for 20B
  • Memory: < 8GB for standard models
  • Fallback: Automatic cloud fallback when local inference quality is insufficient
  • Quality gates: Local inference output validated against quality thresholds

Color Team AI Operations

The 6-color security team structure leverages AI for epistemic security:

  • Gray Team: AI-driven boundary exploration and edge case discovery
  • Red Team: AI-simulated adversarial attacks using 329-entry taxonomy
  • Blue Team: AI-powered defensive posture assessment and drift detection
  • Purple Team: AI-synthesized Red-Blue loop closure analysis
  • White Team: AI-assisted formal verification and proof construction
  • Black Team: AI theoretical threat modeling (maximum isolation)

AI-Powered Quality Enforcement

AI assists in maintaining the platform's 100/100 quality score through:

  • AutoHeal: Autonomous identification and resolution of quality regressions
  • AutoEvolve: AI-driven platform evolution across generations
  • Quality Floor Guardian: Continuous quality monitoring with AI-powered trend analysis
  • Predictive Pre-Commit: AI-based prediction of which changes are likely to cause regressions

Comparison with Alternatives

ApproachStrengthsWeaknessesPrismatic Position
Cloud-only AI (GPT/Claude API)Best model quality, no infrastructureLatency, cost, privacy, vendor dependencyHybrid: cloud for complex, local for routine
Local-only (Ollama/llama.cpp)Privacy, low latency, no API costModel quality limits, hardware requirementsSupported with automatic cloud fallback
No AI integrationSimplicity, no AI-specific risksMissing competitive advantage, manual processesRejected: AI is core to platform strategy
Custom model trainingDomain expertise, competitive moatTraining cost, data requirements, maintenanceFuture: fine-tuned models for specialized domains
RAG-onlyGrounded in domain knowledgeRetrieval quality dependency, index maintenanceIntegrated: RAG for OSINT knowledge bases

AI Integration Anti-Patterns

Anti-PatternDescriptionMitigation
AI WashingAdding AI labels to non-AI featuresAIAD standard requires formal agent specification
Prompt Injection BlindnessIgnoring adversarial prompt manipulationInput validation, sandboxed execution, output filtering
Single Model DependencyRelying on one AI providerMulti-backend routing, Ollama local fallback
Unbounded AI SpendNo cost controls on API usageToken budgets, caching, local inference for routine tasks
Hallucination ToleranceAccepting AI output without verificationTrinity Gate validation, evidence-based outputs

Best Practices

  1. Define agent capabilities formally: Every AI agent should have a formal specification documenting its capabilities, constraints, and communication protocols. The AIAD standard provides this structure for Prismatic's 530+ agents.

  2. Implement inference routing: Route AI requests to the optimal backend based on task requirements. Simple tasks go to local models; complex reasoning goes to frontier models.

  3. Validate AI outputs: AI-generated content must pass through validation gates. The Trinity Gate protocol ensures structural, logical, and formal consistency of AI-produced outputs.

  4. Maintain human oversight: AI agents operate under human supervision. Critical decisions require human approval. The NO DOUBTS doctrine requires evidence-based verification of all AI-generated claims.

  5. Design for graceful degradation: AI services are inherently probabilistic. Systems must function -- with reduced capability -- when AI inference is unavailable or produces low-quality output.

  6. Monitor AI performance continuously: Track inference latency, output quality, cost, and error rates. The Telemetry integration provides real-time visibility into AI system performance.

  7. Isolate AI from security-critical paths: AI-generated code or configurations must never be deployed to production without human review and automated quality gate validation.

  8. Version prompts like code: Prompts are code. They should be versioned, tested, reviewed, and deployed through the same pipeline as application code.

Common Pitfalls

Over-reliance on AI for critical decisions: AI systems are probabilistic and can produce confidently wrong outputs. Architecture decisions, security configurations, and data model changes should always involve human judgment, even when AI provides initial recommendations.

Ignoring inference cost at scale: A single Claude API call costs fractions of a cent. A million calls per day costs thousands of dollars per month. Architecture must account for inference cost as a first-class operational concern.

Treating AI as a black box: Understanding how AI models make decisions -- their training data biases, failure modes, and capability boundaries -- is essential for responsible integration. The NABLA infinity framework provides the epistemic rigor needed.

Neglecting data privacy: Sending sensitive data to cloud AI providers creates privacy and compliance risks. Prismatic's Ollama integration addresses this for sensitive operations, but the routing decision must be conscious and policy-driven.

Prompt brittleness: AI systems that depend on carefully crafted prompts are fragile. Small changes in prompt wording can produce dramatically different outputs. Systematic prompt testing and version control mitigate this risk.

Agent proliferation without governance: Creating AI agents is easy; governing them is hard. Without the AIAD standard's formal specification requirements, agent sprawl leads to duplicated capabilities, conflicting behaviors, and unmaintainable systems.

Use Cases

Automated code review and quality enforcement: AI agents analyze code changes for architectural violations, security vulnerabilities, performance regressions, and style inconsistencies. Prismatic's pre-commit pipeline leverages AI-assisted pattern detection.

OSINT intelligence gathering: AI processes and correlates data from 120+ OSINT sources across Czech registries, global providers, sanctions lists, and specialized databases. Natural language processing extracts structured intelligence from unstructured data.

Security posture assessment: AI-powered color team operations simulate attacks (Red), analyze defenses (Blue), and synthesize findings (Purple) to continuously evaluate and improve the platform's security posture.

Architecture decision support: AI assists in evaluating technology choices, identifying architectural risks, and generating Architecture Decision Records with structured analysis of alternatives.

Documentation generation: AI produces and maintains technical documentation, glossary entries, API documentation, and architectural descriptions, ensuring documentation stays current with code changes.

Anomaly detection and incident response: AI monitors system telemetry to detect anomalous patterns that may indicate security incidents, performance degradation, or configuration drift.

  • Agent -- Autonomous computational entity that perceives its environment and takes actions to achieve goals
  • LLM -- Large language models that serve as the reasoning engine for modern AI agents
  • Ollama -- Local AI inference platform enabling privacy-preserving model execution
  • AIAD -- AI Agent Definition standard for formal specification of AI agent capabilities and constraints
  • Prompt Engineering -- Discipline of crafting effective instructions for AI language models
  • Embedding -- Vector representations of text enabling semantic search and similarity computation
  • RAG -- Retrieval-Augmented Generation pattern for grounding AI responses in domain knowledge
  • Fine-Tuning -- Adapting pre-trained AI models to specific domains through additional training
  • NABLA Infinity -- Epistemic framework ensuring AI outputs meet evidence and consistency standards
  • Color Teams -- Six-team security operations structure leveraging AI for adversarial-defensive synthesis

See Also

  • Agents section -- Comprehensive catalog of Prismatic's 530+ AIAD agents
  • AIAD Standard -- Formal specification for AI agent definition and governance
  • Ollama documentation -- Configuration and usage of local AI inference
  • Anthropic Research -- https://www.anthropic.com/research -- Research publications on AI safety and capabilities
  • Stanford AI Index -- https://aiindex.stanford.edu/ -- Annual report on AI progress and adoption metrics

Connect & Contribute

Created by Tomas Korcak (korczis) | Open Source under GHL