TouchDesigner Agent is an open-source TCP bridge created and maintained by Bo-Ning Li. It lets AI coding agents control TouchDesigner remotely — query nodes, write GLSL shaders, check compile errors, and iterate autonomously.
Project notes: boningli.com/blog/touchdesigner-agent
TouchDesigner is powerful for real-time visuals, but its node-based workflow can be slow for shader-heavy projects. This bridge lets you describe effects in natural language, have an AI agent write the GLSL, and see results instantly in TD — with automatic compile-error feedback so the agent can self-debug.
In your TD project:
- Create a TCP/IP DAT — set Role =
Server, Port =7000 - Create a Text DAT — name it
callbacks, paste the contents oftd-setup/callbacks.py - Link them — in the TCP/IP DAT's parameters, set Callbacks DAT =
callbacks
The status should show listening on port 7000.
from bridge.client import TDClient
td = TDClient() # connects to localhost:7000
# Query any TD state
td.query("op('/project1/glsl1').type") # → 'glsl'
td.list_nodes("/project1") # → ['glsl1', 'noise1', ...]
# Write a compute shader directly into a DAT
td.write_glsl("/project1/glsl1_compute", """
void main() {
const uint id = TDIndex();
// ...your GLSL here...
P[id] = vec3(0.0);
}
""")
# Check if it compiles
result = td.glsl_check("/project1/glsl1")
print(result["ok"]) # True / False
print(result["errors"]) # compile error string if anyAll shader code lives as local .glsl files in a shaders/ folder inside your TD project directory — synced to TD automatically. This way everything stays in Git and can be edited by any tool (other AIs, text editors, etc.) without opening TD.
# Creates {project_dir}/shaders/particle_compute.glsl + a synced Text DAT in TD
td.setup_shader('particle_compute', project_dir='C:/Projects/my_td_project', initial_code="""
void main() {
// your GLSL here
}
""")This does three things:
- Creates
shaders/particle_compute.glslin your project directory - Creates a Text DAT (
particle_compute) in TD pointing to that file - Enables sync mode — TD auto-reloads whenever the file changes
# Just write to the file — TD picks up changes automatically
td.write_glsl_file('C:/Projects/my_td_project/shaders/particle_compute.glsl', new_code)
# Check if it compiles
result = td.glsl_check('/project1/glsl1')
print(result["ok"], result["errors"])The TCP server accepts single-line text commands and returns single-line JSON:
| Command | Description | Response |
|---|---|---|
<expression> |
Evaluate Python expression in TD | {"result": "..."} |
exec:<code> |
Execute Python statement | {"ok": true} |
glsl_check:<path> |
Refresh inputs + return compile errors | {"ok": true/false, "errors": "...", ...} |
bridge/
client.py # Python client for external agents
td-setup/
callbacks.py # Paste into TD's Text DAT
CLAUDE.md # Agent instructions
MIT