Skip to main content

Overview

Agents

Processing components that perform specific actions in document generation workflows. Agents can be:
  • Built-in agents: Pre-configured agents for common tasks (search, analysis, formatting)
  • Custom agents: User-defined agents with specific instructions and outputs

Connectors

Specialized tools that give agents access to data-specific tools and functions. Connectors enable agents to:
  • Interpret different document types within the generation pipeline
  • Access external systems and databases
  • Apply specific rules and functions to data processing
Important: Connectors operate after document ingestion and help the system understand various data types available to agents.

Connector Management

Create Connector

Endpoint
POST /connectors
Headers
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Request Body
{
  "name": "LIMSConnector",
  "sourceType": "database",
  "description": "Laboratory Information Management System connector",
  "config": {
    "auth_type": "oauth",
    "client_id": "your_client_id",
    "client_secret": "your_client_secret",
    "token_url": "https://lims.company.com/oauth/token",
    "api_endpoint": "https://lims.company.com/api/v1"
  },
  "functions": [
    "extract_lab_results",
    "map_specimen_data",
    "validate_test_parameters"
  ],
  "rules": [
    "Only process results with status 'completed'",
    "Map sample IDs to patient identifiers",
    "Validate date formats as ISO 8601"
  ]
}
Request Parameters
FieldTypeRequiredDescription
nameStringYesHuman-readable connector name
sourceTypeStringYesType of data source: “database” or “document”
descriptionStringNoConnector description and purpose
configObjectNoConfiguration including authentication credentials
functionsArray[String]NoList of functions the connector provides to agents
rulesArray[String]NoProcessing rules and constraints
Supported Source Types
  • database: Connects to external databases and data systems
  • document: Processes specific document formats and structures
Authentication Types in Config
// OAuth 2.0
{
  "auth_type": "oauth",
  "client_id": "your_client_id",
  "client_secret": "your_client_secret",
  "token_url": "https://api.example.com/oauth/token",
  "scope": "read:data"
}

// API Key
{
  "auth_type": "api_key",
  "api_key": "your_api_key",
  "key_header": "X-API-Key"
}

// Basic Authentication
{
  "auth_type": "basic",
  "username": "your_username",
  "password": "your_password"
}
Example Request
curl -X POST "https://api.artosai.com/connectors" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ClinicalTrialConnector",
    "sourceType": "database",
    "description": "Connects to clinical trial management system",
    "config": {
      "auth_type": "api_key",
      "api_key": "ctms_12345",
      "api_endpoint": "https://ctms.company.com/api"
    },
    "functions": [
      "extract_patient_data",
      "map_study_protocols",
      "validate_eligibility_criteria"
    ],
    "rules": [
      "Only access patients with signed consent",
      "Anonymize all patient identifiers",
      "Validate protocol compliance"
    ]
  }'
Success Response (201 Created)
{
  "id": "conn-abc123def456",
  "name": "ClinicalTrialConnector",
  "sourceType": "database",
  "status": "created",
  "created_at": "2024-01-15T10:30:00Z",
  "created_by": "user-xyz789"
}

List All Connectors

Endpoint
GET /connectors
Headers
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Query Parameters
ParameterTypeRequiredDescription
limitIntegerNoResults per page (default: 20, max: 100)
offsetIntegerNoNumber of results to skip (default: 0)
statusStringNoFilter by status
Example Request
curl -X GET "https://api.artosai.com/connectors?sourceType=database" \
  -H "Authorization: Bearer your-access-token"
Success Response (200 OK)
[
  {
    "id": "conn-abc123def456",
    "name": "ClinicalTrialConnector",
    "sourceType": "database",
    "description": "Connects to clinical trial management system",
    "status": "active",
    "created_at": "2024-01-15T10:30:00Z",
    "created_by": "user-xyz789",
    "last_used": "2024-01-15T14:22:00Z",
    "usage_count": 15,
    "functions": [
      "extract_patient_data",
      "map_study_protocols",
      "validate_eligibility_criteria"
    ],
    "rules": [
      "Only access patients with signed consent",
      "Anonymize all patient identifiers",
      "Validate protocol compliance"
    ]
  },
  {
    "id": "conn-preset-fda-001",
    "name": "FDA Regulatory Connector",
    "sourceType": "document",
    "description": "Processes FDA regulatory documents and submissions",
    "status": "preset",
    "created_at": "2024-01-10T09:00:00Z",
    "created_by": "system",
    "last_used": "2024-01-15T16:45:00Z",
    "usage_count": 127,
    "functions": [
      "parse_regulatory_sections",
      "extract_submission_data",
      "validate_compliance_requirements"
    ],
    "rules": [
      "Follow FDA formatting guidelines",
      "Maintain regulatory traceability",
      "Ensure section completeness"
    ]
  }
]

