Skip to content

Commit 2a27d13

Browse files
committed
bump 109
1 parent 7655311 commit 2a27d13

File tree

20 files changed

+58
-42
lines changed

20 files changed

+58
-42
lines changed

agent-apis/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"name": "ts-example-openai",
2+
"name": "agent-apis",
33
"version": "1.0.0",
4-
"description": "Basic OpenAI example with Restack TypeScript library",
4+
"description": "Agent with third party APIs",
55
"main": "index.js",
66
"scripts": {
7-
"start": "ts-node src/services.ts",
87
"start.watch": "nodemon src/services.ts",
98
"dev": "npm run start.watch",
109
"build": "tsc --build",
10+
"start": "node dist/services.js",
1111
"clean": "rm -rf node_modules",
1212
"schedule": "ts-node ./scheduleWorkflow.ts"
1313
},
@@ -21,7 +21,7 @@
2121
]
2222
},
2323
"dependencies": {
24-
"@restackio/ai": "^0.0.107",
24+
"@restackio/ai": "^0.0.109",
2525
"@temporalio/workflow": "1.11.6",
2626
"dotenv": "^16.4.7",
2727
"openai": "^4.80.1"

agent-apis/readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Restack AI - Agent with Third Party APIs
1+
# Restack AI - Agent with third party APIs
22

3-
This repository contains an agent with Third Party APIs
3+
This repository contains an agent with third party APIs
44
It demonstrates how to set up a multi steps workflow with Weather API and OpenAI.
55

66
## Prerequisites

agent-chat/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
"scripts": {
66
"dev": "open-cli http://localhost:5233 && tsx watch --include src src/services.ts",
77
"build": "tsc --build",
8+
"start": "node dist/services.js",
89
"clean": "rm -rf node_modules",
910
"schedule-agent": "tsx scheduleAgent.ts",
1011
"event-agent": "tsx eventAgent.ts"
1112
},
1213
"dependencies": {
13-
"@restackio/ai": "^0.0.107",
14+
"@restackio/ai": "^0.0.109",
1415
"@temporalio/workflow": "1.11.6",
1516
"dotenv": "^16.4.7",
1617
"openai": "^4.80.1"

agent-rag/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"event": "tsx eventAgent.ts"
1111
},
1212
"dependencies": {
13-
"@restackio/ai": "^0.0.107",
13+
"@restackio/ai": "^0.0.109",
1414
"@temporalio/workflow": "1.11.6",
1515
"dotenv": "^16.4.7",
1616
"openai": "^4.80.1",

agent-stream/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"event-agent": "tsx eventAgent.ts"
1111
},
1212
"dependencies": {
13-
"@restackio/ai": "^0.0.107",
13+
"@restackio/ai": "^0.0.109",
1414
"@temporalio/workflow": "1.11.6",
1515
"dotenv": "^16.4.7",
1616
"openai": "^4.80.1"

agent-telephony/twilio-livekit/agent/.env.example

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ LIVEKIT_API_KEY=
55
LIVEKIT_API_SECRET=
66
LIVEKIT_URL=
77

8-
LIVEKIT_SIP_ADDRESS=
98
TWILIO_PHONE_NUMBER=
109
TWILIO_TRUNK_AUTH_USERNAME=
1110
TWILIO_TRUNK_AUTH_PASSWORD=
11+
TWILIO_TRUNK_TERMINATION_SIP_URL="trunkId.pstn.twilio.com"
1212

1313
ELEVEN_API_KEY=
1414
DEEPGRAM_API_KEY=
1515
OPENAI_API_KEY=
1616

17-
# For Restack Cloud deployment
18-
RESTACK_ENGINE_ID=
19-
RESTACK_ENGINE_ADDRESS=
20-
RESTACK_ENGINE_API_KEY=
21-
RESTACK_ENGINE_API_ADDRESS=
17+
# # For Restack Cloud deployment
18+
# RESTACK_ENGINE_ID=
19+
# RESTACK_ENGINE_ADDRESS=
20+
# RESTACK_ENGINE_API_KEY=
21+
# RESTACK_ENGINE_API_ADDRESS=
2222

agent-telephony/twilio-livekit/agent/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@livekit/protocol": "^1.34.0",
15-
"@restackio/ai": "^0.0.107",
15+
"@restackio/ai": "^0.0.109",
1616
"@temporalio/workflow": "1.11.6",
1717
"dotenv": "^16.4.7",
1818
"livekit-server-sdk": "^2.10.2",

agent-telephony/twilio-livekit/agent/src/agents/agent.ts

+28-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {
44
condition,
55
log,
66
step,
7-
agentInfo
7+
agentInfo,
8+
AgentError
89
} from "@restackio/ai/agent";
910
import * as functions from "../functions";
1011

@@ -18,22 +19,23 @@ export type CallEvent = {
1819

1920
export const messagesEvent = defineEvent<functions.Message[]>("messages");
2021
export const endEvent = defineEvent("end");
21-
export const callEvent = defineEvent<string>("call");
22+
export const callEvent = defineEvent<{ phoneNumber: string; sipCallId: string }>("call");
2223

2324
type agentTwilioOutput = {
2425
messages: functions.Message[];
2526
};
2627

28+
2729
export async function agentTwilio(): Promise<agentTwilioOutput> {
2830
let endReceived = false;
2931
let messages: functions.Message[] = [{
3032
role: "system",
3133
content: "You are a sales assistant making outbound calls to potential customers. Your answers are used in a text to speech, be concise and natural."
3234
}];
3335
let roomId: string;
34-
let recordingApproved= true
3536

3637
onEvent(messagesEvent, async ({ messages, stream = true }: { messages: functions.Message[], stream?: boolean }) => {
38+
try {
3739
const result = await step<typeof functions>({}).llmChat({
3840
messages,
3941
});
@@ -42,20 +44,32 @@ export async function agentTwilio(): Promise<agentTwilioOutput> {
4244

4345
messages.push(result);
4446
return messages;
47+
} catch (error) {
48+
log.error("error", { error });
49+
throw AgentError.nonRetryable("Error messagesEvent:", null, {error});
50+
}
4551
});
4652

4753
onEvent(callEvent, async ({ phoneNumber }: CallEvent) => {
48-
const agentName = agentInfo().workflowType
49-
const agentId = agentInfo().workflowId
50-
const runId = agentInfo().runId
51-
52-
const trunk = await step<typeof functions>({}).livekitOutboundTrunk();
53-
54-
const sipTrunkId = trunk.sipTrunkId
55-
56-
const call = await step<typeof functions>({}).livekitCall({sipTrunkId, phoneNumber, roomId, agentName, agentId, runId});
57-
58-
return call.sipCallId
54+
try {
55+
const agentName = agentInfo().workflowType
56+
const agentId = agentInfo().workflowId
57+
const runId = agentInfo().runId
58+
59+
const trunk = await step<typeof functions>({}).livekitOutboundTrunk();
60+
61+
const sipTrunkId = trunk.sipTrunkId
62+
63+
const call = await step<typeof functions>({}).livekitCall({sipTrunkId, phoneNumber, roomId, agentName, agentId, runId});
64+
65+
return {
66+
phoneNumber,
67+
sipCallId: call.sipCallId
68+
}
69+
} catch (error) {
70+
log.error("error", { error });
71+
throw AgentError.nonRetryable("Error callEvent: ", null, {error});
72+
}
5973
});
6074

6175
onEvent(endEvent, async () => {

agent-telephony/twilio-livekit/agent/src/functions/livekitOutboundTrunk.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { FunctionFailure, log, functionInfo } from "@restackio/ai/function";
88
export const livekitOutboundTrunk = async (): Promise<SIPOutboundTrunkInfo> => {
99
try {
1010
const name = functionInfo().workflowExecution.runId
11-
const address = process.env.LIVEKIT_SIP_ADDRESS
11+
const address = process.env.TWILIO_TRUNK_TERMINATION_SIP_URL
1212
const numbers = [process.env.TWILIO_PHONE_NUMBER ?? ""]
1313
const authUsername = process.env.TWILIO_TRUNK_AUTH_USERNAME
1414
const authPassword = process.env.TWILIO_TRUNK_AUTH_PASSWORD

agent-telephony/twilio-livekit/livekit-pipeline/src/pipeline.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default defineAgent({
4343
const agentId = metadata.agent_id
4444
const runId = metadata.run_id
4545

46-
const agentBackendHost = process.env.AGENT_BACKEND_HOST || 'http://host.docker.internal:9233';
46+
const agentBackendHost = process.env.AGENT_BACKEND_HOST || 'http://localhost:9233';
4747

4848
const agentUrl = `${agentBackendHost}/stream/agents/${agentName}/${agentId}/${runId}`;
4949

agent-todo/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"event": "tsx eventAgent.ts"
1111
},
1212
"dependencies": {
13-
"@restackio/ai": "^0.0.107",
13+
"@restackio/ai": "^0.0.109",
1414
"@temporalio/workflow": "1.11.6",
1515
"dotenv": "^16.4.7",
1616
"openai": "^4.80.1",

agent-tool/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"event": "tsx eventAgent.ts"
1111
},
1212
"dependencies": {
13-
"@restackio/ai": "^0.0.107",
13+
"@restackio/ai": "^0.0.109",
1414
"@temporalio/workflow": "1.11.6",
1515
"dotenv": "^16.4.7",
1616
"openai": "^4.80.1",

agent-voice/livekit/agent/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"event-agent": "tsx eventAgent.ts"
1111
},
1212
"dependencies": {
13-
"@restackio/ai": "^0.0.107",
13+
"@restackio/ai": "^0.0.109",
1414
"@temporalio/workflow": "1.11.6",
1515
"dotenv": "^16.4.7",
1616
"openai": "^4.80.1"

agent-voice/livekit/agent/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11

2-
See parent README.md at /agent_voice/livekit/readme.md for instructions on how to run the agent.
2+
See parent README.md at /agent-voice/livekit/readme.md for instructions on how to run the agent.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11

2-
See parent README.md at /agent_voice/livekit/readme.md for instructions on how to run the livekit pipeline.
2+
See parent README.md at /agent-voice/livekit/readme.md for instructions on how to run the livekit pipeline.

child-workflows/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
"scripts": {
66
"dev": "tsx watch --include src src/services.ts",
77
"build": "tsc --build",
8+
"start": "node dist/services.js",
89
"schedule-workflow": "tsx scheduleWorkflow.ts",
910
"restack-web-ui": "docker run -d --pull always --name restack -p 5233:5233 -p 6233:6233 -p 7233:7233 -p 9233:9233 ghcr.io/restackio/restack:main"
1011
},
1112
"dependencies": {
12-
"@restackio/ai": "^0.0.107",
13+
"@restackio/ai": "link:/Users/aboutphilippe/Documents/dev/local-operator/libraries/typescript",
1314
"@temporalio/workflow": "1.11.6",
1415
"dotenv": "16.4.5",
1516
"zod": "3.23.8",

community/openai/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
]
2222
},
2323
"dependencies": {
24-
"@restackio/ai": "^0.0.107",
24+
"@restackio/ai": "^0.0.109",
2525
"@temporalio/workflow": "^1.11.6",
2626
"dotenv": "^16.4.5",
2727
"openai": "^4.71.1",

community/sendgrid/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"author": "Restack",
2525
"license": "ISC",
2626
"dependencies": {
27-
"@restackio/ai": "^0.0.107",
27+
"@restackio/ai": "^0.0.109",
2828
"@sendgrid/mail": "^8.1.4",
2929
"dotenv": "^16.4.6",
3030
"openai": "^4.74.0"

community/stripe-ai/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"license": "ISC",
2525
"dependencies": {
2626
"@ai-sdk/openai": "^1.0.6",
27-
"@restackio/ai": "^0.0.107",
27+
"@restackio/ai": "^0.0.109",
2828
"@stripe/agent-toolkit": "^0.1.21",
2929
"dotenv": "^16.4.6"
3030
},

refactor-needed/human-loop/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
]
2222
},
2323
"dependencies": {
24-
"@restackio/ai": "^0.0.107",
24+
"@restackio/ai": "^0.0.109",
2525
"@temporalio/workflow": "^1.11.6"
2626
},
2727
"devDependencies": {

0 commit comments

Comments
 (0)