Lass mal ne KI-Gang gründen! (crewAI Tutorial)
CrewAI soll ein einfaches Framework sein, um AI-Agents aufzusetzen. Lass es uns in diesem crewAI Tutorial einmal ausprobieren!
Neues git repo anlegen
Hach, der Geruch eines leeren Repos! Wir gehen auf github, erstellen ein neues repository (ich habe meins „crew“ genannt):

Anschließend clonen wir das repo und öffnen VSCode:

Dann folgen wir dem Setup unter https://github.com/crewAIInc/crewAI/blob/main/README.md
Schnell eine virtuelle Umgebung erstellt, dann crewAI installiert:

Beim Setup der .env.local File sich fragen, was Serper ist. Herausfinden, dass es eine günstige Google API ist. Kostenlosen Account erstellen und einen API Key erstellen. Sich den OpenAI Key schnappen und alles in die .env.local packen:

Copy/Paste des crewAI Beispiels, danach anpassen. In diesem Tutorial wollen wir unsere Gang eine Präsentation erstellen lassen, was zu tun ist, um in Deutschland der neuen E-Rechnungs-Regulierung zu entsprechen:
import os
from crewai import Agent, Task, Crew, Process
from crewai_tools import SerperDevTool
from dotenv import load_dotenv
load_dotenv()
search_tool = SerperDevTool()
# Define your agents with roles and goals
keynote_speaker = Agent(
role='Senior Business Analyst',
goal='Give a keynote on the current developments on E-Invoicing in Germany',
backstory="""You work at a leading business consulting firm.
Your expertise lies in helping businesses adopt E-Invoicing standards according to the EN 16931 regulation in Germany.
You have a knack for dissecting complex regulations and presenting actionable insights.""",
verbose=True,
allow_delegation=True,
# You can pass an optional llm attribute specifying what model you wanna use.
# llm=ChatOpenAI(model_name="gpt-3.5", temperature=0.7),
tools=[search_tool]
)
keynote_listener = Agent(
role='Entrepreneur and managing director',
goal='Understand what needs to be done to adopt E-Invoicing in Germany',
backstory="""You are an entrepreneur and a managing director.
You have heard about the need to adopt a new standard of E-Invoicing in Germany but are overwhelmed about what needs to be done.
You love to give feedback on how information is presented and asking questions.""",
verbose=True,
allow_delegation=True
)
# Create tasks for your agents
task1 = Task(
description="""Create a keynote presentation that helps the average German SMB owner what needs to be done to comply with the EN 16931 regulation""",
expected_output="Full keynote presentation in bullet points",
agent=keynote_speaker
)
task2 = Task(
description="""Consume the keynote presentation and understand what needs to be done to comply with the EN 16931 regulation""",
expected_output="Feedback to the keynote speaker",
agent=keynote_listener
)
# Instantiate your crew with a sequential process
crew = Crew(
agents=[keynote_speaker, keynote_listener],
tasks=[task1,task2],
verbose=True,
process = Process.sequential
)
# Get your crew to work!
result = crew.kickoff()
print("######################")
print(result)
Das Ganze aufrufen, zurücklehnen und dem Wahnsinn zusehen:

Der erste Agent legt bereits los mit einer Google Suche zu aktuellen Entwicklungen zum Theme E-Rechnungen:

Alles klar, alles verstanden. Unser Keynote Speaker legt los und spuckt insgesamt 11 slides aus:

Output erzeugt, weiter geht’s:

OK, es wird interessant. Unser Keynote Listener legt los:

Ha! Die Keynote wird als Kontext mitgegeben und gleich eine Frage gestellt. Was muss ich denn jetzt tun? Unser Keynote Speaker legt also wieder los:

Und der Speaker gibt eine angepasste Version aus:

Welche wieder an unseren Listener geht:

Noch eine Feedback-Schleife:

Und eine letzte Ausgabe:

Und hier die finale Präsentation:
Keynote Presentation: Navigating E-Invoicing Compliance: EN 16931 in Germany
1. Introduction: Understanding E-Invoicing Compliance: EN 16931 in Germany
- E-invoicing will be mandatory for B2B transactions in Germany starting January 1, 2025.
- The regulation aims to standardize electronic invoicing to improve efficiency, reduce errors, and ensure tax compliance.
2. Background on EN 16931: What is it and its purpose
- EN 16931 is a European standard for electronic invoicing.
- Its purpose is to ensure interoperability and compliance across EU member states by defining a common invoicing format.
3. Timeline for Compliance: Key dates to remember and phased implementation
- January 1, 2025: Mandatory for all B2B transactions to receive e-invoices in the structured CEN 16931 format.
- January 1, 2027: Resident businesses with a turnover exceeding 800K€ must issue electronic invoices compliant with EN 16931.
- Transitional rules will apply through the initial implementation phase to allow businesses to adapt.
4. Key Requirements: Receiving, issuing e-invoices, and ongoing compliance
- Receiving: Businesses must be able to receive e-invoices in the EN 16931 format.
- Issuing: Businesses must issue e-invoices in the structured CEN 16931 format or an alternative compatible format.
- Ongoing Compliance: Continuous updates and monitoring to ensure ongoing compliance with regulatory changes.
5. Steps to Prepare: Assessing current systems, choosing the right solution, and training the team
- Assess Current Systems: Evaluate your current invoicing systems to identify gaps in compliance.
- Choose the Right Solution: Select an e-invoicing solution that supports EN 16931 and integrates with your existing systems.
- Training the Team: Provide training for staff on the new e-invoicing processes and compliance requirements.
6. Benefits of E-Invoicing: Efficiency, cost savings, accuracy, and sustainability
- Efficiency: Streamlined invoicing processes reduce manual handling and processing times.
- Cost Savings: Lower costs associated with paper invoicing, printing, and postage.
- Accuracy: Reduced errors and discrepancies with standardized data formats.
- Sustainability: Environmentally friendly by reducing paper usage.
7. Common Challenges and Solutions: Integration with existing systems, compliance updates, and staff adaptation
- Integration: Ensure your e-invoicing solution can seamlessly integrate with existing ERP and accounting systems.
- Compliance Updates: Stay informed about regulatory changes and updates to maintain compliance.
- Staff Adaptation: Manage change effectively by involving staff early and providing continuous support.
8. Case Studies: Successful implementations and lessons learned
- Review case studies of businesses that have successfully implemented e-invoicing to understand best practices and potential pitfalls.
9. Resources and Support: Government resources, industry associations, and consulting services
- Utilize resources from the German Tax Authority, industry associations, and consulting firms specializing in e-invoicing compliance.
10. Q&A and Closing Remarks: Summarize key points and contact information
- Summarize the key points of the e-invoicing compliance process.
- Provide contact information for further assistance and support.
11. Thank You: Importance of compliance and readiness for the future
- Emphasize the importance of compliance with EN 16931 for future-proofing your invoicing processes and ensuring tax compliance.