Skip to main content

agent_client_protocol_schema/v1/
mod.rs

1//! Agent Client Protocol version 1 types.
2
3mod agent;
4mod client;
5mod content;
6#[cfg(feature = "unstable_elicitation")]
7mod elicitation;
8mod error;
9mod ext;
10#[cfg(feature = "unstable_mcp_over_acp")]
11mod mcp;
12#[cfg(feature = "unstable_nes")]
13mod nes;
14mod plan;
15#[cfg(feature = "unstable_cancel_request")]
16mod protocol_level;
17mod tool_call;
18
19pub use crate::rpc::{JsonRpcMessage, Notification, Request, RequestId};
20pub use agent::*;
21pub use client::*;
22pub use content::*;
23use derive_more::{Display, From};
24#[cfg(feature = "unstable_elicitation")]
25pub use elicitation::*;
26pub use error::*;
27pub use ext::*;
28#[cfg(feature = "unstable_mcp_over_acp")]
29pub use mcp::*;
30#[cfg(feature = "unstable_nes")]
31pub use nes::*;
32pub use plan::*;
33#[cfg(feature = "unstable_cancel_request")]
34pub use protocol_level::*;
35pub use serde_json::value::RawValue;
36pub use tool_call::*;
37
38pub type Response<Result> = crate::rpc::Response<Result, Error>;
39
40use schemars::JsonSchema;
41use serde::{Deserialize, Serialize};
42use std::sync::Arc;
43
44/// A unique identifier for a conversation session between a client and agent.
45///
46/// Sessions maintain their own context, conversation history, and state,
47/// allowing multiple independent interactions with the same agent.
48///
49/// See protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)
50#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq, Hash, Display, From)]
51#[serde(transparent)]
52#[from(Arc<str>, String, &'static str)]
53#[non_exhaustive]
54pub struct SessionId(pub Arc<str>);
55
56impl SessionId {
57    #[must_use]
58    pub fn new(id: impl Into<Arc<str>>) -> Self {
59        Self(id.into())
60    }
61}