Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spicy-teachers-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/protocol": patch
---

Agent env
24 changes: 24 additions & 0 deletions agent/environment.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package agent

import "fmt"

const MaxEnvironmentLength = 64

func ValidateEnvironment(env string) error {
if env == "" {
return nil
}
if len(env) > MaxEnvironmentLength {
return fmt.Errorf("environment exceeds %d bytes", MaxEnvironmentLength)
}
for i := 0; i < len(env); i++ {
c := env[i]
switch {
case c == '_':
return fmt.Errorf("environment contains reserved character %q", c)
case c <= ' ' || c == 0x7f:
return fmt.Errorf("environment contains whitespace or control byte at position %d", i)
}
}
return nil
}
26 changes: 22 additions & 4 deletions livekit/livekit_agent.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 32 additions & 5 deletions livekit/livekit_agent_dispatch.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 38 additions & 36 deletions livekit/livekit_agent_dispatch.twirp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions protobufs/livekit_agent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ message Job {
string agent_name = 7;
JobState state = 8;
bool enable_recording = 10;
string environment = 11;
}

message JobState {
Expand Down Expand Up @@ -120,6 +121,7 @@ message RegisterWorkerRequest {
uint32 ping_interval = 5;
optional string namespace = 6;
ParticipantPermission allowed_permissions = 7;
string environment = 9;
}

message RegisterWorkerResponse {
Expand Down
3 changes: 3 additions & 0 deletions protobufs/livekit_agent_dispatch.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ message CreateAgentDispatchRequest {
string room = 2;
string metadata = 3 [(logger.redact) = true];
JobRestartPolicy restart_policy = 4; // cloud only
string environment = 5;
}

message RoomAgentDispatch {
string agent_name = 1;
string metadata = 2 [(logger.redact) = true];
JobRestartPolicy restart_policy = 3; // cloud only
string environment = 4;
}

message DeleteAgentDispatchRequest {
Expand All @@ -67,6 +69,7 @@ message AgentDispatch {
string metadata = 4 [(logger.redact) = true];
AgentDispatchState state = 5;
JobRestartPolicy restart_policy = 6; // cloud only
string environment = 7;
}

message AgentDispatchState {
Expand Down
Loading