View source: R/shared_session.R
| create_shared_session | R Documentation |
Factory function to create a new SharedSession object.
create_shared_session(
model = NULL,
system_prompt = NULL,
tools = NULL,
hooks = NULL,
max_steps = 10,
sandbox_mode = "strict",
trace_enabled = TRUE
)
model |
A LanguageModelV1 object or model string ID. |
system_prompt |
Optional system prompt. |
tools |
Optional list of Tool objects. |
hooks |
Optional HookHandler object. |
max_steps |
Maximum tool execution steps. Default 10. |
sandbox_mode |
Sandbox mode: "strict", "permissive", or "none". Default "strict". |
trace_enabled |
Enable execution tracing. Default TRUE. |
A SharedSession object.
if (interactive()) {
# Create a shared session for multi-agent use
session <- create_shared_session(
model = "openai:gpt-4o",
sandbox_mode = "strict",
trace_enabled = TRUE
)
# Execute code safely
result <- session$execute_code("x <- 1:10; mean(x)")
# Check trace
print(session$trace_summary())
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.