mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 00:58:30 +00:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user