Commit Graph
47 Commits
Author SHA1 Message Date
Raja SubramanianandGitHub 0cf53e2f0d Add option to force drain rtcService/agentService connections. (#4618)
When force: true, drain as fast as possible.
2026-06-23 16:10:50 +05:30
Paul WellsandGitHub 12a023ae45 agent: thread attributes map from dispatch to job (#4598)
* agent: thread simulation flag from dispatch to job

Reads simulation from AgentDispatch / RoomAgentDispatch and copies it
onto Job in agent.LaunchJob and the inline room-agent path so workers
see the flag.

Stacked on top of livekit/protocol#1629.

* agent: replace simulation bool with attributes map

Threads the renamed attributes map (was bool simulation) from dispatch
to job and bumps the protocol pseudo-version.

* deps
2026-06-16 01:53:01 -07:00
Paul WellsandGitHub 019a6640ae rtc: report participant kind code and details (#4534)
* rtc: report participant kind code and details

Plumb ParticipantKind and KindDetails through MediaTrack and
BytesTrackStats so track-level reporting can record the numeric kind
code plus details codes on every participant_session aggregation,
alongside the existing Kind string. Also picks up the new kind fields
on resolved BytesSignalStats participants.

Adds deployment/agentID/version to the agent worker logger.
2026-05-18 23:20:52 -07:00
Paul WellsandGitHub ab7fdeab7c add AssignmentHook to AssignJob; propagate websocket write errors (#4516)
* add AssignmentHook to AssignJob; propagate websocket write errors

- Replace the `url *string` parameter on `Worker.AssignJob` with a
  middleware-style `AssignmentHook` so callers can intercept the
  `JobAssignment` send (e.g. to set Url, or to gate hedged attempts so
  only one assignment is written).
- Remove the `sendRequest` helper. Inline `WriteServerMessage` and
  propagate the error: `AssignJob` returns immediately on a failed
  availability or assignment write, leaving the job out of
  `runningJobs`; `TerminateJob` still updates local bookkeeping when
  the wire write fails but surfaces the write error to the caller.

* tidy
2026-05-10 21:14:02 -07:00
Paul WellsandGitHub 12fff29a12 allow setting agent job assignment url (#4512) 2026-05-07 13:13:21 -07:00
Paul WellsandGitHub 803999efad rename agent environment to deployment (#4506)
* rename agent environment to deployment

* deps
2026-05-05 14:19:40 -07:00
Paul WellsandGitHub ffab3bd308 add agent environment (#4498)
* add agent environment

* lint

* psrpc error

* deps
2026-05-01 19:30:06 -07:00
Théo MonnomandGitHub af1dcc8843 Add CloseWithReason to agent SignalConn interface (#4492) 2026-04-28 22:14:06 -07:00
Raja SubramanianandGitHub c91e79af35 Switch to stdlib maps, slices (#4445)
* Switch to stdlib maps, slices

* slices
2026-04-13 00:11:48 +05:30
Paul WellsandGitHub 88c77dc666 compute agent dispatch affinity from target load (#4442)
* compute agent dispatch affinity from target load

* fix test config
2026-04-09 13:49:43 -07:00
David ZhaoandGitHub 72c7e65c25 chore: log API key during worker registration (#4428) 2026-04-03 09:48:42 -07:00
David ZhaoandGitHub 88facc0235 adds a test to ensure agent worker errors cause disconnection (#4273) 2026-01-31 14:19:19 -08:00
Raja SubramanianandGitHub 2510b9462e Taking a bunch of go modernize suggestions. (#4194)
This is not all of it as it is not possible (or at least I do not know
of a way) to get all suggestions for a repo/project. Did this via loop
searching mainly and taking the modernize suggestions.
2025-12-25 16:55:58 +05:30
cnderrauberandGitHub 4104b8270b update protocol (#4183)
* update protocol

* fix test
2025-12-22 12:54:11 +08:00
Paul WellsandGitHub 060719d17d add config for user data recording (#3966)
* add config for user data recording

* missing file

* wire

* deps
2025-09-29 14:01:39 -07:00
Paul WellsandGitHub 56ee23282f handle terminated job requests (#3948) 2025-09-23 23:54:01 -07:00
David ZhaoandGitHub 5f561b4ff1 Include agent_name as a participant attribute (#3914) 2025-09-10 21:29:55 -07:00
Paul WellsandGitHub ba702a5323 forward agent id to job state (#3786)
* forward agent id to job state

* deps
2025-07-16 14:17:13 -07:00
Tobias FriedandGitHub 8077426312 chore: set workerid on job creation (#3737)
* chore: set workerid on job creation

* chore: bump deps
2025-06-16 15:30:06 -06:00
Paul WellsandGitHub e4f7d81bdd add client ip to agent worker registration (#3675) 2025-05-20 07:58:28 -07:00
Paul WellsandGitHub c9385edd1e handle agent worker jwt (#3668)
* handle agent worker jwt

* test

* tidy

* tidy

* deps
2025-05-15 08:23:10 -07:00
Paul WellsandGitHub f49103a003 add participant job type (#3443)
* add participant job type

* cleanup

* deps
2025-02-18 00:40:56 -08:00
David ZhaoandGitHub ac43e8a640 fix completed job status updates causing workers to reconnect (#3294) 2024-12-31 01:57:46 -06:00
Raja SubramanianandGitHub 49b75e94a6 Consolidate operations on LocalNode. (#3140) 2024-10-25 18:57:23 +05:30
Paul WellsandGitHub b0d3d65f18 update events package (#3126)
* update events package

* deps
2024-10-21 23:44:00 -07:00
David ZhaoandGitHub 33098337fc Support for attributes in initial agent token (#3097) 2024-10-14 22:45:10 -07:00
2d6aa049c9 Improve agent job assignment logging (#3090)
* Improve agent job assignment logging

* add more agent logging

---------

Co-authored-by: Paul Wells <paulwe@gmail.com>
2024-10-13 00:56:51 -07:00
Paul WellsandGitHub 4c2b154c41 start jobs with started state (#3070)
* start jobs with started state

* deps
2024-10-07 04:09:10 -07:00
Paul WellsandGitHub 3261560098 api for agent worker job count (#3068)
* api for agent worker job count

* cleanup

* temp deps

* temp deps

* deps
2024-10-05 05:13:52 -07:00
Paul WellsandGitHub bdfb2c4ca9 init agent worker ping handler (#3061)
* init agent worker ping handler

* cleanup
2024-10-03 04:08:07 -07:00
Paul WellsandGitHub 096157e706 clean up worker jobs in handler when job ends (#3042) 2024-09-25 03:04:01 -07:00
Paul WellsandGitHub 5e3b3ee3c1 return copy of job state when starting job (#3035) 2024-09-22 23:37:06 -07:00
Paul WellsandGitHub 8428d5e62b update protocol (#3031)
* update protocol

* test

* cleanup
2024-09-21 17:05:39 -07:00
Paul WellsandGitHub 61179d5624 simplify agent registration (#3018)
* simplify agent registration

* testutils

* deps

* fix

* gen

* cleanup

* lower job load
2024-09-19 05:58:30 -07:00
Benjamin PrachtandGitHub 64057c3e4d Implement AgentDispatch service (#2919)
This allows listing, adding and deleting agent dispatches on an existing room. Requests go to a new AgentDispatchService, which sends them over RPC to the rtc.Room via the RoomManager. The rtc.Room then does agent job management using RPCs to the agent service.
2024-08-08 22:31:23 +02:00
Dan McFaulandGitHub 489f73f0a4 distribute load to agents probabilistically, inversely proportionate to load (#2902)
* select the least loaded agent worker for job dispatch

* update to load balance using inverse load

* remove unused file

* adding unit tests for worker job distribution
2024-08-07 21:05:47 -06:00
Paul WellsandGitHub 2346c8a6b7 add example agent test (#2914) 2024-08-06 19:51:30 -07:00
Paul WellsandGitHub e9b6bf43c3 add mock agent for integration tests (#2913)
* add mock agent for integration tests

* cleanup
2024-08-06 19:46:52 -07:00
Benjamin PrachtandGitHub 0fd09d73c1 Instantiate default agent dispatches in rtc for better backward compatibility (#2886) 2024-07-22 08:44:13 -07:00
Benjamin PrachtandGitHub a877ba2352 Partial support for agent dispatch management (#2872)
- Store agent dispaches independently of room agents on rtc.Room
- Serialize agent dispatches in rtc.Room
- Support for agent dispatch and job serialization in redis

The agent Job object references denormalized Room and ParticipantInfo object. When storing Jobs, this sets the Room to nil, and only stores the Participant identity field. When read back, these fields need to be set to their current value.
2024-07-18 13:36:43 -07:00
Benjamin PrachtandGitHub a9aa65fdc6 Remove unused fields from RegisterWorkerRequest (#2866) 2024-07-15 15:22:20 -07:00
Benjamin PrachtandGitHub fb7eb3450e Update agents service to updated protocol (#2837)
- Deprecate namespace field
- Restore former semantic of starting a job for each registered namespace, for a given Agent Name
- Add agentName field
- Use "dispatcher" naming convention
2024-07-08 17:09:11 -07:00
Paul WellsandGitHub e511464d3d add handler interface to receive agent worker updates (#2830)
* add handler interface to receive agent worker updates

* cleanup
2024-07-02 13:11:08 -07:00
Benjamin PrachtandGitHub 32a4d03c9e Implement Agents protocol addition (#2786) 2024-06-27 19:20:52 -07:00
Paul WellsandGitHub f1886ece42 update protocol (#2760)
* update protocol

* deps
2024-06-05 19:46:34 -07:00
David ZhaoandGitHub f4314686d1 Improve Agent logging (#2628) 2024-04-05 20:32:29 -07:00
dc67f505a5 agent service: new protocol & namespaces (#2545)
* initial worker impl

* fix test

* fix build

* TestAgentNamespaces

* log err

* nit cmt

* TestAgentMultiNode

* Update pkg/agent/worker.go

Co-authored-by: David Zhao <dz@livekit.io>

* retry on worker selection & fix review comments

* Update roommanager.go

* license

* use testutils.WIthTimeout

* abstract namespace/enabled logic into agent.Client, incrementally dispatch

* typos and dates

* lock

* timeout is now optional

* pass in topics instead of fixed

* handler handles connections

* onIdle, numConnections

* fix WithGrants

* update protocol

* check agent client

* broadcast after unlock

* fix data race

* remove ReadChan, fix dispatcher

---------

Co-authored-by: David Zhao <dz@livekit.io>
Co-authored-by: David Colburn <xero73@gmail.com>
2024-04-03 15:25:42 -07:00