Branching
Test alternative prompts or tools side-by-side. Create new execution branches from any step.
Git for Agents
Just like Git lets you create branches to test code changes, Sentrial lets you create branches to test agent behavior changes. Fork from any point, try different approaches, and merge what works.
Why Branching?
๐งช A/B Test Prompts
Found a step where your agent struggles? Branch from that point and try a different prompt to see if it performs better.
๐ง Test Tool Changes
Replace a tool with an alternative and compare performance side-by-side without affecting production.
๐ Explore "What If?"
What if your agent chose differently at step 15? Branch and see where that path leads.
How Branching Works
Visual Example
Step-by-Step
- 1Select a branch point - Choose any event in the timeline
- 2Create branch - Fork the execution from that point
- 3Make changes - Modify prompts, tools, or parameters
- 4Run & compare - Execute the new branch and compare results
Creating Branches (Dashboard)
The easiest way to create branches is through the web dashboard:
- Open a session - Navigate to any completed session in your dashboard
- Find the branch point - Scrub through the timeline to find where you want to branch
- Click "Create Branch" - Button appears when hovering over events
- Modify & run - Make your changes in the branch editor and execute
Creating Branches (API)
For programmatic branching, use the SDK:
from sentrial import SentrialClient
client = SentrialClient(api_key="...", project_id="...")
# Create a branch from a specific event
branch_session_id = client.create_branch(
parent_session_id="session_123",
branch_from_event_index=12, # Branch from step 12
name="Test Alternative Prompt",
modifications={
"prompt": "New improved prompt...",
"temperature": 0.7
}
)
# Continue execution from the branch point
# with your modifications
client.track_tool_call(
session_id=branch_session_id,
tool_name="search_kb",
...
)
# Compare results
original = client.get_session("session_123")
branched = client.get_session(branch_session_id)
print(f"Original success rate: {original['success_rate']}")
print(f"Branch success rate: {branched['success_rate']}")Use Cases
Prompt Engineering
Your agent struggles with a specific type of question. Branch from where it fails and test different prompts until you find one that works.
Tool Optimization
Compare different tool implementations or APIs side-by-side.
Safety Testing
Test edge cases and failure modes without running full production flows.
Merging Branches
Once you've validated that a branch performs better, you can merge it:
Safe Merges
Sentrial analyzes both branches and helps you merge changes safely, ensuring improvements don't break existing functionality.
- Automatic conflict detection
- Performance comparison metrics
- Rollback if issues detected
# Compare branch performance
comparison = client.compare_sessions(
session_id_a="original_session",
session_id_b="branch_session"
)
# If branch is better, merge it
if comparison["branch_b_better"]:
client.merge_branch(
target="production",
branch_session_id="branch_session",
auto_rollback=True # Rollback if issues detected
)Coming Soon
Full branching and merging features are currently in beta. Advanced merge strategies and automated testing will be available soon.
