Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.fact0.io/llms.txt

Use this file to discover all available pages before exploring further.

ChatDev

ChatDev is research-leaning. The pattern below wraps a single ChatChain run.

Install

Clone ChatDev and install Fact0 alongside it:
pip install fact0

Pattern

One execution per chain, one span per phase.
import fact0
from chatdev.chat_chain import ChatChain

client = fact0.Client(api_key="alk_live_...")

chain = ChatChain(
    config_path="CompanyConfig/Default/ChatChainConfig.json",
    config_phase_path="CompanyConfig/Default/PhaseConfig.json",
    config_role_path="CompanyConfig/Default/RoleConfig.json",
    task_prompt="Build a tic-tac-toe game",
    project_name="tictactoe",
    org_name="fact0-demo",
    model_type="GPT_4",
)

with client.telemetry.execution(agent_id="chatdev.company") as ex:
    original = chain.execute_step

    def traced_step(phase_item):
        with ex.span(phase_item["phase"], span_type="CUSTOM") as span:
            result = original(phase_item)
            span.complete(output={"phase": phase_item["phase"]})
            return result

    chain.execute_step = traced_step
    chain.execute_chain()
  • AutoGen for general multi-agent chat
  • CrewAI for team-style workflows