Skip to main content

check_agent_id

Function check_agent_id 

Source
pub fn check_agent_id(id: &str) -> Result<()>
Expand description

Checks id against the id rules every added agent keeps (spec 3.3 §5.7): the pattern [a-z0-9][a-z0-9-]{0,39} and no reserved id (RESERVED_AGENT_IDS); @ and . never match the pattern. The host’s own targets are the agent table’s to check.

§Errors

Returns a kernel.agent.invalid error.

§Example

use adk_kernel::agents::check_agent_id;

assert!(check_agent_id("finance-2").is_ok());
assert!(check_agent_id("adk-rust").is_err());
assert!(check_agent_id("adk-rust@work").is_err());
assert!(check_agent_id("-finance").is_err());