- Model providers implemented as clients in api/app/clients/
- Clients inherit from BaseClient class
- Configuration handled through:
- librechat.yaml for endpoint config
- Environment variables for credentials
- Docker configuration for service setup
- AWS_ACCESS_KEY_ID: AWS access key for authentication
- AWS_SECRET_ACCESS_KEY: AWS secret key for authentication Note: Agent IDs are now fetched dynamically from AWS Bedrock
endpoints:
bedrockAgent:
- name: 'AWS Bedrock Agent'
agentId: '${AWS_BEDROCK_AGENT_ID}'
agentAliasId: '${AWS_BEDROCK_AGENT_ALIAS_ID}'
region: 'eu-central-1'
models:
default: ['bedrock-agent']
supported: ['bedrock-agent']
iconURL: '/assets/aws-bedrock.png'
modelDisplayLabel: 'AWS Bedrock Agent'
The BedrockAgentClient uses the following configuration:
- Region: eu-central-1 (configured in librechat.yaml)
- Credentials: Loaded from environment variables
- Agent Configuration:
- Agent ID: From AWS_BEDROCK_AGENT_ID
- Agent Alias ID: From AWS_BEDROCK_AGENT_ALIAS_ID
-
Core Features:
- Natural language understanding
- Task orchestration
- API action execution
- Knowledge base integration
- Memory/session management
-
API Components:
- bedrock-agent: Control plane for agent management
- bedrock-agent-runtime: Data plane for agent invocation
- Key commands:
- InvokeAgentCommand: Main chat interaction
- RetrieveAndGenerateCommand: Knowledge base queries
- GetAgentMemoryCommand: Session management
-
Streaming Support:
- Supported for orchestration prompts
- Response in bytes field of chunk object
- Session continuity via sessionId
- Limitations:
- Not supported for pre/post processing
- Limited with knowledge base + user input
-
Client Implementation (BedrockAgentClient):
- Location: api/app/clients/
- Extend BaseClient
- Key methods:
- constructor (AWS credentials, agent config)
- sendMessage (InvokeAgentCommand)
- getTokenCount (agent-specific counting)
- getCompletion (streaming support)
-
Configuration:
- librechat.yaml:
- Agent endpoint definition
- Model configuration
- Knowledge base settings
- Environment:
- AWS credentials
- Region configuration
- Agent/Knowledge Base IDs
- librechat.yaml:
-
Message Handling:
- Streaming response implementation
- Session management via sessionId
- Memory/context handling
- Error handling and retries
-
Frontend Updates:
- Model selection UI
- Agent configuration options
- Knowledge base integration UI
- Session management
-
Phase 1 - Basic Integration:
- Single agent support
- Basic chat functionality
- Streaming responses
- Session management
-
Phase 2 - Advanced Features:
- Knowledge base integration
- Multiple agent support
- Action group configuration
- Enhanced error handling
- Agent configuration format in librechat.yaml
- Token counting strategy for Bedrock
- Error handling and retry logic
- Frontend configuration options
- Testing and validation approach
-
Message Flow:
- User input captured in ChatForm.tsx
- Processed through useSubmitMessage hook
- Routed via useChatFunctions.ts
- Handled by appropriate client (BedrockAgentClient)
-
Provider Selection:
- ModelSelect.tsx renders provider-specific components
- useSelectMention.ts manages endpoint switching
- Conversation state tracked in conversation.ts
- Provider-specific settings in BedrockAgent.tsx
-
Routing Decision Flow:
- Based on conversation.endpoint and endpointType
- Validates endpoint configuration
- Checks agent availability
- Constructs appropriate payload
-
UI Context Management:
- Provider-specific components (BedrockAgent.tsx)
- Dynamic settings forms
- Real-time validation
- Session state tracking
- Define configuration schema
- Implement BedrockAgentClient
- Add streaming support
- Create frontend components
- Test and validate integration