Get Specific Connector

Endpoint
GET /connectors/{connectorId}
Path Parameters
ParameterTypeRequiredDescription
idStringYesConnector ID
Example Request
curl -X GET "https://api.artosai.com/connectors/conn-abc123def456" \
  -H "Authorization: Bearer your-access-token"
Success Response (200 OK)
{
  "id": "conn-abc123def456",
  "name": "ClinicalTrialConnector",
  "sourceType": "database",
  "description": "Connects to clinical trial management system",
  "status": "active",
  "config": {
    "auth_type": "api_key",
    "api_endpoint": "https://ctms.company.com/api",
    "connection_timeout": 30
  },
  "functions": [
    "extract_patient_data",
    "map_study_protocols", 
    "validate_eligibility_criteria"
  ],
  "rules": [
    "Only access patients with signed consent",
    "Anonymize all patient identifiers",
    "Validate protocol compliance"
  ],
  "created_at": "2024-01-15T10:30:00Z",
  "created_by": "user-xyz789",
  "last_updated": "2024-01-15T12:15:00Z",
  "last_used": "2024-01-15T14:22:00Z",
  "usage_count": 15,
  "connected_pipelines": 3
}

Update Connector

Endpoint
PUT /connectors/{connectorId}
Path Parameters
ParameterTypeRequiredDescription
idStringYesConnector ID
Request Body Same format as create connector request. Example Request
curl -X PUT "https://api.artosai.com/connectors/conn-abc123def456" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Enhanced ClinicalTrialConnector",
    "sourceType": "database",
    "description": "Enhanced connector with additional validation rules",
    "config": {
      "auth_type": "oauth",
      "client_id": "updated_client_id",
      "client_secret": "updated_secret",
      "token_url": "https://ctms.company.com/oauth/token"
    },
    "functions": [
      "extract_patient_data",
      "map_study_protocols",
      "validate_eligibility_criteria",
      "generate_safety_reports"
    ],
    "rules": [
      "Only access patients with signed consent",
      "Anonymize all patient identifiers", 
      "Validate protocol compliance",
      "Generate audit trail for all actions"
    ]
  }'
Success Response (200 OK)
{
  "id": "conn-abc123def456",
  "name": "Enhanced ClinicalTrialConnector",
  "status": "updated",
  "updated_at": "2024-01-15T15:30:00Z",
  "version": 2
}

Delete Connector

Endpoint
DELETE /connectors/{connectorId}
Path Parameters
ParameterTypeRequiredDescription
idStringYesConnector ID
⚠️ Warning Deleting a connector will impact all pipelines that use this connector. Ensure no active pipelines depend on this connector before deletion. Example Request
curl -X DELETE https://api.artosai.com/connectors/conn_abc123def456 \
  -H "Authorization: Bearer YOUR_API_KEY"
Success Response (200 OK)
{
  "success": true,
  "message": "Connector deleted successfully"
}

Test Connector

Endpoint
POST /connectors/{connectorId}/test
Path Parameters
ParameterTypeRequiredDescription
idStringYesConnector ID
Example Request
curl -X POST https://api.artosai.com/connectors/conn_abc123def456/test \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "testData": {
      "data": [
        {"id": 1, "name": "Test Item", "value": 100.5},
        {"id": 2, "name": "Test Item 2", "value": 200.3}
      ],
      "format": "json"
    },
    "expectedOutput": {
      "processedRows": 2,
      "validationPassed": true
    }
  }'
Success Response (200 OK)
{
  "testId": "test_xyz789",
  "status": "passed",
  "results": {
    "processedRows": 2,
    "validationPassed": true,
    "processingTime": 0.5,
    "accuracy": 1.0
  },
  "details": {
    "agentSelection": ["data_validator", "table_processor"],
    "executionPath": "optimal",
    "performanceMetrics": {
      "latency": "0.5s",
      "throughput": "4 rows/s"
    }
  }
}
```\n\n## Agent Framework

### List Available Agents

**Endpoint**

GET /agents

**Headers**

Authorization: Bearer YOUR_API_KEY Content-Type: application/json

**Query Parameters**

| Parameter    | Type   | Required | Description                                             |
| ------------ | ------ | -------- | ------------------------------------------------------- |
| `type`       | String | No       | Filter by agent type: "builtin" or "custom"             |
| `category`   | String | No       | Filter by category (search, analysis, formatting, etc.) |
| `created_by` | String | No       | Filter by creator (for custom agents)                   |

**Example Request**

```bash
curl -X GET "https://api.artosai.com/agents?type=builtin" \
  -H "Authorization: Bearer your-access-token"
