Forjinn Docs

Development Platform

Documentation v2.0
Made with
by Forjinn

Autogen

Learn about autogen and how to implement it effectively.

3 min read
🆕Recently updated
Last updated: 12/9/2025

AutoGen: How to Use and Available Options

AutoGen lets you automatically generate, fix, and document code or content—using simple instructions inside your workflow.


Quick Start: Using AutoGen in Your Workflow

  1. Open your flow and drag in an AutoGen node (CodeGenAgent, CodeWriter, CodeRepair, etc.) from the component library.
  2. Click to write the prompt or instruction—describe what you want (generate code, fix snippet, write FAQ, etc.).
  3. Set output options (code type, format, test cases).
  4. Connect follow-up nodes for validation, review, or output.
  5. Save and run your workflow. Results show instantly for review and action.

Available Options for Users

  • Choose from preset AutoGen agent types (CodeGenAgent, DocGenAgent, etc.)
  • Customize prompts/instructions in natural language
  • Require structured or free-form output
  • Chain AutoGen output to evaluation, test, or human input nodes
  • Use variables for dynamic context ({{userInput}}, {{lastAnswer}})
  • Set max tokens and output format (markdown, JSON, plain text)
  • Pause for user review before next steps

What is AutoGen?

  • A set of specialized nodes, prompts, and workflows that enable LLMs to:
    • Generate programming code (Python, JS, Bash, SQL, etc.)
    • Fix code errors or refactor user-submitted snippets
    • Produce documentation, markdowns, or step-by-step recipes
    • Fill out structured forms or data models by reasoning through the problem
  • Integrated in Forjinn as a node category (AutoGen) and as preset agent patterns (e.g., CodeGenAgent, DocGenAgent).

When to Use AutoGen

  • Need dynamic code generated on-the-fly ("Write me a function to sort a list")
  • Building assistants that answer coding/technical questions
  • Automating generation/repair of scripts, pipelines, or CI configs
  • Producing structured knowledge (FAQs, recipes, etc) from natural language input
  • Multi-step coding tasks (write/test/document a function)

How to Configure AutoGen in a Workflow

1. Add an AutoGen Node

  • Drag a AutoGen node (CodeGenAgent, CodeWriter, CodeRepair, etc.) from the component library to your canvas.

2. Write the Prompt (Instruction)

  • Configure the prompt that tells the model what to generate.
    • Example: "Write a Python function that checks if an email address is valid."
    • Advanced: Pass user input, previous context, or data as variables: {{userRequest}}, {{previousAnswer}}.

3. (Optional) Set Structured Output

  • Use the structured output feature to require code blocks, explanations, and test cases in a specified format (e.g., JSON schema or markdown sections).

4. Connect to Evaluation/Test Nodes

  • To validate generated code, connect to a Code Interpreter/Evaluator node for runtime verification.
  • To display results, route output to Chat Output or storage.

5. Workflow Example

DevOps Automation Flow:

  1. User asks: "Generate a bash script to back up PostgreSQL with gzip compression"
  2. AutoGen Node: Generates the script code, explains usage.
  3. Evaluator Node: Checks syntax (optionally, runs in sandbox if enabled).
  4. Output Node: Delivers ready-to-use script or actionable error.

Advanced Usage

  • Two-Step Generation: Use AutoGen for code, then a follow-up node for test case generation or documentation synthesis.
  • Chaining with Human Input: After generation, pause for user review or require explicit approval before running code.
  • Error Loop: If code fails tests, automatically re-prompt the model with the error message for correction.

Best Practices

  • Use clear, context-rich prompts—specify desired language, constraints, doc style.
  • Limit max tokens and set API budget/failover for long generations.
  • Use code block delimiters (```python) in structured output for better parsing.
  • Always sandbox or review generated code before executing in production!

Troubleshooting

  • If output is cut off, increase max tokens or split prompts into smaller steps.
  • For non-compiling code, rephrase the prompt for clarity or include "add a test case."
  • If code is not properly formatted, use structured output features or provide an example in the prompt.

Related Links


AutoGen combines LLM creativity and automation, driving new workflows from programming bots to dynamic document authors in your organization.