Enrich Content
POST /api/agents/integrate/enrich
Enrich content with data from external sources.
Enhances provided content by fetching related information from external
knowledge sources. All configured sources fire in parallel. Sources that
cannot contribute (not yet implemented, timeout, no results) are
surfaced in failed_sources so the UI can show transparent state
rather than silently dropping sources.
Supported sources:
wikipedia— REST page-summary for the top extracted concept.academic— Parallel CrossRef + arXiv lookup, merged into one entry.news— Reserved; returns afailed_sourcesentry.social— Reserved; returns afailed_sourcesentry.
Process:
- Extract salient concepts from content via a lean keyword pass.
- Dedupe and cap the requested sources at
max_enrichments. - Fan out to all sources via
asyncio.gather. - Combine enrichments; stamp each with a bag-of-words relevance score.
- Return enrichments, entities, deduped sources-used, and failed sources.
Args: request: EnrichContentRequest with content and enrichment sources.
Returns:
EnrichContentResponse with enrichments, additional entities, and
success=True only if at least one source contributed.
Raises: HTTPException 503: Lagan API integrator not initialized.
Example:
POST /api/agents/discovery/integrate/enrich
{
"content": "The role of AI in modern healthcare...",
"enrichment_sources": ["wikipedia", "academic"],
"max_enrichments": 5
}Request Body required
Section titled “Request Body required ”Request to enrich content with external data.
Enriches provided content by fetching additional information from external sources and extracting additional entities.
Fields:
content: Content to enrich (required, non-empty)enrichment_sources: External sources to use for enrichment (required, non-empty)max_enrichments: Maximum number of enrichments to add (1-20, default 5)
Enrichment Sources:
wikipedia: Wikipedia data enrichmentacademic: Academic paper referencesnews: Recent news articlessocial: Social media mentions
Usage: Used to enrich content with external data and references.
Integration:
- IntegrationRoutes: Request validation for /integration/enrich endpoint
- LaganAgent: Content enrichment processing
object
Content to enrich
External sources to use for enrichment (e.g., ‘wikipedia’, ‘academic’)
Maximum number of enrichments to add
Responses
Section titled “ Responses ”Successful Response
Response with enriched content.
Provides enrichment data from external sources with additional entities and quality confidence scoring.
Fields:
success: True if at least one source contributed an enrichmentoriginal_content: Original content that was enrichedenrichments: List of enrichment entries (source, data, relevance)enriched_entities: Additional entities discovered through enrichmentsources_used: Deduplicated list of sources that successfully contributedfailed_sources: Sources that were requested but did not contribute (with reason)confidence: Enrichment quality confidence score (0.0-1.0)
Usage: Returned by content enrichment endpoints.
Integration:
- IntegrationRoutes: Response model for /integration/enrich endpoint
- Frontend: Enriched content display
object
True if at least one source contributed
Original content
Enrichment data from external sources
object
Additional entities found through enrichment
Extracted entity from content with type classification and confidence scoring.
Represents a named entity (person, place, organization, concept, etc.) extracted from analyzed content with confidence scoring and contextual information.
Fields:
name: Entity name or identifier as extracted from contententity_type: Classification type (person, place, organization, concept, etc.)confidence: Extraction confidence score from 0.0 to 1.0context: Surrounding text context where entity was found
Usage: Used in perception and research responses to return extracted entities.
Integration:
- WebpagePerceptionResponse: Entity list in perception results
- ResearchResult: Entities extracted from research results
- EnrichContentResponse: Additional entities from enrichment
External sources consulted
Requested sources that did not contribute, with reason
An enrichment source that failed or was skipped.
Surfaced in EnrichContentResponse.failed_sources so the UI can show
“not configured” / “not available” instead of the source silently
disappearing from the response.
object
Source name as requested (e.g., ‘academic’)
Reason the source did not contribute
Enrichment quality confidence
Validation Error