Back

Turn a Typeform into an AI Intake Agent: Pt 2 — Breaking Down the Monolith

Jul 06, 2026
Turn a Typeform into an AI Intake Agent: Pt 2 — Breaking Down the Monolith

Introduction to {{item.name}}

In Part 1, we built a conversational form assistant using a single master prompt. While effective, this monolithic approach meant our assistant had to juggle multiple responsibilities at once: deciding what to collect next, maintaining natural conversation, and structuring the final data.

PromptLayer's Agents feature (formerly Workflows) lets us break this down into specialized components, each focused on a specific task. Think of it as moving from a jack-of-all-trades assistant to a coordinated team of specialists, each focused on doing one thing exceptionally well.

The New Architecture: Meet the Specialists

StudyNextStep: The Strategic Analyst

At the heart of our new system is a prompt-template component that analyzes conversations to determine our next move. For every interaction, it examines what information we've gathered and what we still need, producing a simple but powerful decision.

Inputs:

  • Conversation history: The complete chat transcript
  • Form details: Description of required fields and validation rules

The component returns a structured decision that guides our next action:

{
  "continue": boolean,    // Whether to continue data collection
  "next_attribute": string  // Next field to collect or "Submission"
}

This focused approach means better decisions about what information to collect next. Rather than trying to maintain conversation while tracking progress, StudyNextStep has one job: understand where we are in the form-filling process.

The Collector: Conversation Specialist

Our conversation component becomes elegantly simple. It receives exactly what information it needs to collect next and focuses entirely on having a natural interaction with the user. No more juggling internal state or deciding what to ask next - just pure, focused conversation.

Inputs:

  • Conversation history for context
  • Target attribute to collect (provided by the previous agent)
  • Validation rules for that attribute

This specialization allows for more natural dialogue. When your only job is having a good conversation about one specific piece of information, you can focus on making that interaction feel completely natural.

Form Generator: Data Structuring Expert

This specialist activates when StudyNextStep determines we have all needed information. Its expertise lies in transforming natural conversation into structured form data.

Inputs:

  • Complete conversation transcript
  • Form structure definition

Instead of worrying about conversation flow or tracking progress, the Form Generator excels at one thing: accurately extracting and formatting the information shared during the conversation.

How It All Works Together

Picture a well-orchestrated dance. StudyNextStep examines the conversation and makes a decision. Based on this decision, we either engage the Collector for more information or pass control to the Form Generator to structure our data. All of this happens seamlessly - to the user, it still feels like chatting with a single, knowledgeable assistant.

This orchestration happens within PromptLayer's Agent feature. The Agent handles all the routing logic, ensuring that each component receives exactly what it needs and passes its output to the right place.

Benefits Over the Monolithic Approach

Separating our original master prompt into specialized components creates several advantages. Each part becomes simpler and more focused. When a component only needs to do one thing, it tends to do that thing very well.

For example, our StudyNextStep component doesn't need complex conversation rules - it just needs to analyze what information we have. The Collector doesn't need to track overall progress - it just needs to have a good conversation about one specific piece of information. This specialization leads to better performance and more reliable results.

Implementation Notes

The best part? From the user's perspective, nothing changes. We're still using the same Streamlit interface from Part 1. Behind the scenes, we're just routing through PromptLayer's Agent feature instead of a single master prompt. The complexity is hidden, but the benefits are clear.

Conclusion

Breaking down our form assistant into specialized components isn't just about better organization - it's about building a more robust, maintainable, and effective system. Each component can excel at its specific task, leading to better overall performance.

Remember, the goal remains the same: making form-filling feel less like a chore and more like a helpful conversation. This architecture just helps us do it better.

Want to see it in action? Check out our updated example at GitHub. The same Streamlit app now supports both approaches, letting you compare them yourself.

The first platform built for prompt engineering