Every feature in Termitty is designed specifically for AI agents and automation. 100% open source and built by the community.
Get terminal state as structured JSON/YAML instead of raw text. Perfect for LLM processing and decision making.
state = session.state.terminal.get_structured_state()
# Returns:
{
"screen": {"text": "...", "cursor": {"row": 10, "col": 25}},
"detected_elements": [
{"type": "prompt", "text": "user@server:~$"},
{"type": "error", "text": "Permission denied"}
],
"context": {"working_directory": "/home/user"}
}
AI agents can wait for specific conditions instead of arbitrary timeouts. No more flaky sleep() calls in automation scripts.
# Wait intelligently, not with sleep()
session.execute('./deploy.sh', wait=False)
session.wait_until(OutputContains('Deployment complete'))
session.wait_until(PromptReady())
# Custom AI logic
session.wait_until(
lambda s: 'error' not in s.terminal.get_screen_text().lower()
)
Record expert terminal sessions and replay them. Perfect for creating AI training datasets from real interactions.
# Record expert debugging session
session.start_recording('expert_debug.json')
# Expert performs complex debugging
session.stop_recording()
# AI learns from recordings
session.replay_recording('expert_debug.json')
ai_model.train_on_session(recording_data)
AI can handle sudo passwords, SSH keys, 2FA tokens, and any interactive prompts automatically.
# AI handles authentication prompts
session.execute('sudo systemctl restart nginx', wait=False)
if session.wait_until(TextContains('[sudo] password')):
session.send_line(vault.get_password(), secure=True)
# Handle 2FA
if session.wait_until(TextContains('2FA token')):
session.send_line(vault.get_2fa_token())
Complete ANSI support with virtual terminal. AI can "see" exactly what humans see in the terminal.
# AI sees the full terminal state
with session.interactive_shell() as shell:
shell.send_line('htop')
# AI can read the htop interface
screen = shell.get_screen_text()
cpu_usage = parse_htop_output(screen)
if cpu_usage > 90:
shell.send_key('q') # Quit htop
# AI takes action based on what it sees
Execute commands across multiple servers simultaneously with intelligent coordination and error handling.
from termitty.parallel import ConnectionPool
pool = ConnectionPool(['web-01', 'web-02', 'web-03'])
# Rolling deployment with AI monitoring
results = pool.execute_on_all(
'sudo systemctl restart app',
strategy='rolling',
batch_size=1,
on_error=ai_error_handler
)
Maintain working directory, environment variables, and shell state across commands. AI understands the full context.
# Context is preserved across commands
session.execute('cd /var/log')
session.execute('export DEBUG=1')
session.execute('ls -la') # Runs in /var/log with DEBUG=1
# AI knows the current context
state = session.state.terminal.get_structured_state()
print(state['context']['working_directory']) # /var/log
Works with any SSH-accessible system - AWS, GCP, Azure, on-premises, containers, or edge devices.
# Works everywhere SSH works
environments = [
{'host': 'aws-instance.amazonaws.com', 'type': 'aws'},
{'host': 'gcp-vm.googlecloud.com', 'type': 'gcp'},
{'host': 'container-host', 'type': 'docker'},
{'host': 'edge-device.local', 'type': 'iot'}
]
for env in environments:
with TermittySession() as session:
session.connect(env['host'])
# Same API works everywhere
Join the open source community building the future of AI infrastructure automation.