ProjectSchema

Struct ProjectSchema 

Source
pub struct ProjectSchema {
    pub id: Uuid,
    pub version: String,
    pub name: String,
    pub description: String,
    pub settings: ProjectSettings,
    pub agents: HashMap<String, AgentSchema>,
    pub tools: HashMap<String, ToolSchema>,
    pub tool_configs: HashMap<String, ToolConfig>,
    pub workflow: WorkflowSchema,
    pub created_at: DateTime<Utc>,
    pub updated_at: DateTime<Utc>,
}
Expand description

Complete project schema

Fields§

§id: Uuid§version: String§name: String§description: String§settings: ProjectSettings§agents: HashMap<String, AgentSchema>§tools: HashMap<String, ToolSchema>§tool_configs: HashMap<String, ToolConfig>§workflow: WorkflowSchema§created_at: DateTime<Utc>§updated_at: DateTime<Utc>

Implementations§

Source§

impl ProjectSchema

Source

pub fn new(name: impl Into<String>) -> Self

Examples found in repository?
examples/codegen_demo.rs (line 67)
66fn simple_chat_project() -> ProjectSchema {
67    let mut p = ProjectSchema::new("simple_chat");
68    p.agents.insert(
69        "chat_agent".to_string(),
70        AgentSchema {
71            agent_type: AgentType::Llm,
72            model: Some("gemini-2.0-flash".to_string()),
73            instruction:
74                "You are a helpful, friendly assistant. Answer questions clearly and concisely."
75                    .to_string(),
76            tools: vec![],
77            sub_agents: vec![],
78            position: Default::default(),
79            max_iterations: None,
80            routes: vec![],
81        },
82    );
83    p.workflow.edges.push(adk_studio::schema::Edge {
84        from: "START".to_string(),
85        to: "chat_agent".to_string(),
86        condition: None,
87    });
88    p.workflow.edges.push(adk_studio::schema::Edge {
89        from: "chat_agent".to_string(),
90        to: "END".to_string(),
91        condition: None,
92    });
93    p
94}
95
96fn research_pipeline_project() -> ProjectSchema {
97    let mut p = ProjectSchema::new("research_pipeline");
98
99    // Sub-agents
100    p.agents.insert(
101        "researcher".to_string(),
102        AgentSchema {
103            agent_type: AgentType::Llm,
104            model: Some("gemini-2.0-flash".to_string()),
105            instruction:
106                "Research the topic using Google Search. Gather key facts and recent developments."
107                    .to_string(),
108            tools: vec!["google_search".to_string()],
109            sub_agents: vec![],
110            position: Default::default(),
111            max_iterations: None,
112            routes: vec![],
113        },
114    );
115    p.agents.insert(
116        "summarizer".to_string(),
117        AgentSchema {
118            agent_type: AgentType::Llm,
119            model: Some("gemini-2.0-flash".to_string()),
120            instruction: "Summarize the research into key takeaways and conclusions.".to_string(),
121            tools: vec![],
122            sub_agents: vec![],
123            position: Default::default(),
124            max_iterations: None,
125            routes: vec![],
126        },
127    );
128
129    // Sequential container
130    p.agents.insert(
131        "pipeline".to_string(),
132        AgentSchema {
133            agent_type: AgentType::Sequential,
134            model: None,
135            instruction: String::new(),
136            tools: vec![],
137            sub_agents: vec!["researcher".to_string(), "summarizer".to_string()],
138            position: Default::default(),
139            max_iterations: None,
140            routes: vec![],
141        },
142    );
143
144    p.workflow.edges.push(adk_studio::schema::Edge {
145        from: "START".to_string(),
146        to: "pipeline".to_string(),
147        condition: None,
148    });
149    p.workflow.edges.push(adk_studio::schema::Edge {
150        from: "pipeline".to_string(),
151        to: "END".to_string(),
152        condition: None,
153    });
154    p
155}
156
157fn content_refiner_project() -> ProjectSchema {
158    let mut p = ProjectSchema::new("content_refiner");
159
160    p.agents.insert(
161        "improver".to_string(),
162        AgentSchema {
163            agent_type: AgentType::Llm,
164            model: Some("gemini-2.0-flash".to_string()),
165            instruction: "Improve the content: fix errors, enhance clarity, improve flow."
166                .to_string(),
167            tools: vec![],
168            sub_agents: vec![],
169            position: Default::default(),
170            max_iterations: None,
171            routes: vec![],
172        },
173    );
174    p.agents.insert(
175        "reviewer".to_string(),
176        AgentSchema {
177            agent_type: AgentType::Llm,
178            model: Some("gemini-2.0-flash".to_string()),
179            instruction:
180                "Review content quality. Call exit_loop when polished, otherwise continue."
181                    .to_string(),
182            tools: vec!["exit_loop".to_string()],
183            sub_agents: vec![],
184            position: Default::default(),
185            max_iterations: None,
186            routes: vec![],
187        },
188    );
189
190    // Loop container
191    p.agents.insert(
192        "refiner".to_string(),
193        AgentSchema {
194            agent_type: AgentType::Loop,
195            model: None,
196            instruction: String::new(),
197            tools: vec![],
198            sub_agents: vec!["improver".to_string(), "reviewer".to_string()],
199            position: Default::default(),
200            max_iterations: Some(3),
201            routes: vec![],
202        },
203    );
204
205    p.workflow.edges.push(adk_studio::schema::Edge {
206        from: "START".to_string(),
207        to: "refiner".to_string(),
208        condition: None,
209    });
210    p.workflow.edges.push(adk_studio::schema::Edge {
211        from: "refiner".to_string(),
212        to: "END".to_string(),
213        condition: None,
214    });
215    p
216}
217
218fn parallel_analyzer_project() -> ProjectSchema {
219    let mut p = ProjectSchema::new("parallel_analyzer");
220
221    p.agents.insert(
222        "sentiment".to_string(),
223        AgentSchema {
224            agent_type: AgentType::Llm,
225            model: Some("gemini-2.0-flash".to_string()),
226            instruction: "Analyze sentiment: positive/negative/neutral with key emotional tones."
227                .to_string(),
228            tools: vec![],
229            sub_agents: vec![],
230            position: Default::default(),
231            max_iterations: None,
232            routes: vec![],
233        },
234    );
235    p.agents.insert(
236        "entities".to_string(),
237        AgentSchema {
238            agent_type: AgentType::Llm,
239            model: Some("gemini-2.0-flash".to_string()),
240            instruction: "Extract entities: people, organizations, locations, dates.".to_string(),
241            tools: vec![],
242            sub_agents: vec![],
243            position: Default::default(),
244            max_iterations: None,
245            routes: vec![],
246        },
247    );
248
249    // Parallel container
250    p.agents.insert(
251        "analyzer".to_string(),
252        AgentSchema {
253            agent_type: AgentType::Parallel,
254            model: None,
255            instruction: String::new(),
256            tools: vec![],
257            sub_agents: vec!["sentiment".to_string(), "entities".to_string()],
258            position: Default::default(),
259            max_iterations: None,
260            routes: vec![],
261        },
262    );
263
264    p.workflow.edges.push(adk_studio::schema::Edge {
265        from: "START".to_string(),
266        to: "analyzer".to_string(),
267        condition: None,
268    });
269    p.workflow.edges.push(adk_studio::schema::Edge {
270        from: "analyzer".to_string(),
271        to: "END".to_string(),
272        condition: None,
273    });
274    p
275}
276
277fn support_router_project() -> ProjectSchema {
278    let mut p = ProjectSchema::new("support_router");
279
280    // Router
281    p.agents.insert(
282        "router".to_string(),
283        AgentSchema {
284            agent_type: AgentType::Router,
285            model: Some("gemini-2.0-flash".to_string()),
286            instruction: "Classify request as: technical, billing, or general.".to_string(),
287            tools: vec![],
288            sub_agents: vec![],
289            position: Default::default(),
290            max_iterations: None,
291            routes: vec![
292                Route { condition: "technical".to_string(), target: "tech_agent".to_string() },
293                Route { condition: "billing".to_string(), target: "billing_agent".to_string() },
294                Route { condition: "general".to_string(), target: "general_agent".to_string() },
295            ],
296        },
297    );
298
299    // Target agents
300    p.agents.insert(
301        "tech_agent".to_string(),
302        AgentSchema {
303            agent_type: AgentType::Llm,
304            model: Some("gemini-2.0-flash".to_string()),
305            instruction: "You are technical support. Help with coding and bugs.".to_string(),
306            tools: vec![],
307            sub_agents: vec![],
308            position: Default::default(),
309            max_iterations: None,
310            routes: vec![],
311        },
312    );
313    p.agents.insert(
314        "billing_agent".to_string(),
315        AgentSchema {
316            agent_type: AgentType::Llm,
317            model: Some("gemini-2.0-flash".to_string()),
318            instruction: "You are billing support. Help with payments and subscriptions."
319                .to_string(),
320            tools: vec![],
321            sub_agents: vec![],
322            position: Default::default(),
323            max_iterations: None,
324            routes: vec![],
325        },
326    );
327    p.agents.insert(
328        "general_agent".to_string(),
329        AgentSchema {
330            agent_type: AgentType::Llm,
331            model: Some("gemini-2.0-flash".to_string()),
332            instruction: "You are general support. Help with general questions.".to_string(),
333            tools: vec![],
334            sub_agents: vec![],
335            position: Default::default(),
336            max_iterations: None,
337            routes: vec![],
338        },
339    );
340
341    p.workflow.edges.push(adk_studio::schema::Edge {
342        from: "START".to_string(),
343        to: "router".to_string(),
344        condition: None,
345    });
346    p.workflow.edges.push(adk_studio::schema::Edge {
347        from: "router".to_string(),
348        to: "tech_agent".to_string(),
349        condition: Some("technical".to_string()),
350    });
351    p.workflow.edges.push(adk_studio::schema::Edge {
352        from: "router".to_string(),
353        to: "billing_agent".to_string(),
354        condition: Some("billing".to_string()),
355    });
356    p.workflow.edges.push(adk_studio::schema::Edge {
357        from: "router".to_string(),
358        to: "general_agent".to_string(),
359        condition: Some("general".to_string()),
360    });
361    p.workflow.edges.push(adk_studio::schema::Edge {
362        from: "tech_agent".to_string(),
363        to: "END".to_string(),
364        condition: None,
365    });
366    p.workflow.edges.push(adk_studio::schema::Edge {
367        from: "billing_agent".to_string(),
368        to: "END".to_string(),
369        condition: None,
370    });
371    p.workflow.edges.push(adk_studio::schema::Edge {
372        from: "general_agent".to_string(),
373        to: "END".to_string(),
374        condition: None,
375    });
376    p
377}

Trait Implementations§

Source§

impl Clone for ProjectSchema

Source§

fn clone(&self) -> ProjectSchema

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProjectSchema

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ProjectSchema

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&ProjectSchema> for ProjectMeta

Source§

fn from(p: &ProjectSchema) -> Self

Converts to this type from the input type.
Source§

impl Serialize for ProjectSchema

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,