Privacy Policy and Cookies

By continuing to use our site, you agree to our Privacy Policy and our use of cookies to understand how you use our site, and to improve your experience. Learn More.
I Agree.

Enterprise-Grade AI Workflows in SmartClient: Introducing CoTProcess / CoTTask

Last modified date

Picture of a human pointing towards a chain graph.

SmartClient 15.0 introduces native support for Chain-of-Thought (CoT) AI workflows, making it trivially easy to build complex, production-ready AI systems. This capability powers how SmartClient has delivered advanced tools like Answer Engine and Instant UI in record time.

This new functionality is backportable, if needed, through SmartClient Services.

To show off how easy it is to build a CoT of your own, here is some actual code you can try yourself:

isc.CoTProcess.create({
 introPrompt: 
"You assist in building a SmartClient DataSource 
 to match the user's goal. " +
"The current DataSource definition is: ${json(state.currentDS)}\n",
  goal: "Add fields needed for date-range order search",
  state: { currentDS: { fields: [...] } },
  tasks: [
  { ID:"decide",
    transitions: [ { to: "addField" }, { to:"done" } ]
  },
    { ID:"addField",
      title: "Add Field",
      taskPrompt: "Generate a DataSourceField definition...",
      outputFields: [ /* field validators */ ],
      stateUpdates: "currentDS.fields[]",
      nextElement: "decide"
    },
    { ID:"done", title: "Finish" }
  ]
});

This snippet shows how it can be used to quickly and easily define structured AI behavior with minimal code. If you’ve tried your hand at building AI workflows, you already know how insanely expressive this is. If you haven’t, you’re in for a treat. In just a few paragraphs, we’ll be launching you to the cutting edge.

SmartClient CoT: High-Level Overview

Building AI-driven features in SmartClient is based on defining workflows, not issuing prompts. CoTProcess and CoTTask provide a declarative framework where complex objectives are broken into a sequence of focused, verifiable steps executed by an AI model.

A CoTProcess defines the overall workflow, including shared state, task ordering, and transitions. Each CoTTask represents a single, well-scoped operation with its own prompt, expected output schema, and validation rules. The AI is invoked repeatedly, but always within the constraints of the defined process.

State is shared across tasks, allowing context to accumulate naturally as the workflow progresses. Transitions between tasks are explicit and controlled, ensuring that each step executes with full awareness of prior decisions and outputs.

The framework handles prompt assembly, execution flow, retries, and coordination automatically. Developers focus on defining the intent and structure of the workflow rather than managing control flow or stitching together responses manually. For a deeper dive into how it all works, check out the official documentation here.

Visual of an AI network.

Key Features

1. Prompt Assembly

Prompts are centrally declared and automatically constructed at runtime. Each task prompt can include shared state, prior outputs, validation feedback, and contextual variables without manual concatenation or bookkeeping.

This ensures that every AI invocation receives consistent, structured input derived from the current process state.

2. AI-Driven Transitions

Workflow transitions are defined declaratively and selected by the AI through structured output rather than imperative control logic.

{ ID:"decide",
  transitions: [
   { to: "addField", label: "Add another field" },
   { to: "done", label: "Finish DataSource" }
   ]
}

The AI determines the next step by returning a simple JSON response indicating the desired transition. The framework validates this response and routes execution to the appropriate task automatically.

3. Automatic History & Intent Tracking

Each task execution records relevant history, including prior transitions, successful outputs, and the AI’s stated intent. This history is automatically included in subsequent prompts.

A configurable historyMaxItems limit controls how much prior context is retained, preventing prompt growth while maintaining continuity across steps.

4. Declarative State Management

Task outputs are validated against a defined schema using outputFields. Once validated, outputs are applied to the shared process state using declarative mappings.

{ ID:"addField",
outputFields: [ /* validation schema */ ],
stateUpdates: "currentDS.fields[]",  
// Append to array
// or
stateUpdates: { fieldName: "output.fieldName" }  
// Map outputs to state
}

State updates can append to arrays or map individual output values to specific state paths, eliminating manual state mutation logic.

5. Testing Individual Steps

You can test any individual task by running it in isolation using a fixed state. For example:

process.runTask("addField", {
  state: { currentDS: { fields: [...] } },
  ruleScope: { /* test data */ }
 });

Calling the process above allows you to focus on a single step without executing the entire workflow. This approach makes it easy to fine-tune prompts, validate outputs, and confirm that each step behaves as expected. It is the fastest and most efficient way to develop and debug complex AI workflows before full integration.

6. Mock Mode for Testing

Mock Mode allows you to test workflows without incurring AI usage costs.

 isc.CoTProcess.create({
    mockMode: true,  // Process-wide default
    tasks: [
      { ID: "realTask", mockMode: false },  // Force real AI
      { ID: "mockTask", mockMode: true }    // Force mock
    ]
  });

By setting mockMode: true when creating a process, SmartClient simulates AI responses instead of calling a live model. This lets you test logic, transitions, and state updates quickly and safely. You can also override mock behavior at the task level.

For example, one task can run in real AI mode while others remain mocked, giving you fine-grained control over which parts of the workflow are tested with live responses and which use simulated data.

7. Flexible Engine Selection

You can assign different AI models to different tasks within the same workflow. This flexibility allows you to use smaller or more specialized models for certain steps, improving consistency and reducing overall costs.

Image of a PC and chain graph in the model of a brain.

Why CoTProcess and CoTTask Matter for Enterprise

CoTProcess and CoTTask turn AI behavior into an inspectable execution model rather than an opaque sequence of model calls. Every decision, transition, and state update is recorded as part of the workflow’s execution history.

This traceability enables oversight, accountability, and post-hoc analysis. Teams can review not only what an AI system produced, but which steps were taken, what context was used, and how decisions were made at each point in the process.

Quality assurance and compliance are supported through controlled task design and isolated validation. Individual tasks can be tested, modified, and reviewed independently, reducing the risk of unintended behavioral changes when prompts, policies, or models evolve.

Because workflows are declarative, they are easier to review and approve across engineering, product, legal, and compliance teams. This reduces long-term maintenance risk and supports governance requirements common in regulated enterprise environments.

Where Next?

SmartClient’s CoT framework gives your team the tools to build AI systems that are powerful, auditable, and ready for enterprise deployment. If you’re ready to put that into practice, we’re here to help.

If your development team needs training to better harness AI, we can make that happen. Our developers routinely manage three to five AI systems at once, and we can elevate your team to that same level of productivity and speed.

If you need an AI agent deployed quickly, we can deliver. We use AI to build AI, allowing us to move faster and more efficiently than anyone else.

No matter where you are in your AI journey, we can meet you there and help you take the next step. Tell us what you need, and we will help you make it real.