Skip to main content

Module core

Module core 

Source
Expand description

Core types and traits — available via brainwires::core::* or brainwires::prelude::*.

Modules§

content_source
Content source types for tracking where content originates.
embedding
Embedding provider trait for vector operations. Unified embedding abstraction
error
Framework error types and result aliases. Framework error types
graph
Knowledge graph types: entities, edges, and trait interfaces. Graph types and traits for knowledge graph abstraction.
lifecycle
Lifecycle hooks for intercepting framework events. Lifecycle Hooks
message
Message, role, and streaming types for AI conversations.
output_parser
Structured output parsers for LLM responses. Structured output parsing for LLM responses
permission
Permission mode definitions. Permission mode types
plan
Plan metadata, steps, budgets, and serializable plans.
plan_parser
Plan text parser for extracting steps from LLM output. Plan Parser - Extract tasks from plan content
provider
Provider configuration and chat options.
task
Task, priority, and agent response types.
tool
Tool definitions, schemas, contexts, and idempotency.
vector_store
Vector store trait for similarity search. Vector store abstraction
working_set
Working set for file context management with LRU eviction. Working Set for File Context Management

Structs§

AgentResponse
Agent response after processing
ChatOptions
Chat completion options
ChatResponse
Response from a chat completion
CommitResult
Result returned by a successful StagingBackend::commit.
GraphEdge
An edge in the relationship graph.
GraphNode
A node in the relationship graph.
IdempotencyRecord
Record of a completed idempotent write operation.
IdempotencyRegistry
Shared registry that deduplicates mutating file-system tool calls within a run.
JsonListParser
Extracts a list of items from a JSON array in the LLM response.
JsonOutputParser
Extracts JSON from LLM responses and deserializes into T.
Message
A message in the conversation
ParsedStep
A parsed step from plan content
PlanBudget
Budget constraints that a serializable plan must satisfy before execution begins. Used in TaskAgentConfig::plan_budget.
PlanMetadata
Metadata for a persisted execution plan
PlanStep
A single step in a serializable pre-execution plan.
RegexOutputParser
Parses LLM output using a regex pattern with named capture groups.
SerializablePlan
A serializable execution plan produced by the agent before any side effects occur. When TaskAgentConfig::plan_budget is set, the agent generates this plan in a separate provider call and validates it against the budget; if the budget is exceeded the run fails immediately with FailureCategory::PlanBudgetExceeded.
StagedWrite
A single write operation that has been staged but not yet committed.
Task
A task being executed by an agent (supports tree structure)
Tool
A tool that can be used by the AI agent
ToolContext
Execution context for a tool.
ToolInputSchema
JSON Schema for tool input
ToolResult
Result of a tool execution
ToolUse
A tool use request from the AI
Usage
Usage statistics for a chat completion
VectorSearchResult
Result from a vector similarity search.
WorkingSet
Manages the set of files currently in the agent’s context
WorkingSetConfig
Working set configuration
WorkingSetEntry
A file entry in the working set

Enums§

ContentBlock
Content block for structured messages
ContentSource
Trust level / origin of content injected into an agent’s context.
EdgeType
Types of edges in the relationship graph.
EntityType
Types of entities tracked in the knowledge graph.
FrameworkError
Core framework errors
ImageSource
Image source for image content blocks
MessageContent
Message content can be simple text or complex structured content
PermissionMode
Permission mode for tool execution
PlanStatus
Status of a plan
Role
Role of the message sender
StreamChunk
Streaming chunk from a chat completion
TaskPriority
Task priority levels
TaskStatus
Task status
ToolCaller
Specifies which contexts can invoke a tool. Implements Anthropic’s allowed_callers pattern for programmatic tool calling.
ToolMode
Tool selection mode

Traits§

EmbeddingProvider
Trait for text embedding generation.
EntityStoreT
Trait for querying an entity store.
OutputParser
Trait for parsing structured output from LLM text responses.
Provider
Base provider trait for AI providers
RelationshipGraphT
Trait for querying a relationship graph.
StagingBackend
Trait for staging write operations before committing to the filesystem.
VectorStore
Trait for vector database operations.

Functions§

estimate_tokens
Estimate tokens for a string (rough: ~4 chars per token)
estimate_tokens_from_size
Estimate tokens for a file by size
parse_plan_steps
Parse plan content into structured steps
serialize_messages_to_stateless_history
Serialize a slice of Messages into the STATELESS protocol format for conversation history.
steps_to_tasks
Convert parsed steps into Task objects

Type Aliases§

FrameworkResult
Result type alias using FrameworkError