-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xrx state machine initial draft #24
base: main
Are you sure you want to change the base?
Conversation
Extra notes: the agent appears to get "stuck" after applying guardrails a single time. That is to say, if you try to do something unrelated to the current state and the agent stops you, you can no longer switch between flows - the agent will stop you every time. I think it's getting too hung up on the conversation history. I think the cleanest way around this may be to have a separate graph node that intercepts the output of the RespondToUser node and replaces it if the latest question and answer are unrelated to the objective of the current state machine node. We'd explicitly not include the rest of the conversation here to make sure the agent doesn't get thrown off. @chrislott what do you think? |
also - I think it's probably worth having a separate node type for the initial 'query' flow (the one that describes the options to the user and asks the user what they want to do). as it stands modeling this as its own flow seems to confuse the agent with its vagueness; the agent uses it to circumvent the state guardrails a lot |
…ide of the state machine
[Feature] Enhance Shopify App with Comprehensive Reasoning Agent Capabilities 1. Overview
2. Files Modified
3. Issues/ImprovementsSecurity. Potential exposure of sensitive state information.- **Specific security concern:** The state machine maintains sensitive user session data which, if exposed, could lead to data breaches. - **Specific mitigation needed:** Implement encryption for state data at rest and in transit. Ensure access controls are in place to restrict unauthorized access to session information.Performance. Increased load due to additional reasoning processes.- **Specific performance impact:** The introduction of new reasoning nodes and state machine checks may lead to higher CPU and memory usage, potentially affecting response times. - **Specific optimization needed:** Optimize asynchronous operations and implement caching strategies where feasible. Conduct performance testing to identify and address bottlenecks.Maintainability. Complexity introduced by extensive state management.- **Specific maintainability concern:** The expanded state machine and additional reasoning nodes increase the codebase complexity, making it harder to maintain and extend. - **Specific improvement needed:** Refactor code to modularize state management logic, add comprehensive documentation, and implement unit tests to ensure code reliability.Simplification. Redundant state checks in multiple nodes.- **Specific simplification opportunity:** Multiple nodes perform similar state validations, leading to redundant code. - **Specific refactoring needed:** Consolidate state validation logic into a shared utility or base class to reduce duplication and streamline maintenance. |
XRX State Machine
The purpose of this PR is to add a backing state machine to the xrx reasoning agent. A sample state machine has been fully integrated into
shopify-app
. With this change the agent (mostly) appears to be able to:Testing
No special setup is needed for the state machine; just pull the branches down for xrx-sample-apps and xrx-core and play around with
shopify-app
as usual. The agent will log what state it's in and will use a 'transition-state' node to transition when appropriate.A flow is a graph of steps. Each flow has an 'initial' step, which is the step the agent starts in when it starts the flow. There are three sample flows in
shopify-app/reasoning/app/agent/flows.yaml
- one for buying a product from the store, one for submitting an app to be listed in the store, and one initial flow for figuring out what the user wants to do. The agent will move between these flows as necessary. It will abandon the flow it's on and start a new one if you ask it to.Feel free to tinker with
flows.yaml
to add your own flows. The format should be self-explanatory, but if you have questions just shoot me a slack!To demonstrate the capabilities of the state machine, I recorded four sample conversations I had with
shopify-app
usinginteractive-test.py
. These are inshopify-app/reasoning/app/agent/sample_conversations
. Feel free to replicate these yourself. If you can't, or if anything looks weird, please let me know!TODOs & Cleanup Work
interactive-test.py
: the response logging was outputting the entire structure of the state machine - including all flows, states, and transitions - on every response, which made responses very hard to read. I rigged something to redact the state machine from the session variable on output; this can probably be made configurable if we want a general way to say "this variable is huge so don't output it please" (chris - what do you think?)remove various debug cruft (mostly pdb imports)Next Steps