Skip to main content

Knowledge and Agents

This feature is coming soon. This documentation describes the planned functionality for how Kodexa agents will interact with the Knowledge System.
Agents in Kodexa can both build and consume knowledge, creating a feedback loop where the system learns from documents and proposes configurations for human approval.

The Vision

Agents do the heavy lifting of discovering patterns and proposing configurations. Humans stay in control by reviewing and approving what goes into production.

Building Knowledge: Feature Discovery

When an agent processes documents, it may discover new entities that should be tracked as Knowledge Features.

The Flow

Example: New Vendor Discovery

  1. Agent processes invoice from “NewTech Solutions Inc.”
  2. Agent checks if a vendor feature with matching ID exists
  3. No match found - agent proposes new feature:
# Agent-proposed feature (status: pending_review)
featureType: vendor
status: pending_review
proposedBy: invoice-processing-agent
confidence: 0.92

properties:
  vendorId: "NTS-2024-001"  # Extracted from invoice

extendedProperties:
  displayName: "NewTech Solutions Inc."
  address: "123 Innovation Way, Austin, TX"
  extractedFrom: "invoice-2024-03-15-001.pdf"
  1. Human reviews the proposed feature in the Knowledge interface
  2. Human approves (or modifies and approves)
  3. Feature becomes active and available for linking

What Agents Extract

Agents can propose features based on:
  • Explicit data: Vendor names, customer IDs, document types
  • Inferred classifications: Language, document category, urgency
  • Patterns: Recurring entities across multiple documents

Consuming Knowledge: Intelligent Processing

Agents have access to all active knowledge and use it to make processing decisions.

The Flow

Example: Applying Extraction Rules

  1. Document arrives - classified as SEC 10K filing
  2. Agent queries Knowledge Sets matching “SEC Filing Type = 10K”
  3. Knowledge Set returns Items:
    • Use 10K-specific extraction prompt
    • Apply annual report validation rules
    • Route to SEC compliance queue
  4. Agent applies these configurations during processing

Proposing Knowledge Sets

The most powerful capability: agents can propose entire Knowledge Sets by observing patterns.

The Flow

Example: Pattern Discovery

Scenario: Agent notices that invoices from Vendor X frequently have validation exceptions for missing tax IDs, and users always override with the same justification. Agent proposes:
# Agent-proposed Knowledge Set
name: Vendor X Tax ID Exception
description: |
  Vendor X (Government Agency) is tax-exempt.
  Skip tax ID validation for their invoices.

status: pending_review
proposedBy: validation-analysis-agent
confidence: 0.88

evidence:
  - 47 invoices from Vendor X in past 90 days
  - 45 had tax ID validation overridden
  - Override reason consistently: "Government agency - tax exempt"

# Conditions
features:
  - featureTypeSlug: vendor
    properties:
      vendorId: "VENDOR-X-001"

# Actions
items:
  - itemType: validation-rule
    properties:
      ruleType: skip-field
      targetField: "vendor/tax_id"
      reason: "Government agency - tax exempt"
Human reviews:
  • Sees the evidence (47 invoices, consistent overrides)
  • Verifies the business logic makes sense
  • Approves the Knowledge Set
  • System now automatically skips tax ID validation for Vendor X

The Human-in-the-Loop Principle

All agent-created knowledge requires human approval before becoming active.

Why This Matters

AspectAgent RoleHuman Role
Pattern DetectionAnalyzes thousands of documentsReviews proposed patterns
Feature CreationExtracts and proposes entitiesValidates accuracy
Rule DiscoveryIdentifies correlationsConfirms business logic
ConfigurationProposes settingsApproves for production

Review Interface

The Knowledge interface shows:
  • Pending Features: Agent-proposed entities awaiting approval
  • Pending Sets: Agent-proposed rules awaiting approval
  • Evidence: Why the agent made the proposal
  • Confidence Score: Agent’s certainty level
  • Impact Preview: What would change if approved

Feedback Loop

Agents learn from human decisions: When humans:
  • Approve - Agent learns this pattern is valuable
  • Reject - Agent learns to avoid similar proposals
  • Modify - Agent learns the correct approach

Configuration

Enabling Agent Knowledge Building

# Assistant configuration
assistantDefinitionRef: kodexa/document-processing-assistant
options:
  knowledge:
    featureDiscovery: true      # Propose new features
    setProposal: true           # Propose knowledge sets
    confidenceThreshold: 0.75   # Minimum confidence to propose
    requireEvidence: true       # Must include evidence

Review Notifications

# Project configuration
notifications:
  knowledgePendingReview:
    enabled: true
    channels:
      - email
      - slack
    recipients:
      - [email protected]

Best Practices

1. Start with High Confidence Threshold

Begin with confidenceThreshold: 0.9 and lower as you trust the agent’s proposals.

2. Review Regularly

Don’t let pending items pile up. Regular review keeps the feedback loop active.

3. Document Rejections

When rejecting proposals, add notes so the pattern is understood:
# Rejection with feedback
status: rejected
rejectionReason: "This pattern only applies to Q4, not year-round"
rejectedBy: john.smith
rejectedAt: 2024-03-15T10:30:00Z

4. Use Staging Environment

Test agent knowledge building in staging before production:
# Development/staging only
options:
  knowledge:
    featureDiscovery: true
    setProposal: true
    autoActivate: false  # Never auto-activate, always review

Coming Soon

  • Batch Review: Review multiple proposals at once
  • Approval Workflows: Route proposals to specific reviewers
  • A/B Testing: Test proposed rules on subset before full activation
  • Confidence Trends: Track agent accuracy over time