skillAgentMapper
Workspace API / services/skillAgentMapper
services/skillAgentMapper
Functions
getAgentKeyForSkill()
getAgentKeyForSkill(
skillKey,orgId):Promise<string|null>
Defined in: services/skillAgentMapper.ts:59
Get agent key for a skill
Lookup priority:
- Cache (if available)
- Database lookup (skills_agents table by skill_key or agent_key)
- Skill metadata (agent_key field)
- Fallback to skill_key as agent_key
Parameters
skillKey
string
Skill key to map
orgId
string
Organization ID for RLS context
Returns
Promise<string | null>
Agent key or null if no mapping found
getAgentKeyForSkillVersion()
getAgentKeyForSkillVersion(
skillVersion,orgId):Promise<string>
Defined in: services/skillAgentMapper.ts:148
Get agent key from skill version with full fallback chain
Lookup priority:
- Cache (if available)
- Database lookup (skills_agents table)
- Skill version metadata.agent_key
- Fallback to skill_key
Parameters
skillVersion
Skill version to get agent key for
orgId
string
Organization ID for RLS context
Returns
Promise<string>
Agent key
ensureAgentExists()
ensureAgentExists(
skillVersion,orgId):Promise<string>
Defined in: services/skillAgentMapper.ts:194
Ensure an agent exists for a skill version
If no agent exists in database and this is a VoltAgent skill, this will need to be created via the agent creation API.
For now, this is a validation check that returns the agent key and logs warnings if mapping is missing.
Parameters
skillVersion
Skill version to ensure agent for
orgId
string
Organization ID
Returns
Promise<string>
Agent key (may be fallback)
clearMappingCache()
clearMappingCache(
skillKey,orgId):void
Defined in: services/skillAgentMapper.ts:239
Clear cache entry for a skill
Used when agent mappings change (e.g., after agent publish/update)
Parameters
skillKey
string
orgId
string
Returns
void
clearAllMappingCache()
clearAllMappingCache():
void
Defined in: services/skillAgentMapper.ts:250
Clear entire mapping cache
Used for bulk operations or testing
Returns
void
getCacheStats()
getCacheStats():
object
Defined in: services/skillAgentMapper.ts:258
Get cache statistics (for monitoring)