feat: inject background-jobs prompt guidance when jobs are enabled
Agents whose function pool includes job__* declarations get a Background Jobs section teaching start/check/collect/cancel discipline and the snapshot/no-persistence semantics. Presence of the declarations doubles as the jobs_enabled predicate, so a context with function calling off or max_concurrent_jobs 0 sees no job prompt text.
This commit is contained in:
+18
-3
@@ -3,15 +3,19 @@ use super::*;
|
||||
use crate::{
|
||||
client::Model,
|
||||
config::memory,
|
||||
function::{Functions, jobs::DEFAULT_MAX_CONCURRENT_JOBS, run_llm_function},
|
||||
function::{
|
||||
Functions,
|
||||
jobs::{DEFAULT_MAX_CONCURRENT_JOBS, JOB_FUNCTION_PREFIX},
|
||||
run_llm_function,
|
||||
},
|
||||
graph, rag,
|
||||
};
|
||||
|
||||
use super::rag_cache::RagKey;
|
||||
use crate::config::paths;
|
||||
use crate::config::prompts::{
|
||||
DEFAULT_SPAWN_INSTRUCTIONS, DEFAULT_TEAMMATE_INSTRUCTIONS, DEFAULT_TODO_INSTRUCTIONS,
|
||||
DEFAULT_USER_INTERACTION_INSTRUCTIONS,
|
||||
DEFAULT_JOB_INSTRUCTIONS, DEFAULT_SPAWN_INSTRUCTIONS, DEFAULT_TEAMMATE_INSTRUCTIONS,
|
||||
DEFAULT_TODO_INSTRUCTIONS, DEFAULT_USER_INTERACTION_INSTRUCTIONS,
|
||||
};
|
||||
use crate::graph::types::RagNode;
|
||||
use crate::graph::{Graph, GraphParser, NodeType};
|
||||
@@ -450,6 +454,17 @@ impl Agent {
|
||||
output.push_str(DEFAULT_SPAWN_INSTRUCTIONS);
|
||||
}
|
||||
|
||||
// Job declarations are appended at init iff jobs are enabled for this
|
||||
// agent, so their presence doubles as the jobs_enabled predicate.
|
||||
if self
|
||||
.functions
|
||||
.declarations()
|
||||
.iter()
|
||||
.any(|f| f.name.starts_with(JOB_FUNCTION_PREFIX))
|
||||
{
|
||||
output.push_str(DEFAULT_JOB_INSTRUCTIONS);
|
||||
}
|
||||
|
||||
output.push_str(DEFAULT_TEAMMATE_INSTRUCTIONS);
|
||||
output.push_str(DEFAULT_USER_INTERACTION_INSTRUCTIONS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user