Success Response (200 OK)
[
  {
    "id": "agent-search-001",
    "name": "Document Search Agent",
    "type": "builtin",
    "category": "search",
    "description": "Searches and retrieves relevant passages from ingested documents",
    "capabilities": [
      "semantic_search",
      "keyword_matching",
      "relevance_ranking"
    ],
    "output_formats": ["text", "json"],
    "version": "1.2.0",
    "created_by": "system"
  },
  {
    "id": "agent-mapping-002",
    "name": "Data Mapping Agent",
    "type": "builtin",
    "category": "analysis",
    "description": "Maps data tables to document sections and structures",
    "capabilities": [
      "table_extraction",
      "section_mapping",
      "data_validation"
    ],
    "output_formats": ["html", "json"],
    "version": "1.1.0",
    "created_by": "system"
  },
  {
    "id": "agent-qc-003",
    "name": "Quality Control Agent",
    "type": "builtin",
    "category": "validation",
    "description": "Performs quality checks on generated content",
    "capabilities": [
      "content_validation",
      "consistency_checking",
      "compliance_verification"
    ],
    "output_formats": ["text", "html"],
    "version": "1.0.0",
    "created_by": "system"
  },
  {
    "id": "agent-custom-001",
    "name": "CustomAgent",
    "type": "builtin",
    "category": "custom",
    "description": "Configurable agent that executes user-defined instructions",
    "capabilities": [
      "custom_instructions",
      "flexible_processing",
      "user_defined_logic"
    ],
    "output_formats": ["text", "html", "markdown"],
    "version": "2.0.0",
    "created_by": "system"
  },
  {
    "id": "agent-user-custom-123",
    "name": "Regulatory Parser",
    "type": "custom",
    "category": "analysis",
    "description": "Custom agent for parsing regulatory documents",
    "capabilities": [
      "regulatory_parsing",
      "compliance_extraction"
    ],
    "output_formats": ["html"],
    "version": "1.0.0",
    "created_by": "user-xyz789",
    "created_at": "2024-01-15T11:00:00Z"
  }
]

Get Specific Agent

Endpoint
GET /agents/{agentId}
Path Parameters
ParameterTypeRequiredDescription
agentIdStringYesAgent ID
Example Response
{
  "id": "agent-search-001",
  "name": "Document Search Agent",
  "type": "builtin",
  "category": "search",
  "description": "Searches and retrieves relevant passages from ingested documents",
  "capabilities": [
    "semantic_search",
    "keyword_matching",
    "relevance_ranking"
  ],
  "output_formats": ["text", "json"],
  "version": "1.2.0",
  "created_by": "system",
  "usage_count": 1247,
  "last_used": "2024-01-15T14:30:00Z",
  "compatible_connectors": [
    "conn-preset-fda-001",
    "conn-abc123def456"
  ]
}

Create Custom Agent

Endpoint
POST /agents
Headers
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Request Body
{
  "name": "RegDocParser",
  "description": "Custom agent for parsing regulatory documents and extracting key information",
  "category": "analysis",
  "instructions": "Parse regulatory documents to extract approval dates, indication statements, and safety warnings. Format output as structured HTML with clear section headers.",
  "output_format": "html"
}
Request Parameters
FieldTypeRequiredDescription
nameStringYesHuman-readable agent name
descriptionStringYesAgent description and purpose
categoryStringNoAgent category (analysis, formatting, validation, etc.)
instructionsStringYesDetailed instructions for agent behavior
output_formatStringYesOutput format: “text”, “html”, or “markdown”
Example Request
curl -X POST "https://api.artosai.com/agents" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Safety Report Analyzer",
    "description": "Analyzes clinical trial safety data and generates summary reports",
    "category": "analysis",
    "instructions": "Review safety data from clinical trials and generate a comprehensive summary including adverse events, serious adverse events, and safety signal analysis. Present findings in structured HTML format with tables for quantitative data.",
    "output_format": "html"
  }'
