[Cell 001]
rschandrastechblog
Wednesday, May 13, 2026
CrewAI "Hello World" in a single colab sheet, without YAML files
Difference between Default CrewAI created by CrewAI and Handcoded CrewAI
When we run the command
Attribute Error: ‘str’ object has no attribute ‘get’
The reason the demo project works without those parentheses is due to how the @CrewBase decorator
and the class attributes agents_config and tasks_config work together.
In the official crewai create crew template, the code usually looks like this:
@agent
def researcher(self) -> Agent:
return Agent(
config=self.agents_config['researcher'], # This is the magic line
verbose=True
)
Here is the breakdown of why the official version works differently than your manual version:
1. The @CrewBase "Auto-Loading"
When you use the @CrewBase decorator, it automatically looks for a config/ folder.
It loads agents.yaml into an attribute called self.agents_config and tasks.yaml into self.tasks_config.
In your specific error, the logs showed:
WARNING:root:Agent config file not found at /content/config/agents.yaml. Proceeding with empty agent configurations.
Because those files were missing, self.agents_config was empty.
2. Lazy Loading vs. Manual Instantiation
In the official template, the Task definition in tasks.yaml usually looks like this:
research_task:
description: "Conduct research on {topic}"
agent: researcher # This is a STRING, not a function
When the CrewAI framework reads this YAML, it sees the string "researcher".
It then looks for a method decorated with @agent that has the name researcher.
It handles the "calling" of that function for you behind the scenes.
3. Why your code threw the AttributeError
In your manual code, you were doing this:
@task
def research_task(self) -> Task:
return Task(
description="...",
agent=self.researcher # Passing the METHOD reference
)
Because you weren't using the YAML configuration to link the two, you were passing the Python function object self.researcher directly into the agent parameter of the Task class.
The Task class expected an Agent object, but it received a function. When it tried to process that "agent," it tried to look for configuration data inside it, leading to the error:
AttributeError: 'function' object has no attribute 'get'
Summary Table
| Feature | Official Demo (YAML) | Your Manual Code |
| Agent Settings | Defined in agents.yaml | Defined inside Agent(...) |
| Task Connection | Linked via string name in tasks.yaml | Linked via self.agent_name() in Python |
| Decorator Role | Orchestrates the YAML-to-Method mapping | Mostly unused since configs were missing |
| Logic | Framework "calls" the methods for you | You must call the methods yourself |
In short, the official demo uses declarative configuration (YAML strings), whereas your approach was programmatic (Python objects). When doing it programmatically, you have to execute the function to produce the object the Task needs.
How are you finding the transition from YAML-based configs to pure Python?
CrewAI "Hello World" in a single colab sheet, without YAML files
[Cell 001] ! pip install -U crewai [Cell 002] from google.colab import userdata import os os.environ[ "GOOGLE_API_KEY" ] = use...
-
http://www.sommarskog.se/share_data.html How to Share Data Between Stored Procedures An SQL text by Erland Sommarskog, SQL Server MVP. M...
-
CONCLUSION : 1. Normally, use following two when you do not want query compilation also to come into picture. CHECKPOINT DBCC DROPCLEA...
-
Most of the google tutorials on keras do not show how to display a confusion matrix for the solution. A confusion matrix can throw a clear l...