0.0.1-rc.75 • Published 4 months ago

@continual/sdk v0.0.1-rc.75

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

Copyright (c) 2024 Continual, Inc. All rights reserved.

Continual SDK

This package contains the Continual SDK.

Usage

To use the SDK, install it using your preferred package manager:

pnpm install @continual/sdk

To run the SDK, use the continual command:

npx continual --help

To create a custom agent, create a file like continual-agents.ts:

#!/usr/bin/env tsx
import { createContinualOpenAiModel, createTool, webserver } from "@continual/sdk";
import { z } from "zod";

// Optional: Define custom tools
const customTool = createTool({
  name: "exampleTool",
  description: "An example tool that does something useful",
  input: z.object({
    param1: z.string().describe("First parameter"),
    param2: z.number().describe("Second parameter"),
  }),
  output: z.string(),
  run: async function* ({ input }) {
    // Tool implementation
    return `Processed ${input.param1} and ${input.param2}`;
  },
});

// Set up the webserver with agents
webserver({
  agents: {
    myAgent: {
      model: createContinualOpenAiModel({ model: "gpt-4o" }),
      instructions: "You are a helpful assistant that provides clear and accurate information.",
      tools: {
        customTool,
        // You can add more tools here
      },
      chatGreetingMessage: "Hello! How can I help you today?",
    },
  },
});

Create a file that will register an MCP app in continual-apps.ts:

#!/usr/bin/env tsx
import { gmailApp, hubspotApp, notionApp, slackApp } from "/path/to/apps";
import { appserver, createContinualSDKClient } from "@continual/sdk";

appserver({
  apps: {
    gmail: {
      name: "Gmail",
      description: "A set of tools for interacting with Gmail. Requires OAuth2 authentication.",
      app: gmailApp,
    },
    hubspot: {
      name: "Hubspot",
      description: "A set of tools for interacting with Hubspot. Requires OAuth2 authentication.",
      app: hubspotApp,
    },
    notion: {
      name: "Notion",
      description: "A set of tools for interacting with Notion. Requires OAuth2 authentication.",
      app: notionApp,
    },
    slack: {
      name: "Slack",
      description: "A set of tools for interacting with Slack. Requires OAuth2 authentication.",
      app: slackApp,
    },
  },
  client: createContinualSDKClient(),
});

Before you run this, you need to set up the following environment variables. By default, the SDK will try to read these from your environment variables file in the .env file in your project root.

  • CONTINUAL_API_KEY: Your Continual API key.
  • CONTINUAL_API_URL: The URL of the Continual service. By default this is https://console.continual.ai/api.
  • CONTINUAL_SERVICE_URI: The URL of this service. This needs to be a URL that the Continual service can reach this service at. For deployment to production this needs to be a public URL. For development, you can use ngrok to create a public URL.
  • CONTINUAL_APP_SERVICE_URI: MCP apps are not served on the same port as the agents. This can be a different port on the same host as the above.

NOTE: by default, when running/deploying it will try to execute the following commands in parallel:

pnpm dlx tsx continual-agents.ts
pnpm dlx tsx continual-apps.ts

If you want to use different commands to run your service, you have 2 options:

  1. Set the CONTINUAL_AGENTS_EXECUTION_COMMAND and CONTINUAL_APPS_EXECUTION_COMMAND in your .env file
  2. Specify commands directly with the -c flag when deploying:
npx continual deploy -u -n my-custom-agent -c "pnpm dlx tsx my-custom-script.ts" -c "pnpm dlx tsx another-script.ts"

To deploy your service to a managed environment, use:

npx continual deploy -n my-custom-agent

This will package up your local directory (see additional options for the deploy command as well) and deploy to a managed environment.

If you want to run this locally (or in any other environment), you can use the command:

npx continual deploy -u -n my-custom-agent

This will run the service in "unmanaged mode", executing all commands in parallel. The process will properly handle interruption signals (Ctrl+C), ensuring all child processes are terminated gracefully.

Additionally if you want to not deploy the application but just the agent, you can use the command:

pnpm dlx tsx continual-agents.ts
0.0.1-rc.40

8 months ago

0.0.1-rc.42

8 months ago

0.0.1-rc.41

8 months ago

0.0.1-rc.44

8 months ago

0.0.1-rc.43

8 months ago

0.0.1-rc.46

8 months ago

0.0.1-rc.45

8 months ago

0.0.1-rc.48

8 months ago

0.0.1-rc.49

8 months ago

0.0.1-rc.60

6 months ago

0.0.1-rc.51

8 months ago

0.0.1-rc.50

8 months ago

0.0.1-rc.53

8 months ago

0.0.1-rc.55

7 months ago

0.0.1-rc.54

8 months ago

0.0.1-rc.57

7 months ago

0.0.1-rc.56

7 months ago

0.0.1-rc.59

7 months ago

0.0.1-rc.15

11 months ago

0.0.1-rc.58

7 months ago

0.0.1-rc.17

11 months ago

0.0.1-rc.16

11 months ago

0.0.1-rc.19

11 months ago

0.0.1-rc.18

11 months ago

0.0.1-rc.71

5 months ago

0.0.1-rc.70

5 months ago

0.0.1-rc.62

6 months ago

0.0.1-rc.61

6 months ago

0.0.1-rc.64

6 months ago

0.0.1-rc.20

11 months ago

0.0.1-rc.63

6 months ago

0.0.1-rc.66

6 months ago

0.0.1-rc.22

10 months ago

0.0.1-rc.65

6 months ago

0.0.1-rc.21

11 months ago

0.0.1-rc.68

5 months ago

0.0.1-rc.24

10 months ago

0.0.1-rc.23

10 months ago

0.0.1-rc.26

10 months ago

0.0.1-rc.69

5 months ago

0.0.1-rc.25

10 months ago

0.0.1-rc.28

9 months ago

0.0.1-rc.27

9 months ago

0.0.1-rc.29

9 months ago

0.0.1-rc.73

4 months ago

0.0.1-rc.72

5 months ago

0.0.1-rc.75

4 months ago

0.0.1-rc.31

9 months ago

0.0.1-rc.74

4 months ago

0.0.1-rc.30

9 months ago

0.0.1-rc.33

9 months ago

0.0.1-rc.32

9 months ago

0.0.1-rc.35

9 months ago

0.0.1-rc.34

9 months ago

0.0.1-rc.37

9 months ago

0.0.1-rc.36

9 months ago

0.0.1-rc.39

8 months ago

0.0.1-rc.38

9 months ago

0.0.1-rc.14

12 months ago

0.0.1-rc.11

12 months ago

0.0.1-rc.13

12 months ago

0.0.1-rc.12

12 months ago

0.0.1-rc.10

12 months ago

0.0.1-rc.9

12 months ago

0.0.1-rc.8

1 year ago

0.0.1-rc.4

1 year ago

0.0.1-rc.7

1 year ago

0.0.1-rc.5

1 year ago

0.0.1-rc.6

1 year ago

0.0.1-rc.3

1 year ago

0.0.1-rc.2

1 year ago

0.0.1-rc.1

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago