feat: add CLARITY subagent for Clarity Protocol integration#143
Closed
clarityprotocol wants to merge 1 commit intobio-xyz:mainfrom
Closed
feat: add CLARITY subagent for Clarity Protocol integration#143clarityprotocol wants to merge 1 commit intobio-xyz:mainfrom
clarityprotocol wants to merge 1 commit intobio-xyz:mainfrom
Conversation
Adds a third task type (CLARITY) to BioAgents deep research, enabling BIOS to query Clarity Protocol for protein fold predictions, clinical annotations, and AI agent findings when researching disease-linked protein variants. New files: - src/agents/clarity/index.ts — agent orchestrator - src/agents/clarity/api.ts — Clarity Protocol API client - src/agents/clarity/parser.ts — protein/variant extraction Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Greptile SummaryAdded CLARITY as a third task type to BioAgents deep research, enabling queries to Clarity Protocol for protein fold predictions, clinical annotations, and AI agent findings for disease-linked variants. Key Changes:
Implementation Quality:
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| src/agents/clarity/parser.ts | Regex-based parser for extracting protein name and variant from objectives; handles single amino acid substitutions |
| src/agents/clarity/api.ts | API client for Clarity Protocol with retry logic; uses flexible response parsing that could mask API changes |
| src/agents/clarity/index.ts | Main orchestrator that parses variants, queries Clarity API, and formats structured markdown output with graceful error handling |
| src/agents/planning/prompts.ts | Added CLARITY task type with descriptions and formatting guidelines across all planning prompts |
| src/routes/deep-research/start.ts | Integrated CLARITY task execution with error handling and state updates |
| src/services/queue/workers/deep-research.worker.ts | Added CLARITY task handling in worker process with consistent error handling |
Sequence Diagram
sequenceDiagram
participant User
participant Planning
participant DeepResearch
participant ClarityAgent
participant ClarityAPI
User->>Planning: Research protein variant (e.g., "SOD1 A4V")
Planning->>Planning: Generate CLARITY task
Planning->>DeepResearch: Execute CLARITY task
DeepResearch->>ClarityAgent: clarityAgent({objective})
ClarityAgent->>ClarityAgent: parseVariantFromObjective()
Note over ClarityAgent: Extract protein name & variant<br/>(e.g., "SOD1" + "A4V")
ClarityAgent->>ClarityAPI: searchVariants(protein)
ClarityAPI-->>ClarityAgent: variants[]
ClarityAgent->>ClarityAgent: Match variant by name
par Parallel API Calls
ClarityAgent->>ClarityAPI: getVariantDetail(foldId)
ClarityAPI-->>ClarityAgent: detail (pLDDT scores, AI summary)
ClarityAgent->>ClarityAPI: getFindings(foldId)
ClarityAPI-->>ClarityAgent: findings[] (agent research)
ClarityAgent->>ClarityAPI: getAnnotations(foldId)
ClarityAPI-->>ClarityAgent: annotations[]
ClarityAgent->>ClarityAPI: getClinicalData(gene, variant)
ClarityAPI-->>ClarityAgent: clinical (ClinVar, gnomAD)
end
ClarityAgent->>ClarityAgent: formatClarityOutput()
Note over ClarityAgent: Build structured markdown<br/>with all data sections
ClarityAgent-->>DeepResearch: {output, reasoning}
DeepResearch-->>User: Formatted Clarity Protocol data
Last reviewed commit: 46ce6e1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CLARITY) to BioAgents deep research, enabling BIOS to query Clarity Protocol for protein fold predictions, clinical annotations, and AI agent findings when researching disease-linked protein variantssrc/agents/clarity/with API client, variant parser, and orchestratorWhat it does
When BIOS researches a protein variant (e.g., SOD1 A4V, tau P301L), the planning agent can now generate CLARITY tasks alongside LITERATURE and ANALYSIS tasks. The clarity agent:
Config
CLARITY_API_URL=https://clarityprotocol.io/api/v1 CLARITY_API_KEY= # Optional, for higher rate limitsTest plan