Installation
The Python SDK requires Python 3.8+ and provides both synchronous and asynchronous interfaces.
FastSkillService
The main service class that provides access to all FastSkill functionality.Constructor
Lifecycle Methods
Initialize the service and load all components. Must be called before using other methods.
Gracefully shut down the service and clean up resources. Should be called when done.
Restart the service with the same configuration. Useful for hot reloading scenarios.
Skill Management Methods
Register a new skill with the service.Parameters:
skill_definition(dict): Skill definition following the FastSkill schema
str - The registered skill IDExample:Update an existing skill.Parameters:
skill_id(str): ID of the skill to updateupdates(dict): Fields to update
bool - Success statusDelete a skill from the service.Parameters:
skill_id(str): ID of the skill to delete
bool - Success statusGet detailed information about a specific skill.Parameters:
skill_id(str): ID of the skill
dict - Skill definition or None if not foundList all registered skills with optional filtering and sorting.Parameters:
filters(dict): Filter criteriasort(dict): Sort optionspage(int): Page number (1-based)page_size(int): Number of items per page
dict - Paginated results with data and metadataEnable a disabled skill.Parameters:
skill_id(str): ID of the skill to enable
bool - Success statusDisable an active skill.Parameters:
skill_id(str): ID of the skill to disable
bool - Success statusDiscovery Methods
Discover skills relevant to a query using natural language processing.Parameters:
query(str): Search querylimit(int): Maximum number of results
list - List of relevant skillsFind skills that provide a specific capability.Parameters:
capability(str): Capability to search forlimit(int): Maximum number of results
list - List of matching skillsFind skills with a specific tag.Parameters:
tag(str): Tag to search forlimit(int): Maximum number of results
list - List of matching skillsFind skills by a specific author.Parameters:
author(str): Author name to search forlimit(int): Maximum number of results
list - List of matching skillsTool Service
Access tool-related functionality through the tool service.Tool Discovery
Get all available tools with optional filtering.Parameters:
filters(dict): Filter criteria for tools
list - List of available toolsGet detailed information about a specific tool.Parameters:
tool_id(str): ID of the tool
dict - Tool details including parameters and capabilitiesFind tools that provide a specific capability.Parameters:
capability(str): Capability to search for
list - List of matching toolsFind tools with a specific tag.Parameters:
tag(str): Tag to search for
list - List of matching toolsTool Execution
Execute a specific tool.Parameters:
skill_id(str): ID of the skill containing the tooltool_name(str): Name of the tool to executeparameters(dict): Parameters for the tool executionexecution_options(dict): Additional execution options
dict - Execution results and metadataExecute multiple tools in batch.Parameters:
operations(list): List of tool operations to executeconcurrent(bool): Whether to execute operations concurrently
list - List of execution resultsValidate parameters for a tool before execution.Parameters:
skill_id(str): ID of the skilltool_name(str): Name of the toolparameters(dict): Parameters to validate
dict - Validation resultsRouting Service
Access intelligent routing functionality.Find the most relevant skills for a query using intelligent routing.Parameters:
query(str): Search querycontext(dict): Additional context for routinglimit(int): Maximum number of results
list - Ranked list of relevant skillsFind relevant skills with detailed context information.Parameters:
query(str): Search querycontext(dict): Execution context and constraintslimit(int): Maximum number of results
list - Skills with relevance scores and metadataSubmit feedback on routing decisions for learning.Parameters:
feedback_data(dict): Feedback information including query, selected skill, and results
bool - Success statusGet routing performance metrics and analytics.Returns:
dict - Routing performance dataLoading Service
Access progressive loading functionality.Load metadata for specific skills.Parameters:
skill_ids(list): List of skill IDs to load metadata for
list - Skill metadataLoad full content for specific skills.Parameters:
skill_ids(list): List of skill IDs to load content for
list - Full skill contentPreload skills at a specific content level.Parameters:
skill_ids(list): List of skill IDs to preloadcontent_level(str): Level of content to preload (‘metadata’ or ‘full’)
bool - Success statusGet cache performance statistics.Returns:
dict - Cache performance metricsClear the loading cache.Parameters:
cache_type(str): Type of cache to clear (‘metadata’, ‘content’, or ‘all’)
bool - Success statusEvent System
Subscribe to and publish events.Subscribe to events matching a pattern.Parameters:
event_pattern(str): Event pattern to match (supports wildcards)handler(callable): Function to handle matching events
str - Subscription IDUnsubscribe from events.Parameters:
subscription_id(str): ID of the subscription to cancel
bool - Success statusPublish an event to all subscribers.Parameters:
event_type(str): Type of eventevent_data(dict): Event data payload
int - Number of subscribers notifiedGet event history.Parameters:
event_type(str): Type of events to retrievelimit(int): Maximum number of events to return
list - List of historical eventsConfiguration Classes
ServiceConfig
Main configuration class for the FastSkill service.Path to the skill storage directory.
Default timeout for skill execution in seconds.
Maximum memory per skill execution in MB.
Enable automatic reloading of skills when files change.
Enable detailed audit logging.
Logging level (ERROR, WARN, INFO, DEBUG, TRACE).
Size of the metadata cache.
Enable performance metrics collection.
ExecutionConfig
Configuration for skill execution.Default timeout for skill execution.
Maximum memory per execution.
Maximum CPU usage percentage.
Allow network access in skill execution.
Sandboxing level (none, basic, strict).
CacheConfig
Configuration for caching behavior.Number of skill metadata entries to cache.
Number of full skill content entries to cache.
Cache entry time-to-live in seconds.
Persist cache to disk.
Error Handling
Exception Types
Base exception class for all FastSkill errors.
Raised when skill definitions or parameters are invalid.
Raised when skill execution fails.
Raised when service-level operations fail.
Raised when skill discovery operations fail.
Raised when configuration is invalid.
Error Handling Patterns
Advanced Usage
Custom Service Configuration
Service Health Monitoring
Event-Driven Architecture
Performance Optimization
Connection Pooling
Async Best Practices
Testing with SDK
Unit Testing
Integration Testing
Always call
await service.shutdown() in your tests to properly clean up resources and avoid resource leaks.