Skip to content

feat: introduce custom agent companion crate - #2388

Closed
ForeverAngry wants to merge 4 commits into
0xPlaygrounds:mainfrom
ForeverAngry:feature/mcp-server-handler
Closed

feat: introduce custom agent companion crate#2388
ForeverAngry wants to merge 4 commits into
0xPlaygrounds:mainfrom
ForeverAngry:feature/mcp-server-handler

Conversation

@ForeverAngry

@ForeverAngry ForeverAngry commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

This PR introduces a new companion crate rig-custom-agent that demonstrates the Custom Agent pattern for full control over the orchestration loop and telemetry. It provides a flexible, transparent, and DRY alternative for developers who need to customize the agent lifecycle natively.

Changes:

  • Added rig-custom-agent crate to the workspace.
  • Implemented CustomAgent and CustomAgentBuilder demonstrating a simple orchestration loop supporting temperature, max_tokens, additional_params, tool_choice, output_schema, and record_telemetry_content.
  • Updated provider_layout.rs test exemptions to account for the new crate.

Fixes #2393

@ForeverAngry

Copy link
Copy Markdown
Contributor Author

Out-of-Scope CI/Linting Changes

To ensure the CI pipelines pass cleanly, we configured rust-toolchain.toml to include the rustfmt and clippy components, and ran a workspace-wide cargo clippy --fix. This resulted in the following maintenance fixes outside of our custom agent feature:

1. rust-toolchain.toml

  • Added the rustfmt and clippy components to the components array so standard linting can run properly in local and CI environments.

2. rig-core Subcrate Warnings

  • Addressed useless_conversion warnings by removing explicit .into_iter() calls on arguments that already accept IntoIterator. This affected:
    • crates/rig-core/src/json_utils.rs
    • crates/rig-core/src/providers/cohere/embeddings.rs
    • crates/rig-core/src/providers/copilot/mod.rs
    • crates/rig-core/src/providers/ollama.rs
    • crates/rig-core/src/providers/openai/embedding.rs
    • crates/rig-core/src/providers/voyageai.rs

3. Test Suite Warnings (tests/)

  • tests/common/support.rs: Collapsed a nested if block into an outer match statement to resolve a collapsible_match warning.
  • tests/common/cassettes.rs: Converted a loop containing a match block with a break statement into a cleaner while let loop to resolve a while_let_loop warning.

@ForeverAngry

Copy link
Copy Markdown
Contributor Author

Fixes #2393

…handler

# Conflicts:
#	crates/rig-core/src/providers/cohere/embeddings.rs
#	crates/rig-core/src/providers/copilot/mod.rs
#	crates/rig-core/src/providers/ollama.rs
#	crates/rig-core/src/providers/openai/embedding.rs
#	crates/rig-core/src/providers/voyageai.rs
@gold-silver-copper

Copy link
Copy Markdown
Contributor

Hello, for now we want to minimize the amount of crates that are added to the rig codebase, since that is extra surface we have to maintain. We would prefer you to maintain it independently, and we can add it to github.com/0xPlaygrounds/awesome-rig . Perhaps upstreaming it in the future if it is actively maintained and used.

We welcome any changes to rig-core that make it more extensible if necessary for the creation of companion crates. So please open a new PR with the rig-core change, and open a new pr to awesome-rig with your crates.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: introduce custom agent companion crate

2 participants