Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 60 additions & 107 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions crates/agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ async-stream = { workspace = true }
async-trait = { workspace = true }
futures = { workspace = true }
regex = { workspace = true }
# Macro fork of rig (upstream main + with_non_strict_tools() on Responses
# API models). Drop back to crates.io once the patch lands upstream.
rig-core = { git = "https://github.com/macro-inc/rig", branch = "feat/responses-api-non-strict-tools" }
rig-core = "0.41.0"
rig-agent = "0.41.0"
schemars = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
Expand All @@ -38,4 +37,5 @@ tokio-util.workspace = true
model-entity = { path = "../model-entity" }
non_empty = { path = "../non_empty" }
# Enable rig's scripted MockCompletionModel for tests (fake AI streams).
rig-core = { git = "https://github.com/macro-inc/rig", branch = "feat/responses-api-non-strict-tools", features = ["test-utils"] }
rig-core = { version = "0.41.0", features = ["test-utils"] }
rig-agent = { version = "0.41.0", features = ["test-utils"] }
12 changes: 3 additions & 9 deletions crates/agent/src/agent_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::stream::ChatCompletionStream;
use crate::tool_adapter::DynToolSetAdapter;
use ai_toolset::{RequestContext, SearchableTool, ToolLoader, ToolSet as AiToolSet};
use ai_usage::{UsageContext, UsageRecorder};
use rig_agent::tool::server::{ToolServer, ToolServerHandle};
use rig_core::message::Message;
use rig_core::tool::server::{ToolServer, ToolServerHandle};
use std::future::Future;
use std::pin::Pin;
use std::sync::{Arc, Mutex, RwLock};
Expand Down Expand Up @@ -157,10 +157,7 @@ impl AgentLoop {

let handle = ToolServer::new().run();
for adapter in adapters {
handle
.add_tool(adapter)
.await
.expect("failed to register tool");
handle.add_dynamic_tool(adapter).await;
}

// Registers `SearchTools`-discovered tools with the live tool server so
Expand Down Expand Up @@ -200,9 +197,7 @@ impl AgentLoop {
context.clone(),
request_context_rw.clone(),
);
if let Err(e) = handle.add_tool(adapter).await {
tracing::warn!(error = ?e, "failed to load searched tool");
}
handle.add_dynamic_tool(adapter).await;
}
}) as Pin<Box<dyn Future<Output = ()> + Send>>
})
Expand Down Expand Up @@ -259,7 +254,6 @@ impl AgentLoop {
where
Context: Clone + Send + Sync + 'static,
M: rig_core::completion::CompletionModel + 'static,
M::StreamingResponse: rig_core::completion::GetTokenUsage + Send + Sync,
{
self.session_with(
toolset,
Expand Down
Loading
Loading