Success Response (201 Created)
{
  "id": "agent-user-custom-456",
  "name": "Safety Report Analyzer",
  "type": "custom",
  "status": "created",
  "created_at": "2024-01-15T12:00:00Z",
  "created_by": "user-xyz789"
}

Update Agent

Endpoint
PUT /agents/{agentId}
Path Parameters
ParameterTypeRequiredDescription
agentIdStringYesAgent ID
Request Body Same format as create agent request. Note: Only custom agents created by the user can be updated. Built-in agents cannot be modified. Example Request
curl -X PUT "https://api.artosai.com/agents/agent-user-custom-456" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Enhanced Safety Report Analyzer",
    "description": "Enhanced analyzer with additional statistical analysis capabilities",
    "category": "analysis",
    "instructions": "Review safety data from clinical trials and generate comprehensive summaries including adverse events, serious adverse events, safety signal analysis, and statistical significance testing. Include comparative analysis against historical controls when available.",
    "output_format": "html"
  }'
Success Response (200 OK)
{
  "id": "agent-user-custom-456",
  "name": "Enhanced Safety Report Analyzer",
  "status": "updated",
  "updated_at": "2024-01-15T13:00:00Z",
  "version": 2
}

Delete Agent

Endpoint
DELETE /agents/{agentId}
Path Parameters
ParameterTypeRequiredDescription
agentIdStringYesAgent ID
Note: Only custom agents created by the user can be deleted. Built-in agents cannot be removed. Example Request
curl -X DELETE "https://api.artosai.com/agents/agent-user-custom-456" \
  -H "Authorization: Bearer your-access-token"
Success Response (200 OK)
{
  "message": "Agent successfully deleted",
  "agentId": "agent-user-custom-456",
  "deleted_at": "2024-01-15T16:30:00Z",
  "affected_pipelines": [
    "pipeline-789"
  ]
}

Call Agent Directly

Execute an agent outside of a pipeline for testing or standalone processing. Endpoint
POST /agents/{agentId}/call
Path Parameters
ParameterTypeRequiredDescription
agentIdStringYesAgent ID
Headers
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Request Body
{
  "documentUrls": [
    "s3://your-bucket/ingested/doc-123/clinical-protocol.docx",
    "s3://your-bucket/ingested/doc-456/safety-data.csv"
  ],
  "instructions": "Focus on extraction of primary endpoints and safety measures"
}
Request Parameters
FieldTypeRequiredDescription
documentUrlsArray[String]YesS3 URLs of ingested documents to process
instructionsStringNoAdditional instructions for this specific call
Example Request
curl -X POST "https://api.artosai.com/agents/agent-search-001/call" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{
    "documentUrls": [
      "s3://your-bucket/ingested/doc-123/protocol.docx"
    ],
    "instructions": "Extract all mentions of primary and secondary endpoints"
  }'
Success Response (200 OK)
{
  "result": {
    "output": "Primary Endpoint: The primary endpoint is overall survival (OS) defined as time from randomization to death from any cause. Secondary Endpoints: 1) Progression-free survival (PFS), 2) Objective response rate (ORR), 3) Duration of response (DOR), 4) Quality of life measures using EORTC QLQ-C30.",
    "format": "text",
    "processing_time_seconds": 12.5,
    "documents_processed": 1,
    "connectors_used": [
      "conn-preset-fda-001"
    ]
  },
  "agent_id": "agent-search-001",
  "execution_id": "exec-abc123def456",
  "timestamp": "2024-01-15T14:45:00Z"
}

CustomAgent Usage

The CustomAgent is a special built-in agent that allows users to define their own processing logic through instructions.

Using CustomAgent in Pipelines

When creating a pipeline with CustomAgent:
{
  "name": "Custom Processing Pipeline",
  "agentIds": ["agent-search-001", "agent-custom-001", "agent-qc-003"],
  "order": [1, 2, 3],
  "customAgentInstructions": {
    "agent-custom-001": {
      "instructions": "Take the search results and format them into a regulatory submission format following FDA guidelines. Include all required sections and ensure proper citations.",
      "output_format": "html"
    }
  },
  "documents": ["doc-123", "doc-456"],
  "id": "conn-regulatory-001",
  "outputFileName": "regulatory-submission.docx"
}

CustomAgent Direct Call

