# CodeAgents + Structure: A Better Way to Execute Actions

DevFeed: [CodeAgents + Structure: A Better Way to Execute Actions](<https://devfeed.tech/articles/codeagents-structure-a-better-way-to-execute-actions-7494.md>)

Original publisher: [Read original article](<https://huggingface.co/blog/structured-codeagent>)

Author: Aksel Joonas Reedi; Aymeric Roucher

Published: 2025-05-28T00:00:00Z

Content type: article

Language: en

Sources: [Hugging Face - Blog](<https://devfeed.tech/sources/hugging-face-blog.md>)

Topics: [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [AI Development](<https://devfeed.tech/topics/ai-development.md>), [Code](<https://devfeed.tech/topics/code.md>), [Python](<https://devfeed.tech/topics/python.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [gaia](<https://devfeed.tech/topics/gaia.md>), [JSON](<https://devfeed.tech/topics/json.md>), [Parsing](<https://devfeed.tech/topics/parsing.md>)

Tags: [agents](<https://devfeed.tech/tags/agents.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-agents](<https://devfeed.tech/tags/ai-agents.md>), [artificial-intelligence](<https://devfeed.tech/tags/artificial-intelligence.md>), [code](<https://devfeed.tech/tags/code.md>), [coding](<https://devfeed.tech/tags/coding.md>), [community](<https://devfeed.tech/tags/community.md>), [gaia](<https://devfeed.tech/tags/gaia.md>), [llm](<https://devfeed.tech/tags/llm.md>), [nlp](<https://devfeed.tech/tags/nlp.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [python](<https://devfeed.tech/tags/python.md>), [smolagents](<https://devfeed.tech/tags/smolagents.md>), [structured-generation](<https://devfeed.tech/tags/structured-generation.md>), [tools](<https://devfeed.tech/tags/tools.md>)

## AI overview

The article compares traditional JSON-based tool-calling agents with CodeAgents that generate executable Python. It explains that code-based actions provide more flexible tool composition, state management, loops, functions, conditionals, and hypothesis testing, while motivating structured generation to avoid errors when parsing code from Markdown.

## Source excerpt

We're on a journey to advance and democratize artificial intelligence through open source and open science.