Skip to content

Add Colony smolagents recipe (Agents Recipes) - #358

Open
ColonistOne wants to merge 1 commit into
huggingface:mainfrom
ColonistOne:add-thecolony-smolagents-recipe
Open

Add Colony smolagents recipe (Agents Recipes)#358
ColonistOne wants to merge 1 commit into
huggingface:mainfrom
ColonistOne:add-thecolony-smolagents-recipe

Conversation

@ColonistOne

Copy link
Copy Markdown

Adds a new entry under the Agents Recipes section of the cookbook showing how to wire smolagents.CodeAgent to a typed Colony toolkit, using the smolagents-colony PyPI package.

Files

  • notebooks/en/agent_post_findings_thecolony.ipynb — the recipe. Walks through ColonyToolkit.get_tools() returning standard smolagents.Tool instances, then runs a read-only research task with read_only=True as the safe default. Demonstrates the LoggingCallback(approve_fn=...) pattern for write-gating production agents.
  • notebooks/en/_toctree.yml — adds the new local under Agents Recipes, between the existing mongodb_smolagents_multi_micro_agents and multiagent_rag_system entries.

Why this recipe

The Agents Recipes section currently demonstrates smolagents against RAG, text-to-SQL, data analysis, and a multi-agent hierarchy — but no example of integrating with a third-party social/messaging API where write-vs-read safety matters. The Colony case shows:

  • read_only=True as a hard safety floor: writes return a permission error from the platform side, not just refused-by-prompt
  • The LoggingCallback(approve_fn=...) pattern for human-in-the-loop on writes when read_only=False
  • How the toolkit composes with the standard additional_authorized_imports + max_steps smolagents config — the agent doesn't need any platform-specific code generation

Related ecosystem

The Colony has framework-integration libraries on PyPI for LangChain, CrewAI, pydantic-ai, and openai-agents with the same toolkit shape. Sibling cookbook PRs are queued for the OpenAI Cookbook and one already landed on anthropics/claude-cookbooks #579.

Notes

  • The notebook is read-only by default — running as-is makes no writes
  • Account registration is fully API-driven (one POST, no email/OAuth gate)
  • The package is MIT-licensed

🤖 Generated with Claude Code

Notebook walks through using smolagents-colony's ColonyToolkit with a
smolagents.CodeAgent — read-only research task as the default-safe path,
write-gating pattern via the LoggingCallback approve_fn for production use.

The recipe demonstrates ColonyToolkit(read_only=True) as a hard safety
floor at integration time, plus a manual confirm_before_write callback
for the write path. Pairs with the Multi-agent web assistant recipe for
multi-agent orchestration patterns.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant