-
Notifications
You must be signed in to change notification settings - Fork 360
feat: implement link channels as task delegation (v3) #255
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
Changes from all commits
e39b9db
bd76d60
06a7d70
6abb8af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| Send a message to another agent through the agent communication graph. The message is delivered to a dedicated internal channel between you and the target agent. Use this to coordinate, delegate, escalate, or share information with linked agents. | ||
| Assign a task to another agent. The target agent's cortex will pick it up and execute it autonomously. Use this when work falls outside your scope or belongs to a subordinate. Your turn ends after delegation — the result will be delivered when the task completes. The first sentence of your message becomes the task title; the full content is the task description. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -400,6 +400,8 @@ pub(super) async fn trigger_warmup( | |
| let llm_manager = llm_manager.clone(); | ||
| let force = request.force; | ||
| let agent_id = agent_id.clone(); | ||
| let task_store_registry = state.task_store_registry.clone(); | ||
| let injection_tx = state.injection_tx.clone(); | ||
| tokio::spawn(async move { | ||
| let (event_tx, _event_rx) = tokio::sync::broadcast::channel(16); | ||
| let deps = crate::AgentDeps { | ||
|
|
@@ -416,6 +418,8 @@ pub(super) async fn trigger_warmup( | |
| task_store, | ||
| links: Arc::new(arc_swap::ArcSwap::from_pointee(Vec::new())), | ||
| agent_names: Arc::new(std::collections::HashMap::new()), | ||
| task_store_registry, | ||
| injection_tx, | ||
| }; | ||
| let logger = CortexLogger::new(sqlite_pool); | ||
| crate::agent::cortex::run_warmup_once(&deps, &logger, "api_trigger", force).await; | ||
|
|
@@ -716,6 +720,8 @@ pub(super) async fn create_agent( | |
| links: Arc::new(arc_swap::ArcSwap::from_pointee( | ||
| (**state.agent_links.load()).clone(), | ||
| )), | ||
| task_store_registry: state.task_store_registry.clone(), | ||
| injection_tx: state.injection_tx.clone(), | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| agent_names: { | ||
| let configs = state.agent_configs.load(); | ||
| let mut names: std::collections::HashMap<String, String> = configs | ||
|
|
@@ -825,9 +831,15 @@ pub(super) async fn create_agent( | |
| state.memory_searches.store(std::sync::Arc::new(searches)); | ||
|
|
||
| let mut task_stores = (**state.task_stores.load()).clone(); | ||
| task_stores.insert(agent_id.clone(), task_store); | ||
| task_stores.insert(agent_id.clone(), task_store.clone()); | ||
| state.task_stores.store(std::sync::Arc::new(task_stores)); | ||
|
|
||
| let mut registry = (**state.task_store_registry.load()).clone(); | ||
| registry.insert(agent_id.clone(), task_store); | ||
| state | ||
| .task_store_registry | ||
| .store(std::sync::Arc::new(registry)); | ||
|
Comment on lines
833
to
+841
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep registry lifecycle symmetric: remove deleted agents from This create path now inserts into 🔧 Companion cleanup to add in delete flow+ let mut task_stores = (**state.task_stores.load()).clone();
+ task_stores.remove(&agent_id);
+ state.task_stores.store(std::sync::Arc::new(task_stores));
+
+ let mut registry = (**state.task_store_registry.load()).clone();
+ registry.remove(&agent_id);
+ state
+ .task_store_registry
+ .store(std::sync::Arc::new(registry));🤖 Prompt for AI Agents |
||
|
|
||
| let mut workspaces = (**state.agent_workspaces.load()).clone(); | ||
| workspaces.insert(agent_id.clone(), agent_config.workspace.clone()); | ||
| state | ||
|
|
@@ -1478,10 +1490,16 @@ mod tests { | |
| let (agent_tx, _agent_rx) = tokio::sync::mpsc::channel(1); | ||
| let (agent_remove_tx, _agent_remove_rx) = tokio::sync::mpsc::channel(1); | ||
|
|
||
| let (injection_tx, _injection_rx) = tokio::sync::mpsc::channel(1); | ||
| let task_store_registry = Arc::new(arc_swap::ArcSwap::from_pointee( | ||
| std::collections::HashMap::new(), | ||
| )); | ||
| Arc::new(ApiState::new_with_provider_sender( | ||
| provider_setup_tx, | ||
| agent_tx, | ||
| agent_remove_tx, | ||
| injection_tx, | ||
| task_store_registry, | ||
| )) | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.