fromswebot_clientimportSwebotClientclient=SwebotClient("http://localhost:8080")session=client.create_session()# Stream tokensfortokeninsession.stream("explain goroutines"):print(token,end="",flush=True)# Or get the full reply at oncereply=session.send("what is 2+2?")print(reply)
Features
Streaming — real-time token-by-token output via SSE
Tool callbacks — observe tool invocations and results
Context control — compact or clear session context
Skills — list built-in skill agents
Examples
fromswebot_clientimportSwebotClient,ToolCallclient=SwebotClient("http://localhost:8080")client.wait_until_ready(timeout=10)# Set mode to autonomous so the agent executes (not plans)client.set_mode("autonomous")# Enable extended thinkingclient.set_thinking("high")# Switch modelclient.set_model("claude-opus-4-5")# Create a session and send a messagesession=client.create_session(agent="developer")defon_tool(tc:ToolCall):print(f" ⚙ {tc.name}")reply=session.send_with_events("create a hello.py file",on_tool_start=on_tool,)# Read todosfortodoinsession.get_todos():print(f"[{todo.status}] {todo.title}")# Token usageusage=session.token_usage()print(f"Tokens: {usage['tokens_in']:,} in / {usage['tokens_out']:,} out ({usage['usage_pct']}%)")
Pipeline example
fromswebot_clientimportSwebotClientclient=SwebotClient()client.wait_until_ready()client.set_mode("autonomous")# Stage 1: generates1=client.create_session()code=s1.send("Write a Python prime sieve for 0-1000000")# Stage 2: reviews2=client.create_session("code_auditor")review=s2.send(f"Review this code:\n{code}")print(review)
API reference
SwebotClient(addr="http://localhost:8080")
No token needed for local use. If the backend was started with --token,
set SWEBOT_TOKEN in your environment — the SDK reads it automatically.
Sessions
Method
Description
create_session(agent)
Create a new session → Session
get_session(id)
Resume an existing session → Session
list_sessions()
List all sessions
delete_session(id)
Delete a session
Agents / Providers / Models
Method
Description
list_agents()
List available agents
get_agent(name)
Get agent details (name, system_prompt, tools)
list_providers()
List LLM providers
list_models(provider)
List models for a provider → {provider, active, models}
set_model(model, provider)
Switch model (and optionally provider)
Mode / Thinking / Reasoning
Method
Description
get_mode()
Current mode (plan, agent, autonomous)
set_mode(mode)
Set mode: "plan", "agent", "autonomous"
get_thinking()
Current thinking level
set_thinking(level)
Set thinking: "", "low", "medium", "high"
get_reasoning()
Current reasoning depth
set_reasoning(level)
Set reasoning: "low", "medium", "high"
MCP Servers
Method
Description
list_mcp()
List MCP servers with connection state
add_mcp(name, ...)
Add a new MCP server
update_mcp(name, ...)
Update an existing server
delete_mcp(name)
Remove a server
enable_mcp(name)
Enable a disabled server
disable_mcp(name)
Disable without removing
reload_mcp()
Reconnect all enabled servers
Plugins
Method
Description
list_plugins()
List installed plugins
install_plugin(url)
Install from GitHub (owner/repo)
remove_plugin(name)
Uninstall a plugin
enable_plugin(name)
Re-enable a disabled plugin
disable_plugin(name)
Disable without removing
AgentSpeak (Multi-Agent)
Method
Description
agentspeak_status()
Connection status → {connected, project, role, url}