Skip to content

Commit

Permalink
conditionally load memory system in goose server (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelneale authored Dec 21, 2024
1 parent 4db5ff7 commit cb1b2b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ run-ui:
run-server:
@echo "Running server..."
cargo run -p goose-server

# make GUI with latest binary
make-ui:
@just release
cd ui/desktop && npm run bundle:default
11 changes: 10 additions & 1 deletion crates/goose-server/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ use goose::providers::configs::GroqProviderConfig;
use goose::{
agent::Agent,
developer::DeveloperSystem,
memory::MemorySystem,
providers::{configs::ProviderConfig, factory},
systems::goose_hints::GooseHintsSystem,
};
use std::sync::Arc;
use std::{env, sync::Arc};
use tokio::sync::Mutex;

/// Shared application state
Expand All @@ -21,6 +22,14 @@ impl AppState {
let provider = factory::get_provider(provider_config.clone())?;
let mut agent = Agent::new(provider);
agent.add_system(Box::new(DeveloperSystem::new()));

// Add memory system only if GOOSE_SERVER__MEMORY is set to "true"
if let Ok(memory_enabled) = env::var("GOOSE_SERVER__MEMORY") {
if memory_enabled.to_lowercase() == "true" {
agent.add_system(Box::new(MemorySystem::new()));
}
}

let goosehints_system = Box::new(GooseHintsSystem::new());
agent.add_system(goosehints_system);

Expand Down

0 comments on commit cb1b2b0

Please sign in to comment.