Easily add custom actions for your Credal Copilots. Read more about Credal's Agent platform here.
- Add or update the action in
src/actions/schema.yaml
- Run
npm run generate:types
to generate the new types - Run
npm run prettier-format
to format the new files - Create a new provider function in
src/actions/providers/<provider>/<action>.ts
(eg.src/actions/providers/math/add.ts
) which exports a function using the generated types - If adding a new action or provider, update
src/actions/actionMapper.ts
andsrc/actions/groups.ts
. - In
package.json
, bump the version number. - Run
npm publish --access public
to publish the new version to npm. (Need to be logged in vianpm login
)
Invoking an action:
import { runAction } from "@credal/actions";
const result = await runAction(
"listConversations",
"slack",
{ authToken: "xoxb-..." },
{}
);
npx ts-node -r tsconfig-paths/register --project tsconfig.json tests/testRunMathAction.ts