Sorry in advance for not placing more images, I am a new user and I am only allowed to place one…
Ok, so I am trying to understand the following:
- How state Objects and Arrays are supposed to be handled inside agent builder?
- What is the purpose of the Transform Node?
- How can you stringify a state Object or Array to pass it inside the instructions of an agent?
I will demonstrate these questions by showing relevant bugs.
First of all consider the following simple pipeline:
If I define inside the Start node a boolean variable named “yoyo” and inside the if block I have:
if state.yoyo
then on the first user message the flow will go on the bottom side with the else condition and inside set state I set “yoyo” to true.
Then on the second message the flow will correctly go on the top side with the if condition being true.
However, if instead of this boolean variable, I define an object variable inside the Start node named “test_obj” and add a boolean property “yoyo_obj”, then if I do exactly the same thing as before using the “test_obj.yoyo_obj” instead of “yoyo” inside the if block (if state.test_obj.yoyo) and inside the set state block, I get the following error inside the if / else block:
Workflow failed: Error evaluating CEL expression: (“None with type: ‘<class ‘NoneType’>’ does not support field selection”, <class ‘TypeError’>, None). (code: user_error)
Here is the object schema:
{
“name”: “test_obj”,
“type”: “object”,
“properties”: {
“yoyo_obj”: {
“type”: “boolean”
}
},
“additionalProperties”: false,
“required”: [
“yoyo_obj”
]
}
The above mostly relates to question (1) and (2) since the same thing occurs if I want to reference a property of a state object or array inside a transform node.
Now when it comes to (3) using the same example of state.test_obj, it is not clear to me how one can stringify an object or array inside the instruction panel of an agent like so:
Instructions:
Print the following {{state.test_obj}}
I have tried using a transform node to convert the state.test_obj to a string but it forces it to remain an object when trying to do this with the object option. The expression option adding a string(state.test_obj) does not work either
When it comes to (1) and (2) it forces you to not use objects or arrays as state variables, and when it comes to (3) it is an extreme burden for defining system prompts where for example in python you would just stringify an object using f”{object}” and it is very useful for context, say when you have a dictionary that you want to pass on to the system prompt or when you have an array of items and you want the model to know exactly which items you currently have, etc.
Any help / clarification would be greatly appreciated, as it seems to me like improper behaviour.
Thanks in advance!
