Add library support for using codey as a Rust dependency#41
Merged
Conversation
- Add lib.rs with public exports for Agent, ToolRegistry, and core types - Add [lib] and [[bin]] sections to Cargo.toml - Add Default impl for AgentRuntimeConfig for easier library usage - Move SUB_AGENT_PROMPT from app.rs to spawn_agent.rs (removes cross-module dependency) - Move CODEY_DIR/TRANSCRIPTS_DIR constants to transcript.rs - Create LIBRARY.md with usage documentation and examples - Re-export commonly used types at crate root for convenience Enables using codey as a library to create custom AI agents with configurable system prompts and tool selections.
- Remove public exposure of built-in tools (too coupled to UI) - Remove public exposure of IDE module - Keep only essential exports: Agent, AgentStep, RequestMode, Usage, AgentRuntimeConfig, ToolRegistry - Update LIBRARY.md with simpler documentation - Add Usage export to llm module The library now focuses on creating agents with custom system prompts. Users who need tool capabilities can implement their own tool layer outside of codey.
- Add SimpleTool struct that implements Tool trait with minimal requirements - Users define name, description, and JSON schema - Tool execution is handled by the user via AgentStep::ToolRequest - Export SimpleTool and ToolCall from lib.rs - Update LIBRARY.md with comprehensive custom tool documentation This enables library users to create agents with custom tools while keeping the implementation simple - they handle tool execution themselves rather than using the internal effect pipeline.
- Add CODEY_DIR and TRANSCRIPTS_DIR constants to config.rs - Create prompts.rs with all system prompts (SYSTEM_PROMPT, COMPACTION_PROMPT, SUB_AGENT_PROMPT, WELCOME_MESSAGE) - Update app.rs to import from config and prompts modules - Update transcript.rs to import paths from config - Update spawn_agent.rs to import prompt from prompts module - Add prompts module to lib.rs and main.rs This removes the cross-module dependencies that required importing from app.rs, making the codebase cleaner and avoiding issues with library builds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables using codey as a library to create custom AI agents with
configurable system prompts and tool selections.