feat: Add date_format parameter and error handling to inject_date feature

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-05-21 03:30:20 +00:00
parent 547e46b8cf
commit 9973011be5
3 changed files with 91 additions and 8 deletions

View File

@@ -7,15 +7,29 @@ agent = Agent(
inject_date=True, # Enable automatic date injection
)
agent_custom_format = Agent(
role="financial_analyst",
goal="Provide financial insights with proper date context",
backstory="You are a financial analyst who needs precise date formatting.",
inject_date=True,
date_format="%B %d, %Y", # Format as "May 21, 2025"
)
task = Task(
description="Research market trends and provide analysis",
expected_output="A comprehensive report on current market trends",
agent=agent,
)
task_custom = Task(
description="Analyze financial data and provide insights",
expected_output="A detailed financial analysis report",
agent=agent_custom_format,
)
crew = Crew(
agents=[agent],
tasks=[task],
agents=[agent, agent_custom_format],
tasks=[task, task_custom],
)
result = crew.kickoff()