curl -X POST "https://api.artosai.com/agents/agent-custom-001/call" \
  -H "Authorization: Bearer your-access-token" \
  -H "Content-Type: application/json" \
  -d '{
    "documentUrls": ["s3://bucket/doc.docx"],
    "instructions": "Extract all safety data and create a summary table showing adverse events by severity and frequency. Output as HTML with proper table formatting."
  }'

Permission-Based Sharing

Admin Sharing (Admin Users Only)

Administrators can make their custom agents and connectors visible to all users in the organization: Share Agent
POST /agents/{agentId}/share
Example Request
curl -X POST "https://api.artosai.com/agents/agent-user-custom-456/share" \
  -H "Authorization: Bearer admin-access-token" \
  -H "Content-Type: application/json" \
  -d '{"scope": "organization"}'
Share Connector
POST /connectors/{id}/share
Example Request
curl -X POST "https://api.artosai.com/connectors/conn-abc123def456/share" \
  -H "Authorization: Bearer admin-access-token" \
  -H "Content-Type: application/json" \
  -d '{"scope": "organization"}'

Visibility Rules

  • Regular Users: See only their own custom agents/connectors plus built-in/preset ones
  • Admin Users: See all agents/connectors in the organization
  • Shared Items: Custom items shared by admins are visible to all organization members

Error Handling

Common Error Codes

Error CodeHTTP StatusDescriptionResolution
CONNECTOR_NOT_FOUND404Connector ID does not existVerify connector ID and permissions
AGENT_NOT_FOUND404Agent ID does not existVerify agent ID and availability
INVALID_CONNECTOR_CONFIG400Connector configuration is invalidCheck authentication credentials and config format
AGENT_EXECUTION_FAILED500Agent failed during executionCheck agent instructions and input documents
MISSING_CREDENTIALS401Connector authentication failedVerify and update authentication credentials
INSUFFICIENT_PERMISSIONS403User lacks permission for operationContact admin or check user permissions
INVALID_DOCUMENT_URL400Document URL is not accessibleEnsure document is properly ingested
CUSTOM_AGENT_LIMIT_EXCEEDED400Too many custom agents (deprecated - no limits)N/A
CONNECTOR_IN_USE409Cannot delete connector used by active pipelinesRemove connector from pipelines first

Error Response Format

{
  "error_code": "INVALID_CONNECTOR_CONFIG",
  "message": "The connector configuration contains invalid authentication parameters",
  "details": {
    "field": "config.client_secret",
    "issue": "Missing required OAuth client secret",
    "valid_auth_types": ["oauth", "api_key", "basic"]
  },
  "resolution": "Provide valid OAuth credentials or change to a different authentication type",
  "request_id": "req-abc123def456"
}

Specific Error Scenarios

Invalid Connector ID
{
  "error_code": "CONNECTOR_NOT_FOUND",
  "message": "The specified connector could not be found",
  "details": {
    "connector_id": "conn-nonexistent",
    "user_id": "user-xyz789"
  },
  "resolution": "Verify the connector ID exists and you have permission to access it"
}
Agent Execution Failure
{
  "error_code": "AGENT_EXECUTION_FAILED", 
  "message": "Agent failed to process the provided documents",
  "details": {
    "agent_id": "agent-custom-001",
    "execution_id": "exec-failed-123",
    "error_stage": "document_processing",
    "error_details": "Unable to parse document structure"
  },
  "resolution": "Check document format and agent instructions. Consider using a different agent or simplifying the task."
}
Missing Credentials
{
  "error_code": "MISSING_CREDENTIALS",
  "message": "Connector authentication failed due to missing or invalid credentials",
  "details": {
    "connector_id": "conn-abc123",
    "auth_type": "oauth",
    "missing_fields": ["client_secret"]
  },
  "resolution": "Update connector configuration with valid OAuth credentials"
}

Best Practices

Connector Management

  1. Use descriptive names that clearly indicate the connector’s purpose
  2. Test authentication before using connectors in production pipelines
  3. Keep credentials secure and rotate them regularly
  4. Document functions and rules thoroughly for team collaboration
  5. Monitor usage to identify unused connectors

Agent Development

# Example: Testing custom agents before pipeline integration
import requests

