Skip to main content

cpex_core/extensions/
framework.rs

1// Location: ./crates/cpex-core/src/extensions/framework.rs
2// Copyright 2025
3// SPDX-License-Identifier: Apache-2.0
4// Authors: Teryl Taylor
5//
6// FrameworkExtension — agentic framework context.
7// Mirrors cpex/framework/extensions/framework.py.
8
9use std::collections::HashMap;
10
11use serde::{Deserialize, Serialize};
12
13/// Agentic framework context.
14///
15/// Carries framework identity and graph/workflow metadata.
16/// Immutable — set by the host.
17#[derive(Debug, Clone, Default, Serialize, Deserialize)]
18pub struct FrameworkExtension {
19    /// Framework name (e.g., "langchain", "crewai", "autogen").
20    #[serde(default, skip_serializing_if = "Option::is_none")]
21    pub framework: Option<String>,
22
23    /// Framework version.
24    #[serde(default, skip_serializing_if = "Option::is_none")]
25    pub framework_version: Option<String>,
26
27    /// Node ID in an agent graph/workflow.
28    #[serde(default, skip_serializing_if = "Option::is_none")]
29    pub node_id: Option<String>,
30
31    /// Graph/workflow ID.
32    #[serde(default, skip_serializing_if = "Option::is_none")]
33    pub graph_id: Option<String>,
34
35    /// Framework-specific metadata.
36    #[serde(default)]
37    pub metadata: HashMap<String, serde_json::Value>,
38}