Invoke Skills
This is a guide to running Skills in a development cluster.
Payload Considerations
Request Payloads
Fabric has a request limit of 500k for most API requests, including Skill invocation.
Payloads passed to jobs are limited to 100k, due to Kubernetes/OS limitations.
If larger payloads are required for Skills, it is recommended to upload the data to Managed Content because Managed Content limits are controlled by the datastore you have configured (e.g. S3, Minio).
Response Payloads
Fabric has a response limits of:
- Jobs: 100k (due to limitation in bash/OS)
- Daemons: 512k (For payload sizes over 512k Managed Content must be used)
Service message input
Whether you route a Skill's input to a daemon, job, or API, the input message structure sent to the action is always the same. Actions can also optionally return outputs in the form of service messages.
Skill input and output messages can only be processed as JSON.
Prerequisites
- Skills are built and saved/deployed.
- Service message has been developed and saved to a file.
- You are authenticated to the Fabric CLI in the context of a project. (To invoke a Skill from another project append the command with
--project project-name
)
List Skills and Skill Properties
To get a list of Skills in Console:
- Log in to Fabric Console.
- Select your Project at the top of the left panel. (Click the Project name to open a modal where you can select from a list of Projects.)
- Click Agents in the left panel to open the Agents list.
- Click the Skills tab to view a list of available Skills.
- Click the Skill name to view the Skill properties.
To get a list of Skills using the CLI:
Run the following command:
cortex skills list --project myProject
Response:
┌──────────────┬───────────────┬─────────────────┬─────────────┬────────────────────┐──────────┐
│ Name │ Title │ Description │ Modified │ Author │ Status |
├──────────────┼───────────────┼─────────────────┼─────────────┼────────────────────┤──────────┤
│ merge-test │ merge-test │ v6 job │ a month ago │ cortex@example.com │ Deployed |
├──────────────┼───────────────┼─────────────────┼─────────────┼────────────────────┤──────────┤
│ hubblejob │ hubble job │ get hubble data │ 2 months ago│ cortex@example.com │ Deployed |
├──────────────┼───────────────┼─────────────────┼─────────────┼────────────────────┼──────────┼To get the Skill properties run:
cortex skills describe skill-name --project project-name
Example
cortex skills describe hubblejob --project johan
Response
{
"camel": "1.0.0",
"name": "hubblejob",
"title": "Compute hubble data",
"description": "...",
"inputs": [
{
"name": "input",
"title": "input",
"routing": {
"all": {
"action": "hubblejob",
"output": "output",
"runtime": "cortex/jobs"
}
}
}
],
"outputs": [
{
"name": "output",
"title": "output"
}
],
"tags": [],
"properties": [],
"datasets": []
}
Filter the Skills List
If you have a large number of Skills you may find the Skill you are looking for more easily by filtering and modifying the list of Skills returned.
Details about using the CLI to filter, sort, limit, and skip in lists can be found on the Use CLI page.
Invoke skills with message parameters in the command line
Use the CLI to invoke Skills with parameters (key:value pairs) included in the command line:
cortex skills invoke skill_name input_name --params [params]
When parameters are expressed as part of the command line arguments, they are formatted as follows:
'{"payload":{"vara":"some valuea","varb":"some valueb","varc":"some valuec","vard":"some valued"}{"properties":{"propa":"valuea","propb":"valueb"}}}'
Example
Command
cortex skills invoke my-skill input-name --params '{"payload":{"vara":"some valuea","varb":"some valueb"}{"properties":{"propa":"valuea","propb":"valueb"}}}' --project my-project
Response
{ "success": true,
"activationId": "49f6c27c-727b-466c-8026-xxxxx"}
Invoke Skill with message parameters from a file
Use the CLI to invoke Skills with parameters (key:value pairs) save to a file as JSON:
cortex skills invoke skill_name service_name --params-file params-file-location/file-name
The parameters file must be formatted and saved as JSON:
{
"payload": {
"vara":"some valuea",
"varb":"some valueb",
}
"properties":{
"propa":"valuea",
"propb":"valueb",
}
}
Example
Command
cortex skills invoke my-skill my-input --params-file user/project/my-parameters-file.json --project my-project
Response
{ "success": true,
"activationId": "49f6c27c-727b-466c-8026-xxxxx"}
Parameters
This is a list of some of the common parameters you may want to specify for Skills when you are providing a json file (using the --json
parameter).
scalecount
: {required: false, type: number} - number of daemon instances to runjobtimeout
: {required: false, type: number} - the length of time to allow a job to run before stopping it (in seconds).podspec
: {required: false, type: string} - path to the podspec override filedeployStatus
: {required: true, type: string} - Set totrue
to display the deploy status when you query the response (withcortex skills list
orcortex skills describe skillName
)actionStatus
: {required: true, type: string} - Set totrue
to display the deploy status when you query the response (withcortex skills list
orcortex skills describe skillName
)
Use Secrets
Agents may use secrets which are expressed as properties as in the examples above. Secrets are configured in the Console or CLI.
To call a secret at runtime the secret must be applied to the Skill either by selecting the secret value in the Skill property panel in the Agent Composer and by adding the property to the skill.yaml
.
Agent and Skill logs
You can view the runtime logs of Agents and Skills. See the details about how to view logs on the Skill and Agent Logs page.