-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(adk): merge agent teams into alpha/10 #1099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fanlv
wants to merge
139
commits into
alpha/10
Choose a base branch
from
feat/eager_receive_agent_team2
base: alpha/10
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
139 commits
Select commit
Hold shift + click to select a range
8aa17b1
feat(adk): runner-managed session
shentongmartin 5388e10
feat(serialization): add HumanReadableSerializer with improved perfor…
shentongmartin 60dcb33
fix(adk): harden managed session persistence
shentongmartin 9d3b9ee
fix(adk): close session review gaps
shentongmartin 3d5b6ad
fix(adk): avoid go121 slices package
shentongmartin 32a1a5d
fix(adk): satisfy ci lint checks
shentongmartin 4a39bae
fix(serialization): preserve human readable edge cases
shentongmartin 13b2b3f
fix(adk): defer interrupt checkpoint until session events are durable
shentongmartin b075caa
fix(adk): preserve resumability of pre-envelope agent_tool checkpoints
shentongmartin 4942054
refactor(adk): unify LoadEvents cursor naming into single After field
shentongmartin 2f9797c
refactor(adk): rename LoadEventsOptions to LoadEventsRequest
shentongmartin 83bc84e
docs(adk): fix middleware lifecycle comments and remove unused GobSer…
shentongmartin 79b0a30
feat(adk): add retry-with-backoff to session event persister and conf…
shentongmartin 8da356c
feat(adk): utilize persisted TurnEndState.ToolInfos for prompt cache …
shentongmartin 93628b8
feat(adk): add timestamps to agent and session events
shentongmartin 84fca31
fix(adk): deduplicate system message in defaultGenModelInput for sess…
shentongmartin 61d4719
refactor(serialization): consolidate HumanReadableSerializer tests in…
shentongmartin 9b5b4b5
refactor(adk): simplify SessionStore to append-only event log
shentongmartin 278b850
feat(adk): use SessionEvent EventID as SessionStore cursor
shentongmartin 410fe12
feat(adk): share EventID between AgentEvent and SessionEvent
shentongmartin 53bbedb
feat(adk): add session timeline observation events
shentongmartin e05042e
feat(adk): add managed interrupt resume mode
shentongmartin 7ed2515
refactor(adk): consolidate session event lane
shentongmartin f49960e
fix(adk): preserve checkpoint before fresh turn
shentongmartin f85d5c1
feat(middlewares): add permission middleware
shentongmartin fe15adc
feat(middlewares): refine permission resume resolution
shentongmartin 109f220
fix(adk): harden permission middleware
shentongmartin 5076e12
feat(adk): add file session store
shentongmartin c0b4860
fix(adk): resolve session loop lint failures
shentongmartin 88bbc32
refactor(adk): auto-abandon pending checkpoint on fresh Run
shentongmartin 0f1e8b9
refactor(adk): make SessionStore format-agnostic via SessionEventPayload
shentongmartin 2387930
fix(adk): revert FileStore to raw line format for HumanReadableSerial…
shentongmartin 28a8611
refactor(adk): remove RunID and recover inFlightTurnID on Resume
shentongmartin 5b29da3
refactor(adk): cleanup session timeline event structs
shentongmartin cd72975
fix(adk): add omitempty to MessagesReplaced json tag
shentongmartin b90520b
refactor(adk): rename SessionPersistenceConfig to SessionConfig
shentongmartin 86992f8
feat(adk): replace tool observation events with tool span events
shentongmartin 99f7d01
feat(adk): persistence-aware tool spans across interrupt/resume
shentongmartin bd256aa
feat(adk): add kind-aware session store payloads and load filters
shentongmartin f96905c
feat(adk): persist agent interrupt as SessionEventAgentInterrupt
shentongmartin dadb61a
test(adk): cover session log terminal paths
shentongmartin 653b85c
docs(adk): clarify session event cursor semantics
shentongmartin d12ef1b
feat(adk): add sync session persistence mode
shentongmartin fba8348
refactor(adk): simplify AgentInterruptEvent to flat context slice
shentongmartin 17dc6e9
feat(adk): backfill SessionEvent on live message events
shentongmartin 4650a8c
fix(adk): emit user input timeline events
shentongmartin d8be7ec
fix(adk): guard concurrent store.events access in sync-mode tests
shentongmartin 84204af
feat(adk): add extensible session timeline events
shentongmartin 2d31662
refactor(adk): rename session config field
shentongmartin 016b405
fix(adk): avoid turn end requirement after fatal errors
shentongmartin cd010b8
fix(adk): set streaming meta for agentic tool chunks
shentongmartin 20f4d76
fix(adk): harden session reduction persistence
shentongmartin 984675d
fix(adk): close managed interrupt resume race
shentongmartin 9479038
fix(compose): enrich checkpoint set errors
shentongmartin 4b71d48
fix(adk): handle managed resume and synthetic rerun inputs
shentongmartin b5b8ada
feat(adk): add session rollback
shentongmartin d683470
fix(middlewares): clean permission interrupt payload
shentongmartin 1701b74
refactor(adk): use typed session service
shentongmartin 6bd020c
fix(middlewares): update permission session test
shentongmartin c176d7e
fix(adk): handle typed-nil CheckpointStore and add configurable Event…
shentongmartin 36480c5
feat(adk): pass context to EventIDGenerator for request-scoped ID gen…
shentongmartin 791bcf3
feat(adk): add opt-in model call timeout with per-phase budgets
shentongmartin b8283c9
feat(deep): propagate ModelTimeoutConfig to deep agent and general su…
shentongmartin cdba1e9
refactor(adk): move session ownership to session events
shentongmartin 306303e
feat(adk): export prompt language wrappers
shentongmartin 65ce068
fix(deep): propagate model retry config to task tool
shentongmartin 60826fc
feat(middlewares): normalize patch tool call history
shentongmartin 77db87b
chore: ignore external working trees
shentongmartin 24e8af3
feat(adk/filesystem): support rich execute configuration
shentongmartin 09e0f03
feat(adk): add fenced session service
shentongmartin 3deeb27
refactor(adk): simplify session fencing ownership
shentongmartin c36166d
feat(adk): support session event id generator
shentongmartin 226572e
feat(adk): add resume wait timeout
shentongmartin ca83a47
fix(adk): keep memory store go1.18 compatible
shentongmartin 9ac6d53
fix(adk): stabilize session message ids
shentongmartin c319887
test(serialization): avoid duplicate gob registration
shentongmartin 415321c
test(serialization): use concrete gob benchmark payloads
shentongmartin 41c2803
test(adk): cover session adapter edge cases
shentongmartin 3b76836
test(adk): cover file session store edges
shentongmartin 1801c96
refactor(adk): simplify session persistence flow
shentongmartin 5f7f9d3
fix(adk): preserve loaded session tail
shentongmartin a347e37
test(adk): stabilize cancel resume timeout test
shentongmartin 07a9c70
test(adk): request cancel before resume safepoint
shentongmartin 274fbaa
test(adk): stabilize resume stream cancel test
shentongmartin ac67d73
test(adk): cover model timeout edge paths
shentongmartin cae4f13
test(adk): stabilize turn loop cancel mock
shentongmartin 9a5e528
feat(adk): record permission resume decisions (#1070)
shentongmartin a5b7e30
refactor(adk): drop AgentInterruptCause classification (#1072)
shentongmartin aab6f7e
fix(adk): allow business interrupt resume through permission gate (#1…
shentongmartin 0022ba4
feat(adk): auto memory middleware (#987)
N3kox 743224a
feat(adk): automemory rebuild memory instruction & emit session event…
N3kox cf72e91
fix(adk): auto memory TypedSendEvent wrong kind (#1082)
N3kox 79eef75
fix(adk): persist BeforeAgent session events (#1083)
shentongmartin 972c4cc
refactor(adk): simplify session service ownership (#1079)
shentongmartin 4d4687d
fix(adk): drop errored streams from session persistence (#1088)
shentongmartin 4bb0286
refactor: simplify load session (#1086)
YellowDusk04 543656c
feat(adk): auto memory support multi memory store (#1087)
N3kox 28cc930
chore(adk): memory glob prompt (#1089)
N3kox a72d9ea
refactor(adk): extract model timeout middleware (#1095)
shentongmartin 1afd7b3
fix(adk): persist leading system messages (#1096)
shentongmartin 177033b
feat(adk): extract memory instruction customize (#1097)
N3kox 78ad9db
refactor(adk): remove turn end session event (#1098)
shentongmartin b7906d3
fix(adk): deduplicate deep agent system prompts (#1101)
shentongmartin 7d6ad71
fix(adk): delete consumed resume checkpoint (#1102)
shentongmartin 8b29a7f
fix(adk): snapshot leading system sync state (#1103)
shentongmartin 8958ee9
feat(adk): persist incomplete stream prefixes (#1105)
shentongmartin dbfe9a9
refactor(adk): introduce SessionEventVariant and simplify session eve…
shentongmartin 33648fd
feat(adk): rollback memory stores to single memory dir (#1109)
N3kox a77de0d
fix(adk): dedupe empty model context snapshots (#1115)
shentongmartin 26bc5ca
feat(adk): background-task manager with subagent/filesystem/deep wiri…
hi-pender f4cdeb9
feat(adk): add session timeline observation events
shentongmartin efd3ece
feat(adk): add agent teams middleware with mailbox-based multi-agent …
fanlv 528c270
docs: add agents.md
fanlv 848a097
refactor(adk): move team middleware to prebuilt directory
fanlv 44ac19c
fix(adk/team): harden name validation, owner checks, lock lifecycle, …
fanlv 7542013
fix(adk/team): correct reminder default, tighten API surface, harden …
fanlv 7c69792
fix(adk/team): validate dedup names, surface TeamCreate rollback erro…
fanlv c1b5d6e
fix(adk/team): remove dead leader-exit chain, expose broadcast result…
fanlv 917f02c
fix(adk/team): surface task-assignment notify failures, harden shutdo…
fanlv 900546f
fix(adk/team): drop dead tool.json, unexport inboxMessage, fix stale …
fanlv b81e7a5
fix(adk/team): guard tasks before TeamCreate, length-safe team dedup,…
fanlv 32c0325
fix(adk/team): guard nil config read, keep busy/idle in-process, doc …
fanlv 3eefd1b
fix(adk/team): lint shadows, atomic TeamCreate, no team_name bypass, …
fanlv 7258a53
test(adk/team): deterministically keep teammate alive in FullFlow
fanlv b956f2c
fix(adk/team): serialize Agent/TeamDelete via teamOpLock, render cont…
fanlv e4bec8e
fix(adk/team): guard nil RunnerConfig, order inbox delete before memb…
fanlv c2626b7
fix(adk/team): stop loop on abnormal pump exit, observable reminder d…
fanlv 9a26772
fix(adk/team): no-leak teammate wait, warn on undeliverable DMs
fanlv c8d1dc4
fix(adk/team): drop dead dispatch helper, observe shutdown drops, fas…
fanlv 67747af
fix(adk): atomic TaskUpdate graph writes, recoverable TeamDelete orde…
fanlv cb8e446
fix(adk/team): align team_name schema, drop unused IsActive, clarify …
fanlv bf1e7e8
fix(adk/team): harden teammate lifecycle, mailbox cleanup, and send/l…
fanlv 85a39ae
fix(adk/team): gate task auto-clear to single-agent, drop dead busy/i…
fanlv f64841f
fix(adk/team): stop point-to-point send from resurrecting torn-down i…
fanlv 77e74e2
docs(adk/team): add demo
fanlv 1162e1e
feat(adk): remove TeamCreate and TeamDelete for teams (#1104)
N3kox 1bab211
feat(adk): customizable teammate roles (#1108)
N3kox a8978e9
chore(adk/team): update README & demo
N3kox cfdf249
fix(adk/team): escape '<'/'&' in teammate envelope body to block tag-…
N3kox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| @./AGENTS.local.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| /* | ||
| * Copyright 2026 CloudWeGo Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package backgroundtask | ||
|
|
||
| import ( | ||
| "math/rand" | ||
| "time" | ||
| ) | ||
|
|
||
| // Task-id layout: a positive int64 (63 usable bits) packed as | ||
| // | ||
| // [ 41 bits ms timestamp ][ 12 bits sequence ][ 10 bits random ] | ||
| // | ||
| // Uniqueness within a process is guaranteed by (timestamp, sequence): the | ||
| // sequence resets each millisecond and increments for every id minted within the | ||
| // same millisecond, all under the Manager lock. If more than 2^12 ids are minted | ||
| // in a single millisecond the generator spins to the next millisecond rather than | ||
| // wrapping the sequence, so (timestamp, sequence) never repeats. The random low | ||
| // bits only make ids look unordered/unpredictable; they are not relied upon for | ||
| // uniqueness. | ||
| // | ||
| // 41 bits of milliseconds covers ~69 years; 12 bits allows 4096 ids per | ||
| // millisecond before the generator advances to the next millisecond. | ||
| const ( | ||
| idSeqBits = 12 | ||
| idRandomBits = 10 | ||
| idSeqLimit = 1 << idSeqBits | ||
| idRandomMask = (1 << idRandomBits) - 1 | ||
| ) | ||
|
|
||
| // nextRawID packs the next task id integer. Must be called with m.mu held, as it | ||
| // reads and advances m.seq / m.lastMs. | ||
| func (m *Manager) nextRawID() int64 { | ||
| ms := time.Now().UnixMilli() | ||
| switch { | ||
| case ms > m.lastMs: | ||
| m.lastMs = ms | ||
| m.seq = 0 | ||
| default: | ||
| // Same millisecond (or a backward clock step): keep the id monotonic by | ||
| // staying on lastMs and advancing the sequence. On sequence overflow, move | ||
| // to the next millisecond so (timestamp, sequence) stays unique. | ||
| ms = m.lastMs | ||
| m.seq++ | ||
| if m.seq >= idSeqLimit { | ||
| ms = m.waitNextMs(m.lastMs) | ||
| m.lastMs = ms | ||
| m.seq = 0 | ||
| } | ||
| } | ||
|
|
||
| //nolint:gosec // non-cryptographic: random bits only diffuse the id's look. | ||
| r := int64(rand.Intn(idRandomMask + 1)) | ||
| return (ms << (idSeqBits + idRandomBits)) | (m.seq << idRandomBits) | r | ||
| } | ||
|
|
||
| // waitNextMs busy-waits until the wall clock advances past prevMs. Reached only | ||
| // when more than 2^12 ids are minted within one millisecond. | ||
| func (m *Manager) waitNextMs(prevMs int64) int64 { | ||
| ms := time.Now().UnixMilli() | ||
| for ms <= prevMs { | ||
| ms = time.Now().UnixMilli() | ||
| } | ||
| return ms | ||
| } | ||
|
|
||
| // base62 encodes a non-negative int64 using [0-9A-Za-z]. It is the compact, | ||
| // URL-safe textual form of a task id's integer. | ||
| func base62(n int64) string { | ||
| const alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" | ||
| if n == 0 { | ||
| return "0" | ||
| } | ||
| var buf [11]byte // ceil(63 / log2(62)) = 11 | ||
| i := len(buf) | ||
| for n > 0 { | ||
| i-- | ||
| buf[i] = alphabet[n%62] | ||
| n /= 62 | ||
| } | ||
| return string(buf[i:]) | ||
| } | ||
|
|
||
| // defaultTaskIDPrefix is used when a task has no Type tag. | ||
| const defaultTaskIDPrefix = "task" | ||
|
|
||
| // taskIDPrefix returns the id prefix for a task type, falling back to a generic | ||
| // prefix when the type is empty. The type tag (e.g. "bash", "subagent") makes ids | ||
| // self-describing: "bash_3Fa9...". | ||
| func taskIDPrefix(taskType string) string { | ||
| if taskType == "" { | ||
| return defaultTaskIDPrefix | ||
| } | ||
| return taskType | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.