pub struct AgentTraversal { /* private fields */ }Expand description
Main interface for agent graph traversal operations.
Implementations§
Source§impl AgentTraversal
impl AgentTraversal
Sourcepub fn with_rag_provider(self, provider: Arc<dyn RagProvider>) -> Self
pub fn with_rag_provider(self, provider: Arc<dyn RagProvider>) -> Self
Create with a RAG provider.
Sourcepub fn with_global_limits(self, limits: GlobalLimits) -> Self
pub fn with_global_limits(self, limits: GlobalLimits) -> Self
Create with custom global limits.
Sourcepub fn update_document(&self, document: Document) -> Result<()>
pub fn update_document(&self, document: Document) -> Result<()>
Update the internal document with a new copy.
Use this when you’ve added blocks to the original document after creating the AgentTraversal.
Sourcepub fn get_document(&self) -> Result<Document>
pub fn get_document(&self) -> Result<Document>
Get a clone of the internal document.
Sourcepub fn create_session(&self, config: SessionConfig) -> Result<AgentSessionId>
pub fn create_session(&self, config: SessionConfig) -> Result<AgentSessionId>
Create a new agent session.
Sourcepub fn get_session(
&self,
id: &AgentSessionId,
) -> Result<RwLockReadGuard<'_, HashMap<AgentSessionId, AgentSession>>>
pub fn get_session( &self, id: &AgentSessionId, ) -> Result<RwLockReadGuard<'_, HashMap<AgentSessionId, AgentSession>>>
Get a reference to a session.
Sourcepub fn close_session(&self, id: &AgentSessionId) -> Result<()>
pub fn close_session(&self, id: &AgentSessionId) -> Result<()>
Close a session.
Navigate to a specific block.
Sourcepub fn go_back(
&self,
session_id: &AgentSessionId,
steps: usize,
) -> Result<NavigationResult>
pub fn go_back( &self, session_id: &AgentSessionId, steps: usize, ) -> Result<NavigationResult>
Go back in navigation history.
Sourcepub fn expand(
&self,
session_id: &AgentSessionId,
block_id: BlockId,
direction: ExpandDirection,
options: ExpandOptions,
) -> Result<ExpansionResult>
pub fn expand( &self, session_id: &AgentSessionId, block_id: BlockId, direction: ExpandDirection, options: ExpandOptions, ) -> Result<ExpansionResult>
Expand from a block in a given direction.
Sourcepub async fn search(
&self,
session_id: &AgentSessionId,
query: &str,
options: SearchOptions,
) -> Result<RagSearchResults>
pub async fn search( &self, session_id: &AgentSessionId, query: &str, options: SearchOptions, ) -> Result<RagSearchResults>
Perform semantic search (requires RAG provider).
Sourcepub fn find_by_pattern(
&self,
session_id: &AgentSessionId,
role: Option<&str>,
tag: Option<&str>,
label: Option<&str>,
pattern: Option<&str>,
) -> Result<FindResult>
pub fn find_by_pattern( &self, session_id: &AgentSessionId, role: Option<&str>, tag: Option<&str>, label: Option<&str>, pattern: Option<&str>, ) -> Result<FindResult>
Find blocks by pattern (no RAG required).
Sourcepub fn view_block(
&self,
session_id: &AgentSessionId,
block_id: BlockId,
mode: ViewMode,
) -> Result<BlockView>
pub fn view_block( &self, session_id: &AgentSessionId, block_id: BlockId, mode: ViewMode, ) -> Result<BlockView>
View a specific block.
Sourcepub fn view_neighborhood(
&self,
session_id: &AgentSessionId,
) -> Result<NeighborhoodView>
pub fn view_neighborhood( &self, session_id: &AgentSessionId, ) -> Result<NeighborhoodView>
View the neighborhood around the current cursor position.
Sourcepub fn find_path(
&self,
session_id: &AgentSessionId,
from: BlockId,
to: BlockId,
max_length: Option<usize>,
) -> Result<Vec<BlockId>>
pub fn find_path( &self, session_id: &AgentSessionId, from: BlockId, to: BlockId, max_length: Option<usize>, ) -> Result<Vec<BlockId>>
Find a path between two blocks.
Sourcepub fn context_add(
&self,
session_id: &AgentSessionId,
block_id: BlockId,
_reason: Option<String>,
_relevance: Option<f32>,
) -> Result<()>
pub fn context_add( &self, session_id: &AgentSessionId, block_id: BlockId, _reason: Option<String>, _relevance: Option<f32>, ) -> Result<()>
Add a block to the context window.
Sourcepub fn context_add_results(
&self,
session_id: &AgentSessionId,
) -> Result<Vec<BlockId>>
pub fn context_add_results( &self, session_id: &AgentSessionId, ) -> Result<Vec<BlockId>>
Add all last results to context.
Sourcepub fn context_remove(
&self,
session_id: &AgentSessionId,
_block_id: BlockId,
) -> Result<()>
pub fn context_remove( &self, session_id: &AgentSessionId, _block_id: BlockId, ) -> Result<()>
Remove a block from context.
Sourcepub fn context_clear(&self, session_id: &AgentSessionId) -> Result<()>
pub fn context_clear(&self, session_id: &AgentSessionId) -> Result<()>
Clear the context window.
Sourcepub fn context_focus(
&self,
session_id: &AgentSessionId,
block_id: Option<BlockId>,
) -> Result<()>
pub fn context_focus( &self, session_id: &AgentSessionId, block_id: Option<BlockId>, ) -> Result<()>
Set focus block.