class AgentTester:
    def __init__(self, base_url, access_token):
        self.base_url = base_url
        self.access_token = access_token
        self.headers = {
            'Authorization': f'Bearer {access_token}',
            'Content-Type': 'application/json'
        }
    
    def test_custom_agent(self, agent_config, test_documents):
        """Test custom agent with sample documents"""
        try:
            # Create agent
            response = requests.post(
                f"{self.base_url}/agents",
                headers=self.headers,
                json=agent_config
            )
            response.raise_for_status()
            agent_id = response.json()['id']
            
            # Test with documents
            test_response = requests.post(
                f"{self.base_url}/agents/{agent_id}/call",
                headers=self.headers,
                json={"documentUrls": test_documents}
            )
            test_response.raise_for_status()
            
            result = test_response.json()
            print(f"Agent test successful: {result['result']['output'][:100]}...")
            
            return agent_id, result
            
        except requests.RequestException as e:
            print(f"Agent test failed: {e}")
            raise
    
    def cleanup_test_agent(self, agent_id):
        """Remove test agent after validation"""
        try:
            requests.delete(
                f"{self.base_url}/agents/{agent_id}",
                headers=self.headers
            )
            print(f"Test agent {agent_id} cleaned up")
        except Exception as e:
            print(f"Cleanup warning: {e}")

# Usage
tester = AgentTester("https://api.artosai.com", "your-token")

agent_config = {
    "name": "Test Safety Analyzer",
    "description": "Test agent for safety data analysis",
    "instructions": "Extract and summarize safety information from clinical documents",
    "output_format": "html"
}

test_docs = ["s3://bucket/test-doc.docx"]
agent_id, result = tester.test_custom_agent(agent_config, test_docs)

# If successful, use in production; otherwise cleanup
if result['result']['output']:
    print("Agent ready for production use")
else:
    tester.cleanup_test_agent(agent_id)

Integration Patterns

Agent-Connector Workflow
// Example: Building a complete processing workflow
class DocumentProcessor {
    constructor(apiClient) {
        this.api = apiClient;
    }
    
    async setupProcessingWorkflow() {
        // 1. Create specialized connector
        const connector = await this.api.createConnector({
            name: "ClinicalDataConnector",
            sourceType: "database",
            config: {
                auth_type: "oauth",
                client_id: "clinical_app_id",
                client_secret: "clinical_secret",
                token_url: "https://clinical.company.com/oauth/token"
            },
            functions: [
                "extract_patient_demographics",
                "map_adverse_events",
                "validate_protocol_compliance"
            ]
        });
        
        // 2. Create custom analysis agent
        const agent = await this.api.createAgent({
            name: "Clinical Data Analyzer",
            description: "Analyzes clinical trial data with regulatory focus",
            instructions: `
                Analyze clinical trial data to generate regulatory-compliant summaries.
                Focus on:
                1. Patient demographics and baseline characteristics
                2. Efficacy outcomes and statistical significance
                3. Safety profile and adverse event analysis
                4. Protocol deviations and compliance
                
                Format output as structured HTML with clear sections and tables.
            `,
            output_format: "html"
        });
        
        // 3. Create pipeline combining them
        const pipeline = await this.api.createPipeline({
            name: "Clinical Analysis Pipeline",
            agentIds: ["agent-search-001", agent.id, "agent-qc-003"],
            order: [1, 2, 3],
            id: connector.id,
            documents: ["clinical-protocol-001", "patient-data-002"],
            outputFileName: "clinical-analysis-report.docx"
        });
        
        return {
            id: connector.id,
            agentId: agent.id,
            pipelineId: pipeline.pipelineId
        };
    }
}

Performance Optimization

  1. Connector Reuse: Design connectors to be reusable across multiple agents and pipelines
  2. Agent Specificity: Create focused agents for specific tasks rather than generic ones
  3. Testing Strategy: Always test agents individually before using in pipelines
  4. Error Handling: Implement robust error handling and retry logic
  5. Monitoring: Track agent and connector performance for optimization opportunities

Rate Limiting

Rate limits apply at the LLM level for agent execution: Agent Execution Limits
  • Direct agent calls: Subject to LLM provider rate limits
  • Pipeline execution: Rate limited by the underlying AI models
  • Custom agent creation: No specific limits
Rate Limit Headers
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200
X-RateLimit-Type: llm-tokens

Analytics Integration

Agent and connector usage is tracked for analytics purposes. Detailed analytics documentation is available in a separate API documentation page. Tracked Metrics Include:
  • Agent execution frequency and success rates
  • Connector usage patterns and performance
  • Error rates and failure patterns
  • Processing time and resource utilization
  • User adoption and feature usage