Skip to content

Using internal knowledge

Modern LLMs have a vast amount of knowledge and skills acquired during pre- and post-training. For many tasks there's no need to provide them extra skill sources when used as code action models. For example, Claude 3.7 Sonnet can perform a Kernel Ridge Regression, hyperparameter optimization and plotting the results out-of-the box from its prior knowledge:

import asyncio
import os

from rich.console import Console

from freeact import CodeActAgent, LiteCodeActModel, execution_environment
from freeact.cli.utils import stream_conversation


async def main():
    async with execution_environment(
        ipybox_tag="ghcr.io/gradion-ai/ipybox:example",
    ) as env:
        async with env.code_executor() as executor:
            model = LiteCodeActModel(
                model_name="anthropic/claude-3-7-sonnet-20250219",
                reasoning_effort="low",
                api_key=os.getenv("ANTHROPIC_API_KEY"),
            )
            agent = CodeActAgent(model=model, executor=executor)
            await stream_conversation(agent, console=Console())


if __name__ == "__main__":
    asyncio.run(main())
uvx freeact \
  --ipybox-tag=ghcr.io/gradion-ai/ipybox:example \
  --model-name=anthropic/claude-3-7-sonnet-20250219 \
  --reasoning-effort=low \
  --api-key=$ANTHROPIC_API_KEY

Example

output

Produced images:

image_0 image_1